How to export time data (to .txt file) published on /clock topic by playing a rosbag file ?

asked 2022-09-07 10:44:31 -0500

ros_user_ak gravatar image

updated 2022-09-07 13:44:54 -0500

I have a rosbag file which publishes time values to /clock topic when I play it.

I need to save these time values to a .txt file.

There is one relevant solution as shown below:

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

However, in my case the /clock topic publishes data of type ros::Time

Therefore, data cannot be written to text file. I need these ros time values in double sec; so that it can be written to .txt file.

Any suitable solution for this problem ?

edit retag flag offensive close merge delete


I am not sure if there are ready-made solutions for this. Nevertheless, the rosbag/Code API should be helpful.

ravijoshi gravatar image ravijoshi  ( 2022-09-07 22:50:17 -0500 )edit