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

Time synchronization between multiple sensors on multiple Raspberry Pi's

asked 2019-11-01 04:59:38 -0500

Test01 gravatar image

I have ROS kinetic running on two Raspberry Pi's (RPi's). Each RPi has is connected to a set of sensors. The RPi's are not connected with each other as they will be out in the field, but will be connected at least once via WLAN to a master computer to start (and eventually stop) the recording (rosbridge service to start/stop a rosbag file). Once data is collected, I would like to combine and analyze the data from both RPi's and therefore synchronize the data over time.

How can I ensure that they both record at the same clock time? I can add a real-time clock (RTC) to each of them and synchronize each RTC with the internet time once before the recording. But is that precise? I have seen in other threads here that chrony is recommended, which I have no experience with, yet. Another idea could be to record GPS reference time on both RPi's and synchronize the data to that one, but it would be recorded at low frequency (about 10 Hz) and I am not sure either how precise it could be.

Ideally, I would like to have a time sync error below say 1 ms.

Do you have any spontaneous suggestions how to go after it? I hope I provided enough details.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-11-02 20:07:41 -0500


Its an industry standard and works well for what you want. Look up specific instructions for your platform, that's not really ROS related so I don't want to get into any super deep discussion on it in this forum.

edit flag offensive delete link more


@stevemacenski: would this need the two PIs to be networked? The OP seems to indicate that this is not the case, or at least not always.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-04 02:25:52 -0500 )edit

To have something like the metric they're looking for, something like Chrony / PTP would be required, otherwise the clock drift over time would exceed 1 ms. Even NTP would not likely bound it below 1 ms over extended durations.

stevemacenski gravatar image stevemacenski  ( 2019-11-04 02:32:25 -0500 )edit

I know, but I just wanted to draw attention to this fact for the benefit of the OP.

It's not entirely clear OP is aware of the intricacies of networked clock synchronisation, so making this requirement (ie: permanent network connection) explicit was something I felt could be important.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-04 02:47:26 -0500 )edit

answered 2019-11-04 12:47:42 -0500

duck-development gravatar image

updated 2019-11-04 12:49:48 -0500

If you like to have an sync of 1ms the pi it the wrong system. Because then you neet a real time system.

It is not possible to sync those with # 1ms precision with an hard wire. Because you OS make different stuff in the background. The io has also delays.

You are not Abe to readout the sensors with this precise on one PI

edit flag offensive delete link more


That is inaccurate. You can easily achieve 1ms on an RPi with a wired connection.

stevemacenski gravatar image stevemacenski  ( 2019-11-06 07:42:13 -0500 )edit

If you could generate signal witch 1ms accuracy who need a real time system? Because ethercat is working with this frequency, and this the only couse you use an iec system.

duck-development gravatar image duck-development  ( 2019-11-06 08:34:10 -0500 )edit

1ms is not real-time, 1ms is 1ms. They're asking about a real-time clock, not a real-time system. 1ms is just their example specification they want to bound their error at.

stevemacenski gravatar image stevemacenski  ( 2019-11-06 08:56:17 -0500 )edit

Question Tools



Asked: 2019-11-01 04:59:38 -0500

Seen: 1,934 times

Last updated: Nov 04 '19