Skip to content

Commit

Permalink
add heartbeat-period and default to half reply timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Oct 15, 2024
1 parent 473609c commit 3eb293b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion third-party/realdds/src/dds-device-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ dds_device::impl::impl( std::shared_ptr< dds_participant > const & participant,
, _subscriber( std::make_shared< dds_subscriber >( participant ) )
, _device_settings( device_settings( participant ) )
, _reply_timeout_ms(
_device_settings.nested( "control", "reply-timeout-ms" ).default_value< size_t >( 2000 ) )
_device_settings.nested( "control", "reply-timeout-ms" ).default_value< size_t >( 2500 ) )
{
create_control_writer();
create_notifications_reader();
Expand Down Expand Up @@ -564,6 +564,9 @@ void dds_device::impl::create_control_writer()
_control_writer = std::make_shared< dds_topic_writer >( topic );
dds_topic_writer::qos wqos( eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS );
wqos.history().depth = 10; // default is 1
// If our reply timeout is less than the heartbeat period, we could lose the control message!
// So we set a short heartbeat time at half the reply timeout...
wqos.reliable_writer_qos().times.heartbeatPeriod = _reply_timeout_ms / 2000.;
_control_writer->override_qos_from_json( wqos, _device_settings.nested( "control" ) );
_control_writer->run( wqos );
}
Expand Down
2 changes: 2 additions & 0 deletions third-party/realdds/src/dds-topic-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void dds_topic_writer::override_qos_from_json( qos & wqos, rsutils::json const &
// Default values should be set before we're called:
// All we do here is override those - if specified!
override_reliability_qos_from_json( wqos.reliability(), qos_settings.nested( "reliability" ) );
if( wqos.reliability().kind == eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS )
qos_settings.nested( "heartbeat-period" ).get_ex( wqos.reliable_writer_qos().times.heartbeatPeriod );
override_durability_qos_from_json( wqos.durability(), qos_settings.nested( "durability" ) );
override_history_qos_from_json( wqos.history(), qos_settings.nested( "history" ) );
override_liveliness_qos_from_json( wqos.liveliness(), qos_settings.nested( "liveliness" ) );
Expand Down

0 comments on commit 3eb293b

Please sign in to comment.