Time Synchronization¶
Align data from multiple sources with different time bases.
The Problem¶
Different data sources use different time references:
| Source | Time Base | Resolution |
|---|---|---|
| Sensor GPS | UTC (GNSS) | 1 ms |
| Drone (DJI) | Internal tick | 100 ms |
| Drone (ArduPilot) | Boot time | 1 ms |
| Inclinometer | Internal RTC | 10 ms |
| Camera | Frame index | 33 ms (30fps) |
Synchronization is essential for sensor fusion and accurate analysis.
Synchronizer Overview¶
flowchart LR
A[GPS Reference]
A --> S[NED Coordinates]
B[Drone GPS]
C[Litchi GPS]
B --> S
C --> S
%% Vertical ordering: Drone above Litchi
B
C
S --> O1[Time Offset: Reference to Litchi/Drone]
C --> P[Pitch from Litchi]
D[Inclinometer] --> P
P --> O2[Time Offset: Inclinometer to Litchi/Drone]
O2 --> O1
Mathematical Description of the Calculations¶
NED Position Correlation¶
The NED (North-East-Down) method correlates 3D position signals to find time offsets between GPS sources.
Step 1: LLA to ENU Conversion¶
Convert GPS coordinates to local East-North-Up (ENU) frame relative to reference point:
where \(R = 6{,}371{,}000\) m (Earth radius)
Step 2: Interpolation to Common Timebase¶
Both GPS sources are interpolated to a common high-rate timebase (default 100 Hz):
Interpolated signals: - \(E_1(t), N_1(t), U_1(t)\) - Reference GPS in ENU - \(E_2(t), N_2(t), U_2(t)\) - Target GPS in ENU
Step 3: Cross-Correlation Per Axis¶
Cross-correlation for each spatial axis:
Normalized correlation:
Applied to each axis:
- \(\rho_E[\tau]\) - East correlation
- \(\rho_N[\tau]\) - North correlation
- \(\rho_U[\tau]\) - Up correlation
Step 4: Sub-Sample Peak Detection¶
Find sub-sample peak using parabolic interpolation around integer peak:
Step 5: Weighted Average Time Offset¶
Combine offsets from all three axes weighted by correlation strength:
Overall correlation quality:
Step 6: Spatial Offset After Time Alignment¶
After applying time offset, compute residual spatial offset:
Pitch Correlation¶
Step 1: Interpolation to Common Timebase¶
Both pitch signals interpolated to high rate (100 Hz):
Step 2: Cross-Correlation¶
Normalized:
Step 3: Sub-Sample Peak Detection¶
Same parabolic interpolation as NED method:
Step 4: Chained Time Offset¶
Total time offset to align Inclinometer with GPS payload:
This two-stage approach allows synchronization even when Inclinometer and GPS don't share overlapping spatial trajectories, using Litchi gimbal as an intermediate reference.
Physical Interpretation¶
- Time Offset (\(\tau\)): Seconds to add to target timestamp to align with reference
- Correlation (\(\rho\)): Quality metric, range [0, 1]
- \(\rho > 0.9\): Excellent
- \(0.7 < \rho < 0.9\): Good
- \(\rho < 0.7\): Questionable
- Spatial Offset (\(d\)): Residual position error after time alignment (should be < 5m for good GPS)