Episode 4: first data

In real-time processing, one might think synchronization isn’t that important. After all, the system processes data as it comes in, on the fly.
But as soon as sensor fusion comes into play, timing becomes critical. We need to know exactly when each sensor captured its information.

Imagine a vehicle moving at 50 km/h. Even a small timing difference between two sensors can mean that an object has moved noticeably between their respective measurements. This can lead to inaccurate object positions, inconsistent detections and, ultimately, poorer fusion results.
To avoid this, all sensors need to share a common and precise time reference.


Now, there’s an important distinction here: our sensors are synchronized, but they are not triggered simultaneously.
Each sensor runs at its own pace, with its own acquisition cycle and frame rate. Synchronization simply means that they all share the same clock. So, even though they don’t capture their data at exactly the same instant, we know precisely when each measurement was taken.
This common time reference allows us to align the data correctly before feeding it into the fusion pipeline.

How Synchronization Is Achieved in the SensorPod

For this project, the UM982 GNSS receiver provides the reference timing signal through its PPS (Pulse Per Second) output, which is connected to the Raspberry Pi.
The Raspberry Pi uses the PPS signal to adjust its system clock through a Chrony daemon and linuxptp service. This gives the system a stable time reference, which the Raspberry Pi then uses as the master clock for sensor synchronization.

The LiDAR and radar support the gPTP (Generalized Precision Time Protocol) standard, allowing them to synchronize their clocks with the master clock.
The result is a shared time base across the system, allowing measurements from different sensors to be accurately timestamped and aligned before being combined.

It’s one of those things that can easily be overlooked when building a sensor system, but getting the timing right is fundamental to making sensor fusion work reliably.

In ROS2

I haven’t really mentioned it so far, but I used ROS 2 as the middleware to record and process the data.

ROS 2 is a fantastic open-source framework, backed by a large and active community. It’s a great starting point, and there is a lot you can achieve with it.
However, handling large volumes of sensor data, as we do in this project, can quickly become challenging. You soon find yourself looking into zero-copy data transfer to avoid unnecessary memory copies and keep up with the incoming data rate. On top of that, you need to spend time tuning QoS settings to make sure data flows reliably and efficiently.
Another thing I’ve learned is that ROS 2 alone isn’t quite enough for a complete development workflow. You quickly need additional tools, especially a graphical interface to visualize, inspect and analyse your data. Foxglove is a great example.

There are, of course, other tools available, including commercial platforms offering safety-related capabilities and certification options. I actually fell in love with RTMaps a few years ago. It’s a commercial tool, and yes, it comes with a price tag. But in a professional environment, the cost of the tool will quickly pay for itself through the productivity gains.

Of course, open source has tremendous value, and sometimes building things yourself is part of the fun.

The data

I spent a few days collecting data, usually recording for about an hour at a time, at different times of the day to capture a good mix of lighting and traffic conditions.
In total, I collected around 6 hours of data, covering approximately 350 km of driving.

The Foxglove viewer shown below was used during the drives to monitor the sensor streams and verify that all sensors were properly synchronized.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *