What is time synchronization?

When working in a network with various computers, each has a clock that provides them time. In most cases, being connected to the same network requires that all have the same time reference in order to coordinate their tasks. Here is where time/clock synchronization plays an important role. We can define time synchronization as the different processes or tasks to be carried out in order to coordinate base times in all different clocks all over the network.

To accomplish synchronization between these distributed systems we need to set a very accurate reference. Despite selecting a good base time, hardware clocks use to count time at different rates. Furthermore, the quality of the oscillator is also a factor that has to be taken into account in order to avoid what is known as drift clock. To avoid or mitigate this, there are various options we can choose, for example using GPS (Global Positioning System) that provides an accuracy of tens of nanoseconds, NTP (Network Time Protocol) widely employed nowadays to set the clocks of our PCs and PTP (Precision Time Protocol) which offers great accuracy through local networks. PTP is the one chosen for our demo.

PTP

Precision Time Protocol, which is the one used in the video above, was defined in 2002, but the second version was released in 2008 as IEEE 1588-2008 standard. Thanks to PTP we can obtain accuracies in the range of sub-microseconds without the need of a GPS system which is a great advantage when GPS signal is not available (e.g. indoor applications) or the cost of the receiver is not affordable. PTP has a Master-Slave architecture and defines the messages between them where the Master provides the time and the Slave synchronizes to the first. The aim of these messages exchanges is to fix the existing offset between the Master and the Slave.

When do we need time synchronization?

In most robotic applications several robot sensors and actuators are used. This means that there should be a coordination between sensor data and actuators. For example, if we think on an Advanced Driver Assistant System (ADAS), the wide variety of sensors available and the need of a coordinated and fast response forces to have a very accurate clock synchronization.

Another good example where time synchronization plays a critical role is in a Simultaneous Localization and Mapping application. Let’s suppose that we have a laser scanner with its motor and a camera; the lack of coordination/synchronization between them would result in a poor quality point cloud.

Finally, if we are interested in logging data from our modules or robots, it is needed to achieve a right clock synchronization so that we can plot that data in graphs and the information is coherent.

How did we set up the demos?

In this case, we show the use of time synchronization for coordinated motion control. Having a common reference time in a distributed system allows to coordinate motion accurately between robotic arm motors, different robots or between robots and an external process.

In both setups, all the devices are synchronized using the PTP protocol. The Open Robot Controller (ORC) acts as the grandmaster clock providing the reference clock for all the robotic arms. All the robotic arms are connected to the ORC by using a PTP capable switch. Inside MARA robotic arm, each H-ROS SoM module works as PTP slave by using a Peer-to-Peer (P2P) delay mechanism. In order to coordinate the robot motion, trajectories are sent with a scheduled timestamp. The H-ROS SOM executes the motion accurately at the specified time.