mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-06 19:00:35 +08:00
uxrce_dds_client: immediately create data writers on startup
There is some race condition where in rare cases the topic publication right after creating the writer did not get received on the ROS side. This happens even with reliable QoS & reliable transport.
This commit is contained in:
@@ -366,6 +366,11 @@ bool UxrceddsClient::setupSession(uxrSession *session)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_subs->init(session, _reliable_out, reliable_in, best_effort_in, _participant_id, _client_namespace)) {
|
||||
PX4_ERR("subs init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
// create VehicleCommand replier
|
||||
if (_num_of_repliers < MAX_NUM_REPLIERS) {
|
||||
if (add_replier(new VehicleCommandSrv(session, _reliable_out, reliable_in, _participant_id, _client_namespace,
|
||||
@@ -388,11 +393,6 @@ void UxrceddsClient::deleteSession(uxrSession *session)
|
||||
_session_created = false;
|
||||
}
|
||||
|
||||
if (_subs_initialized) {
|
||||
_subs->reset();
|
||||
_subs_initialized = false;
|
||||
}
|
||||
|
||||
_last_payload_tx_rate = 0;
|
||||
_timesync.reset_filter();
|
||||
}
|
||||
@@ -650,9 +650,6 @@ void UxrceddsClient::run()
|
||||
int poll_error_counter = 0;
|
||||
resetConnectivityCounters();
|
||||
|
||||
_subs->init();
|
||||
_subs_initialized = true;
|
||||
|
||||
while (!should_exit() && _connected) {
|
||||
perf_begin(_loop_perf);
|
||||
perf_count(_loop_interval_perf);
|
||||
|
||||
Reference in New Issue
Block a user