forked from Archive/PX4-Autopilot
uxrce_dds_client: run session until we do not get data anymore
Otherwise there can be significant delay for received data
This commit is contained in:
parent
36fbd18bdc
commit
d12a7dd11d
|
@ -456,7 +456,17 @@ void UxrceddsClient::run()
|
|||
// check if there are available replies
|
||||
process_replies();
|
||||
|
||||
uxr_run_session_timeout(&session, 0);
|
||||
// Run the session until we receive no more data or up to a maximum number of iterations.
|
||||
// The maximum observed number of iterations was 6 (SITL). If we were to run only once, data starts to get
|
||||
// delayed, causing registered flight modes to time out.
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
const uint32_t prev_num_payload_received = _pubs->num_payload_received;
|
||||
uxr_run_session_timeout(&session, 0);
|
||||
|
||||
if (_pubs->num_payload_received == prev_num_payload_received) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// time sync session
|
||||
if (_synchronize_timestamps && hrt_elapsed_time(&last_sync_session) > 1_s) {
|
||||
|
|
Loading…
Reference in New Issue