ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to log ROS-messages?

asked 2017-07-05 10:44:06 -0500

jimenisimo gravatar image

updated 2017-07-06 00:26:30 -0500

NEngelhard gravatar image

Hello, I am new in ROS, and now I have made a publisher that publish the data from an IMU connected to an arduino... but I would really would like to store this data, how can i do this in ros? roslogs, rosbags, mongod(warehouse)? I cannot find the answer in any place. I would really appreciate your orientation

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-06 01:44:06 -0500

updated 2017-07-06 01:59:07 -0500

You can use rosbags to save the data published in different topics (and play it later). You will find more informations here and here. The main command line you need to know is

rosbag record imu_data

where imu_data is the name of your IMU topic.

if you want to access your data outside ROS you can use

rostopic echo -b file.bag -p /topic > data.txt

This method works well for simple message formats and will redirect your data to a text file.

edit flag offensive delete link more


Thank you for your answer, I have done this: "rosbag record imu_data", but when I open the file it is unreadable, I can play it again but what I really want to do is see it as plain text, see the values and this can not be done with rosbag because it like a binary file. will this be solved with the

jimenisimo gravatar image jimenisimo  ( 2017-07-06 06:29:27 -0500 )edit

You can use rostopic echo -b file.bag -p /topic > data.txt as I explained before to export your data to a text file (or to a csv format if you prefer -> data.csv).

jeanpolochon gravatar image jeanpolochon  ( 2017-07-06 07:36:20 -0500 )edit

When I use that command I received the following message: ERROR: unable to use bag file: Unindexed bag

jimenisimo gravatar image jimenisimo  ( 2017-07-11 05:32:53 -0500 )edit

This is a rosbag problem, just refer to this page or try to do another rosbag record

jeanpolochon gravatar image jeanpolochon  ( 2017-07-11 06:06:40 -0500 )edit

Question Tools

1 follower


Asked: 2017-07-05 10:44:06 -0500

Seen: 3,206 times

Last updated: Jul 06 '17