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

Synchronizing different nodes on different machines

asked 2021-03-09 04:56:31 -0500

joaocandre gravatar image

What would be the best approach to synchronize two ROS2 nodes (i.e. a common shared clock/time) on two different machines, connected over a wireless network?

At present I've implemented a third node on one of the machines providing a clock, but apparently there is a slight delay/latency of 5-20ms on the other machine, which is variable, and thus hinders the accuracy of time readings.

Is this delay caused/affected by ROS or solely by the network configuration? Is there any tool built into ROS that can help with precise syncrhonization?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-03-09 05:08:34 -0500

gvdhoorn gravatar image

updated 2021-03-09 05:14:14 -0500

What would be the best approach to synchronize two ROS2 nodes (i.e. a common shared clock/time) on two different machines, connected over a wireless network?

A non ROS solution: using ntp or chrony (or perhaps even something using ptp).

Time-synchronisation across different machines is expressly not a responsibility of ROS, as there are well established protocols and tools to do that, and it's largely orthogonal to what ROS was created for.

Is there any tool built into ROS that can help with precise syncrhonization?

No. See my earlier comment.

At present I've implemented a third node on one of the machines providing a clock,

Are you publishing to the clock topic? Note that topic is not intended to be used for (wall) clock synchronisation across multiple machines.

See also: Clock and Time on the ROS 2 Design site.

but apparently there is a slight delay/latency of 5-20ms on the other machine, which is variable, and thus hinders the accuracy of time readings.

Tools like ntp and chrony have built-in systems to compensate for transmission delays and similar challenges which come with time-synchronisation across multiple machines and using COTS networking infrastructure.

edit flag offensive delete link more

Comments

I'll check ntp and chrony, they seem to be what I'm looking for. My particular setup involves a Raspberry Pi acting as access point to another computer, thus there is no internet access, but I'm not looking at precise time values, I just need both machines to share clock/time.

joaocandre gravatar image joaocandre  ( 2021-03-09 08:24:29 -0500 )edit

That would be what chrony is specifically for I believe.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-09 08:31:46 -0500 )edit

I'm indeed publishing to \clock, mostly for simplicity/verbosity, but what exactly would be the difference in using a different topic?

joaocandre gravatar image joaocandre  ( 2021-03-09 08:34:07 -0500 )edit

but what exactly would be the difference in using a different topic?

the comment was about the approach, not about the specific name of the topic.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-09 08:41:44 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-03-09 04:56:31 -0500

Seen: 1,066 times

Last updated: Mar 09 '21