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

Time synchronization errors with multiple computers

asked 2013-03-01 10:04:10 -0500

ebeowulf gravatar image

I am experiencing a string of time synchronization errors that I am struggling with.

I have two different computers, each of which is streaming data from a different sensor. I have set the time update on each computer to look at a common time server (sudo ntpdate {ip.address}).

  • Computer A runs a Hokuyo, the roscore, a robot urdf, amcl, and a processing node (A_p) for the hokuyo data.
  • Computer B runs a Kinect, two processing nodes accessing the kinect (B_p), a node (C_p) fusing data from the kinect and the processing node (A_p), and another node fusing information from all of the nodes (A_p, B_p, and C_p) on computer A and B, and transforming their locations into map space (generated by amcl).

This configuration generates synchronization errors, even though everything uses ros::Time::now() to retrieve time. When fusing data in node B_p, I get time synchronization errors:

terminate called after throwing an instance of 'tf::ExtrapolationException what(): Lookup would require extrapolation into the past. Requested time 1362173375.685855810 but the earliest data is at time 1362173375.907669363, when looking up transform from frame [/robot_tf/back_laser] to frame [/robot_tf/base_link]

and when transforming data into /map space, I get transformation errors that I am assuming are also time synchronization errors:

terminate called after throwing an instance of 'tf::LookupException' what(): Frame id /robot_tf/base_link does not exist! Frames (6): Frame /robot_tf/camera2_depth_optical_frame exists with parent /robot_tf/camera2_depth_frame.

All of these processes work when on the same computer, but spread across 2 computers, they eventually fail... and eventually isn't very long. Can I get rid of these errors entirely? Barring that, how do I ignore these errors? Do I need to write my own exception handler, or is there something easy in ros already?

Thank you,

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-03-01 10:41:03 -0500

I'm not sure if this is what's producing the error, but:

When dealing with message data and tf, I avoid using ros:Time::now() whenever possible. Instead, use the timestamp of each message.

edit flag offensive delete link more

answered 2013-03-01 22:03:06 -0500

Gav gravatar image

Also make sure that both machines are time synced to something. (e.g. using chrony, ntp, etc.) Otherwise you'll see laggy data in Rviz, and other fun stuff.

edit flag offensive delete link more

answered 2013-03-01 15:59:13 -0500

tfoote gravatar image

I suggest you go through the tf Tutorials to know how to handle the exceptions correctly. In any distributed setup it is expected that you will need to make your code robust to exceptions.

edit flag offensive delete link more

Question Tools


Asked: 2013-03-01 10:04:10 -0500

Seen: 886 times

Last updated: Mar 01 '13