Skip to content

Commit

Permalink
AP_DDS: Add infinite initialization wait
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 authored and tridge committed Jan 28, 2025
1 parent 83bf684 commit 47a17f9
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions libraries/AP_DDS/AP_DDS_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ const AP_Param::GroupInfo AP_DDS_Client::var_info[] {

// @Param: _MAX_RETRY
// @DisplayName: DDS ping max attempts
// @Description: The maximum number of times the DDS client will attempt to ping the XRCE agent before exiting.
// @Range: 1 100
// @Description: The maximum number of times the DDS client will attempt to ping the XRCE agent before exiting. Set to 0 to allow unlimited retries.
// @Range: 0 100
// @RebootRequired: True
// @Increment: 1
// @User: Standard
Expand Down Expand Up @@ -1180,6 +1180,7 @@ void AP_DDS_Client::on_request(uxrSession* uxr_session, uxrObjectId object_id, u
*/
void AP_DDS_Client::main_loop(void)
{
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "%s initializing...", msg_prefix);
if (!init_transport()) {
return;
}
Expand All @@ -1192,9 +1193,16 @@ void AP_DDS_Client::main_loop(void)
}

// check ping
if (!uxr_ping_agent_attempts(comm, ping_timeout_ms, ping_max_retry)) {
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "%s No ping response, exiting", msg_prefix);
return;
if (ping_max_retry == 0) {
if (!uxr_ping_agent(comm, ping_timeout_ms)) {
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%s No ping response, retrying", msg_prefix);
continue;
}
} else {
if (!uxr_ping_agent_attempts(comm, ping_timeout_ms, ping_max_retry)) {
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%s No ping response, exiting", msg_prefix);
continue;
}
}

// create session
Expand Down

0 comments on commit 47a17f9

Please sign in to comment.