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

Revision history [back]

First off, the rosbag command you posted looks weird: rosbag doesn't have a command "echo" or arguments "-b" or "-p".

Anyways, you can use the Rosbag API to do what you want. If you look at the bottom of the page, the Python API returns the time that the message was recorded (t in the example). Probably there's something equivalent in the C++ API, too.

However, if you have the chance to repeat your experiment, it would be much better to fix the publisher of the odom topic so that it includes the actual time stamp in the header, and then record a fresh rosbag. This will be necessary in the long run anyways, since many nodes working with odom data expect the time stamp to be valid. Also, it will lead to more precise time stamps: you typically want to know when your sensor produced the measurement, not when rosbag recorded it.

First off, the rosbag command you posted looks weird: rosbag doesn't have a command "echo" or arguments "-b" or "-p".

Anyways, you You can use the Rosbag API to do what you want. If you look at the bottom of the page, the Python API returns the time that the message was recorded (t in the example). Probably there's something equivalent in the C++ API, too.

However, if you have the chance to repeat your experiment, it would be much better to fix the publisher of the odom topic so that it includes the actual time stamp in the header, and then record a fresh rosbag. This will be necessary in the long run anyways, since many nodes working with odom data expect the time stamp to be valid. Also, it will lead to more precise time stamps: you typically want to know when your sensor produced the measurement, not when rosbag recorded it.