Hello Pavel, I try to understand how to implement the time synchronization in my application and I think that detailed explanation in uavcan.time.Synchronization
data type description in Specification is useful, but I little bit confused about this :
- In a pseudocode of
function update(message)
one can find this comment:
// A message is assumed to have two timestamps:
// Real - sampled from the clock that is being synchronized
// Monotonic - clock that never leaps and never changes rate
But the message of type uavcan.time.Synchronization
has only one field:
truncated uint56 previous_transmission_timestamp_microsecond
Or in this case this is a message of another type?
- In a pseudocode of
function adjust(message)
there is this line:
local_time_phase_error := previous_rx_real_timestamp - msg.previous_transmission_timestamp_microsecond;
Will the local_time_phase_error
always be less than zero? In handleReceivedTimeSyncMessage(message)
the state of the slave is changing from STATE_ADJUST to STATE_UPDATE and vice versa. The previous_rx_real_timestamp
gets the previous message timestamp which will be always one time step behind new arrived message. Is it right?
I also have read the original paper which you referenced, but there is no description of synchronization slave logic.