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

bag to csv

asked 2011-11-18 00:47:52 -0600

deathside gravatar image

updated 2011-11-18 00:48:57 -0600

I am doing this to grab a topic from my bag rostopic echo -p -b bagfile.bag /topic1 > topic1.txt

an example text file is this:




is %time unix time? because I can't seem to convert it.

What I would like is to convert this to tell me the number of seconds from its start, so the bag starts with 0 time, this is to match the timestamp on an audiofile logged at the same time as this.


edit retag flag offensive close merge delete


Seems like its the unix time at nanosecond level. You could trim of the last 9 digits if you dont care for sub-second accuracy.
Ben_S gravatar image Ben_S  ( 2011-11-22 04:05:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-11-18 01:02:38 -0600

It's probably the easiest to use the Python API of rosbag. See this example for how to access the timestamp and here is a description for handling times with rospy.

edit flag offensive delete link more


I am trying the cookbook python example and I am getting this... rosbag.bag.ROSBagUnindexedException: Unindexed bag
deathside gravatar image deathside  ( 2011-11-22 03:59:29 -0600 )edit
rosbag (the command line tool) has a reindex function, see "rosbag help"
Felix Endres gravatar image Felix Endres  ( 2011-11-23 00:21:16 -0600 )edit
I did the reindex. Still getting the same error. Please help
deathside gravatar image deathside  ( 2011-11-28 11:58:10 -0600 )edit
Have you tried to use the tip of Ben_S in the comment on your question?
Felix Endres gravatar image Felix Endres  ( 2011-12-01 22:24:24 -0600 )edit

Question Tools


Asked: 2011-11-18 00:47:52 -0600

Seen: 2,690 times

Last updated: Nov 28 '11