PTP Time Synchronization Configuration Guide¶
Overview¶
PTP (Precision Time Protocol) is a protocol used to synchronize clocks across a computer network, capable of achieving nanosecond-level time synchronization accuracy. GDK provides two scripts for establishing PTP time synchronization between the device side (robot side) and the user side (client).
Use cases¶
- Multi-sensor data fusion: Requires precise timestamp alignment across multiple sensors' data
- Distributed system synchronization: Multiple devices need high-precision time synchronization
- Real-time control systems: Control applications that require nanosecond-level time precision
- Data acquisition and analysis: Data acquisition scenarios that require precise timestamps
Prerequisites¶
User-side (client) requirements¶
- Network adapter IP address in the
10.42.1.*subnet - A PTP hardware clock device (
/dev/ptp*) - The
linuxptptoolkit installed - Root privileges to run the scripts
Steps¶
1. Run the server script on the device side (robot side)¶
First, run the ptp_server.sh script on the robot side:
2. Run the client script on the user side (client)¶
Keep ptp_server.sh running on the robot side, then run the ptp_client.sh script on the client machine (do not run it inside a container):
Important: The client script requires root privileges and must be run with sudo.
Notes¶
- Synchronization accuracy: The current software-timestamp version can achieve a latency of under 10ms once synchronization completes. After synchronization completes, ptp_client.sh exits automatically, while ptp_server.sh must be stopped manually.
- Handling sync failures: If the latency is too large, re-run the synchronization
- Time drift: After synchronization, the error will gradually grow over time, reaching up to 50ms within one hour
- Lidar latency: Lidar latency is around 100ms both internally and externally to the machine
- Sensor latency: Before calling the sensor latency interface, you must first perform time synchronization, otherwise the latency statistics will be inaccurate