3.1. QoS in ROS 2 and Connext
Like DDS, ROS 2 offers Quality of Service (QoS) settings to fine-tune your system according to specific use cases.
While ROS 2 QoS can be mapped to Connext QoS, the opposite is not true. Connext provides a wide array of fine-grained QoS that allows users to extract the last drop of performance from their systems. See Configuring Connext Using QoS in the RTI Connext Core Libraries User’s Manual for more information on Connext QoS.
While you cannot directly provide Connext-specific QoS settings through the
RMW API, you can still set them through an XML file either by using the
environment variable NDDS_QOS_PROFILES or by placing the XML file in the
same directory from which the ROS 2 application is being run. This way you can
use more specific QoS than the ones provided by ROS 2.
Note
Connext cannot access the RMW to choose a specific QoS profile, so the
default profile is used. If you do not mark the desired QoS profile as
is_default_qos="true" in your Connext QoS file, you will not get the
desired behavior.
If you use both ROS 2 QoS and Connext QoS, the following environment variables allow you to choose which QoS settings take precedence when initializing the system—one environment variable for DomainParticipants and one for endpoints (DataWriters and DataReaders):
RMW_CONNEXT_PARTICIPANT_QOS_OVERRIDE_POLICYRMW_CONNEXT_ENDPOINT_QOS_OVERRIDE_POLICY
The following sections describe what these variables override and which QoS settings are affected for each entity.
3.1.1. DomainParticipantFactory
The Connext RMW implementation modifies the QoS for the
DomainParticipantFactory when initializing the RMW through rmw_init.
The affected QoS are the following:
entity_factoryautoenable_created_entities=DDS_BOOLEAN_FALSEThis QoS is set to false, and you cannot change it, because you cannot “enable” entities in ROS 2. (The Connext RMW uses this QoS to handle the creation of entities under the hood. Modifying it in the source code can unexpectedly alter the behavior of the Connext RMW.)
3.1.2. DomainParticipant
You can change the DomainParticipant QoS override policy through the environment variable RMW_CONNEXT_PARTICIPANT_QOS_OVERRIDE_POLICY. The possible values are:
Never: The Connext RMW will use the default QoS from Connext or QoS settings coming from the QoS profile XML file.
Basic: The Connext RMW will only override Connext QoS settings that have an equivalent in ROS 2. For example, Reliability is a QoS available in ROS 2. In Basic mode, the Reliability coming from ROS 2 (such as Best Effort) is preferred over the default QoS coming from Connext (such as Reliable).
All (default): The Connext RMW will override the same Connext QoS as Basic, plus additional QoS (listed below under All) that the RMW tweaks to improve performance.
The Connext RMW implementation modifies the QoS for the
DomainParticipant when creating an RMW node through rmw_create_node.
(In ROS 2, a DomainParticipant is equivalent to a node.) The
DomainParticipant QoS that may be affected when creating a node are
the following:
Basic. The RMW will use the ROS 2 settings instead of the Connext settings for the following QoS. For example, the ROS 2 setting for the
user_datavalueisenclave=%s, so that is the value used in Basic mode rather than the Connext value.user_datavalue=enclave=%s(name used to find security artifacts in a sros2 keystore)
propertydds.transport.UDPv4.builtin.parent.allow_multicast_interfaces_listdds.transport.UDPv4.builtin.parent.allow_interfaces_listdds.domain_participant.domain_tag
discoveryaccept_unknown_peersmulticast_receive_addressesinitial_peers
All. The RMW will use the ROS 2 settings instead of the Connext settings for the above QoS, plus these:
wire_protocol(enabled byRMW_CONNEXT_RTPS_AUTO_ID_FROM_UUID)rtps_auto_id_kind = DDS_RTPS_AUTO_ID_FROM_UUID
resource_limitscontentfilter_property_max_length=RMW_CONNEXT_CONTENTFILTER_PROPERTY_MAX_LENGTHtype_code_max_serialized_length=RMW_CONNEXT_TYPE_CODE_MAX_SERIALIZED_SIZEtype_object_max_serialized_length=RMW_CONNEXT_TYPE_OBJECT_MAX_SERIALIZED_SIZE
databaseshutdown_cleanup_periodsec=RMW_CONNEXT_SHUTDOWN_CLEANUP_PERIOD_SECnanosec=RMW_CONNEXT_SHUTDOWN_CLEANUP_PERIOD_NSEC
discovery_config(see RMW_CONNEXT_DISABLE_FAST_ENDPOINT_DISCOVERY)publication_writerfast_heartbeat_period={0, 100000000}late_joiner_heartbeat_period={0, 100000000}max_heartbeat_retries=300
subscription_writerfast_heartbeat_period={0, 100000000}late_joiner_heartbeat_period={0, 100000000}max_heartbeat_retries=300
Security. The RMW will always use the ROS 2 settings instead of the Connext settings for these, if ROS 2 security is enabled:
propertycom.rti.serv.load_plugin=com.rti.serv.securecom.rti.serv.secure.library=nddssecuritycom.rti.serv.secure.create_function=RTI_Security_PluginSuite_createcom.rti.serv.secure.authentication.ca_filecom.rti.serv.secure.access_control.permissions_authority_filecom.rti.serv.secure.authentication.private_key_filecom.rti.serv.secure.authentication.certificate_filecom.rti.serv.secure.access_control.governance_filecom.rti.serv.secure.access_control.permissions_filecom.rti.serv.secure.logging.log_file(affected by theROS_SECURITY_LOG_FILEenvironment variable)com.rti.serv.secure.logging.distribute.enable(affected by theROS_SECURITY_LOG_PUBLISHenvironment variable)com.rti.serv.secure.logging.log_level(affected by theROS_SECURITY_LOG_VERBOSITYenvironment variable)
3.1.3. Endpoint
You can change the endpoint (DataWriter and DataReader) QoS override policy through the environment variable RMW_CONNEXT_ENDPOINT_QOS_OVERRIDE_POLICY. The possible values are:
Never: The Connext RMW will use the default QoS from Connext or QoS settings coming from the QoS profile XML file.
DDSTopics: The Connext RMW will only override Connext QoS settings that have an equivalent in ROS 2, for Topics matching a regular expression. For example, History is a QoS available in ROS 2. In DDSTopics mode, the History kind coming from ROS (such as Keep All) is preferred over the default QoS coming from Connext (such as Keep Last).
Always (default): The Connext RMW will override Connext QoS that have an equivalent in ROS 2, for all Topics.
The Connext RMW implementation modifies the common QoS for the
endpoints when creating an RMW endpoint through
rmw_create_[publisher|subscription]. The endpoint QoS settings that may be
affected by the environment variable are listed below. If you choose
DDSTopics or Always, the Connext RMW will use the ROS 2 settings
instead of the Connext settings for the following:
historydepthkind
reliabilitymax_blocking_time = DDS_DURATION_INFINITEkind
durabilitykind
deadlineperiod
livelinesslease_durationkind
lifespan(writer-only QoS)duration
user_datavalue
The following sections describe the QoS that affect specifically DataWriters or DataReaders. You can use the environment variables below to disallow overriding the corresponding QoS, disabling specific optimizations.
3.1.3.1. DataWriter
The Connext RMW implementation modifies the Connext QoS for the DataWriter
when creating an RMW publisher through rmw_create_publisher. The
affected DataWriter QoSs (that is, the QoS that are modified by the
RMW if the corresponding environment variable allows) are listed below.
For example, if you set the variable RMW_CONNEXT_USE_DEFAULT_PUBLISH_MODE,
the Connext DataWriter QoS publish_mode.kind is changed/overwritten by the
ROS 2 setting.
publish_mode(see RMW_CONNEXT_USE_DEFAULT_PUBLISH_MODE)kind
protocol(see RMW_CONNEXT_DISABLE_RELIABILITY_OPTIMIZATIONS and RMW_CONNEXT_DISABLE_LARGE_DATA_OPTIMIZATIONS)rtps_reliable_writermin_send_window_sizemax_send_window_sizeheartbeats_per_max_samplesheartbeat_periodlate_joiner_heartbeat_periodfast_heartbeat_periodmax_heartbeat_retriesmax_nack_response_delayhigh_watermarklow_watermark
property(no variable—always modified)dds.data_writer.history.memory_manager.fast_pool.pool_buffer_max_size = 0
3.1.3.2. DataReader
The Connext RMW implementation modifies the Connext QoS for the DataReader
when creating an RMW subscription through rmw_create_subscription.
The affected DataReader QoS (that is, the QoS that are modified by
the RMW if the corresponding environment variable allows) are listed below.
For example, if you set the variable DISABLE_RELIABILITY_OPTIMIZATIONS,
the Connext DataReader protocol QoS settings listed below are changed/overwritten
by the ROS 2 settings.
protocol(see RMW_CONNEXT_DISABLE_RELIABILITY_OPTIMIZATIONS and RMW_CONNEXT_DISABLE_LARGE_DATA_OPTIMIZATIONS)rtps_reliable_readermin_heartbeat_response_delaymax_heartbeat_response_delay
reader_resource_limits(see RMW_CONNEXT_DISABLE_LARGE_DATA_OPTIMIZATIONS)dynamically_allocate_fragmented_samples
property(no variable—always modified)dds.data_reader.history.memory_manager.fast_pool.pool_buffer_max_size = 0