macrobomastercontrolteam / Task_Board

Board of all tasks for control team
0 stars 0 forks source link

Improve Time synchronization procedure #32

Closed GJSK-Novice closed 1 month ago

GJSK-Novice commented 1 month ago

Currently CV and control board timestamp sync only involves one round-trip. It is not ideal because Tx and Rx time are not the same and we are not able to measure the single-trip time, but only the round-trip time on each side of communication host.

To improve the precision, one idea is to trigger several round trips and let one side (preferrably the CV side for easier debugging) store the corresponding Rx and Tx timestamps. CV shall find the min. round trip time and use the t3-(t3-t0-(t2-t1))/2 as its Epoch, and tell the Control board its corresponding native Epoch timestamp to be t2.

Control (t1) <- (t0)CV

Control (t2) → (t3) CV

The reason why it’s more precise is that difference between the real corresponding CV board timestamp is [t3-(Tx single-trip duration)]. The deviation from the real data is

delta=(Round-trip duration)/2-(Tx single-trip duration)=[(Tx single-trip duration)-(Rx single-trip duration)]/2.

Therefore, the best we can do is to use the min. round trip duration.

Warning: timestamp sync may not be useful for now, because we only see the delay within CV native sensor feedback time.

GJSK-Novice commented 1 month ago

Not useful for now because seems like the timer on control and linux runs in different speed and the time sync gets derailed after some time.