ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

bag to csv

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

deathside gravatar image

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

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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

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

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 -0500 )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 -0500 )edit
I did the reindex. Still getting the same error. Please help
deathside gravatar image deathside  ( 2011-11-28 11:58:10 -0500 )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 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


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

Seen: 2,518 times

Last updated: Nov 28 '11