-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[uxrce_dds_client] Set PX4 clock from UTC #22290
Conversation
8b05309
to
5911516
Compare
7198e27
to
a16c83a
Compare
This is likely what we want most of the time, but annoyingly not all the time. At a minimum can you add some tolerance (so that we don't fight with GPS or Mavlink time setting) and probably best to add a parameter so that this can be disabled if necessary. PX4-Autopilot/src/drivers/gps/gps.cpp Lines 436 to 441 in d6dbf38
Note for GPS right now that UTC time is coming from the navigation solution that's already ~100 milliseconds old. I have notes/plans on how to do it all perfectly with the TIMEPULSE, extending to CAN nodes, etc, but so far it hasn't been a priority. |
@dagar This logic occurs before the main loop and will only get executed once when the dds_client starts. Should I add it to the main loop such that it works the same way as GPS/Mavlink? |
Is there a reason you chose not to use MicroXRCE DDS's built in time sync callback support in I am happy to open up a discussion with eProsima to see if it's intended for this use case. |
Likely yes, but we could come back to that later if/when we're ready to tackle the larger story with GPS (TIMEPULSE, etc). For now at least add the parameter so this can be disabled if it's not ideal for a particular setup? |
Co-authored-by: Daniel Agar <[email protected]>
81b63b0
to
ff094ca
Compare
…n. Refactored and cleaned up. Only set system time if it's off by more than 5 seconds (same as mavlink and gps).
ff094ca
to
630dc99
Compare
Rebased and retested functional except for this issue which I think was introduced in the latest commits |
@dagar asked about if this waits for the This PR stems from me trying to analyze logs from a system without GPS and all of the log files have the same garbage date which is the start of the epoch |
All you'd need to do is make this public, then call PX4-Autopilot/src/lib/timesync/Timesync.hpp Lines 116 to 120 in 630dc99
|
…IME (PX4#22290) * Added parameter UXRCE_DDS_SYNCC to enable system clock synchronization. Refactored and cleaned up. Only set system time if it's off by more than 5 seconds (same as mavlink and gps).
In systems with a companion computer without a GPS, it would be nice to use the timestamps from the DDS bridge to set the PX4 system time.