[ros-users] Synchronizing computers

Blaise Gassend blaise at willowgarage.com
Mon Apr 19 20:24:16 UTC 2010


Chrony has been working well for us. We have computer 2 on the robot
synchronize with computer 1, and computer 1 synchronize with the outside
world. The key is to properly set the initstepslew so that at boot time
computer steps to the correct time. We have computer 1 set to
initstepslew to the external NTP server, and computer 2 set to
initstepslew to computer 1. We also have a makestep command that causes
computer 2 to jump to computer 1's reported time if it is off by more
than 5ms. (If that happens, the system will be running pretty badly.)

If it is properly set up, the only troubles you are likely to encounter
are if you lose touch with the outside NTP server, your two local
computers drift together, and then get back in touch with the outside
NTP server. If that happens, your computers will be out of sync with
each other as they each try to synchronize with the reference clock. 

The reason for this behavior is that chrony maintains an internal
reference clock independent of the system clock, which is the clock it
broadcasts to its clients. Thus, if computer 1 and computer 2 agree on
the time, and suddenly the external reference comes back, computer 1
realizes that its time is bad, steps its reference clock, and starts
slewing its system clock. Computer 2 then sees computer 1's changed
reference clock, and also starts slewing its system clock, but it has no
way of doing the slew in sync with computer 1 because computer 1's
system clock is not being sent to comoputer 2.

One solution I tried is to run two chrony servers on computer 1. The
first one synchronizes with the outside world, and the second one
publishes the system time to computer 2. This works to a certain extent,
but added complexity that we decided wasn't useful. The right solution
would be a modified chrony that takes into account the need for two
computers to remain synchronized as being a higher priority than being
synchronized with the world.

Cheers,
Blaise

On Mon, 2010-04-19 at 12:13 -0700, Patrick Bouffard wrote:
> I have a setup where my robot is capturing images with an onboard
> camera, while its pose is being measured by an external motion capture
> system, whose software is running on a different PC. The two machines
> talk to each other over a WLAN. I need to have good synchronization of
> the timestamps in the camera's images and the poses from the mocap
> system.
> 
> I plan on using the TF library to do the work of determining which
> pose message to pick (or messages to interpolate, perhaps?), but this
> assumes that the clocks on the computers are well synchronized. Thus
> far, I have one gateway computer on the WLAN with internet access that
> keeps its clock up to date with OpenNTP, and the two computers
> mentioned above using OpenNTP, with the gateway as their NTP source.
> I'm not sure of how to check how well this attempt at synchronization
> is working, though.
> 
> How have others approached this problem? I have heard that Chrony is a
> possible solution and would be interested to hear of any experiences
> with it or any other method.
> 
> Thanks,
> Pat
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users





More information about the ros-users mailing list