Rosanswers logo

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!!!


Originally posted by rascal on ROS Answers with karma: 11 on 2012-04-29

Post score: 1


1 Answer 1


Rosanswers logo

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:

  <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"/>

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.

Originally posted by Thomas with karma: 4478 on 2012-04-29

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by Holton on 2013-04-16:
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!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.