Ask Your Question
1

Start rostopic echo within launch?

asked 2012-04-29 02:37:24 -0600

rascal gravatar image

Hi All!

I want to save data with "rostopic echo -p > filname" like shown here: link text

Is it possible to start echo recording with my launch file and how? Is there any other way to record and import data to matlab in a convenient way? Thx for help!!!

Bye

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-04-29 03:53:16 -0600

Thomas gravatar image

updated 2013-04-02 18:26:35 -0600

One solution would be to wrap this call into a python node for instance system.exec and the subprocess module (on python.org). This node can then be started by a roslaunch file.

However, I would highly recommend that you use rosbag instead, this is a much more reliable tool that rostopic. For instance you can do:

<launch>
  <node pkg="rosbag" type="rosbag" name="rosbag_record"
    args="record -o /tmp/slam-map /wide/left/image_raw /wide/left/camera_info /wide/right/image_raw /wide/right/camera_info /rosout"/>
</launch>

Here you will have in /tmp a rosbag file beginning with slam-map followed by the current date and time.

It is then quite straightforward to convert a file to a csv file which can then be read by matlab or whatever 3rd party tool you use. See the rosbag API to know how to do so. I also have written a converter rosbag to csv, it is not in a public repository but if you are interested I can post it here.

edit flag offensive delete link more

Comments

Hello, sir, I am new in ROS, I am wondering how to covert a bag file into csv, could you please give me more hint? please! Thank you!

Holton gravatar imageHolton ( 2013-04-16 16:01:38 -0600 )edit
0

answered 2013-12-01 04:36:28 -0600

PabloPM gravatar image

updated 2013-12-01 04:39:27 -0600

Thanks Thomas for your post, it helped me too, but there is one more thing i still would like to understand, in the question rascal asked for running a rostopic echo from a launch, you answered that.

But notice in the question example rascal used a filename output specification (for directory and file name), for example i can use:

$rostopic echo /fix>/home/user/directory/filename.txt

and it will write the messages in the specified directory, is there any way I can run the rostopic echo from a launch like the one you gave, but specifing also the output file directory? Personally I would like to output addicional messages with output="screen" and output topic messages in the .txt file specified in the directory but im not able to find the way to output the file in a specified directory

Thank you very much,

Pablo Payno

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-04-29 02:37:24 -0600

Seen: 1,275 times

Last updated: Dec 01 '13