Robotics StackExchange | Archived questions

How to log ROS-messages?

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

Asked by jimenisimo on 2017-07-05 10:44:06 UTC

Comments

Answers

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.

Asked by jeanpolochon on 2017-07-06 01:44:06 UTC

Comments

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

Asked by jimenisimo on 2017-07-06 06:29:27 UTC

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).

Asked by jeanpolochon on 2017-07-06 07:36:20 UTC

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

Asked by jimenisimo on 2017-07-11 05:32:53 UTC

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

Asked by jeanpolochon on 2017-07-11 06:06:40 UTC