math_seeker
math_seeker

Reputation: 15

Time syncing between two Ubuntu 16.04 desktops havinginternet connection

I have two Ubuntu 16.04 desktops with ROS installed on both of them. I am publishing data on using one of the computers and subscribing to that data on the other computer. I have written a little script that calculates the latency. The script measures the current Unix time with the unix timestamp associated with the data. But, I am getting negative latency (i.e. I receive data before it is published) which doesn't make sense.

There is obviously an issue of time sync between the two machines. My assumption was that the Ubuntu system connected to internet is already in sync. We don't need to perform any other synchronization. Am I wrong in that assumption? Do, I need to perform some kind of synchronization between the two machines?

Thank you!

Upvotes: 1

Views: 999

Answers (1)

doggie_breath
doggie_breath

Reputation: 802

Yeah, when running ROS across multiple machines you can definitely run into timing issues. How big of a difference are you generally seeing?

The ROS recommended solution is is to use a package called chrony. You can use it to specifically sync the clocks on your two machines. Over the same LAN, they should be synced down to at least the microsecond. It can just be installed VIA apt,

sudo apt install chrony

Then you can just set one computer to be the master and have it sync with the NTP server, and have the other sync its time with the master.

Upvotes: 1

Related Questions