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

how to work with ros time

asked 2013-02-07 17:36:22 -0500

mte2010 gravatar image


I have saved some gps data using the gps fix message type. In this message, the gps data has a field called %time.

Except, this %time data is kind of weird. The format the %time values are in is of the following:





How do I convert this time data to something that I can work with, for example, 1, 2, 3, 4, 5 seconds, etc.

Thanks for the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-07 18:17:48 -0500

I don't see any ROS functions for doing this, but here's an algorithm in PHP that you could use:

edit flag offensive delete link more


Hmm, this is talking about gps time. I looked into my data a bit more, and I found that: -this time data is actually rostime and not gps time, so basically I capture this gps data using play [rosbag_file_name] and then I just listen to my gps topic. So this time data is the same time data as rosbag

mte2010 gravatar image mte2010  ( 2013-02-10 08:51:08 -0500 )edit

So, how would I convert this rosbag time to something in seconds that makes sense? Once again, this rosbag time looks like this: 1355885782739630000, 1355885782763280000, and my loop rate is at 50 hz or 0.02 seconds

mte2010 gravatar image mte2010  ( 2013-02-10 08:54:18 -0500 )edit

The time field of the GPSFix message is supposed to be GPS time... how is that field getting filled? The ROS time should be in GPSFix.header.stamp

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-02-10 09:00:25 -0500 )edit

Question Tools


Asked: 2013-02-07 17:36:22 -0500

Seen: 840 times

Last updated: Feb 07 '13