mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 07:53:34 +08:00
[uxrce_dds_client] wait for Timesync to converge
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
This commit is contained in:
committed by
Daniel Agar
parent
f01400de81
commit
2363c03bfe
@@ -441,7 +441,7 @@ void UxrceddsClient::run()
|
||||
|
||||
// Spin until sync with the Agent
|
||||
while (_synchronize_timestamps) {
|
||||
if (uxr_sync_session(&session, 1000)) {
|
||||
if (uxr_sync_session(&session, 1000) && _timesync.sync_converged()) {
|
||||
PX4_INFO("synchronized with time offset %-5" PRId64 "us", session.time_offset / 1000);
|
||||
|
||||
if (_param_uxrce_dds_syncc.get() > 0) {
|
||||
@@ -505,7 +505,7 @@ void UxrceddsClient::run()
|
||||
|
||||
// time sync session
|
||||
if (_synchronize_timestamps && hrt_elapsed_time(&last_sync_session) > 1_s) {
|
||||
if (uxr_sync_session(&session, 100)) {
|
||||
if (uxr_sync_session(&session, 100) && _timesync.sync_converged()) {
|
||||
//PX4_INFO("synchronized with time offset %-5" PRId64 "ns", session.time_offset);
|
||||
last_sync_session = hrt_absolute_time();
|
||||
|
||||
@@ -563,6 +563,7 @@ void UxrceddsClient::run()
|
||||
_last_payload_tx_rate = 0;
|
||||
_last_payload_tx_rate = 0;
|
||||
_subs->reset();
|
||||
_timesync.reset_filter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user