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_POLICY

  • RMW_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_factory

    • autoenable_created_entities = DDS_BOOLEAN_FALSE

      This 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_data value is enclave=%s, so that is the value used in Basic mode rather than the Connext value.

    • user_data

      • value = enclave=%s (name used to find security artifacts in a sros2 keystore)

    • property

      • dds.transport.UDPv4.builtin.parent.allow_multicast_interfaces_list

      • dds.transport.UDPv4.builtin.parent.allow_interfaces_list

      • dds.domain_participant.domain_tag

    • discovery

      • accept_unknown_peers

      • multicast_receive_addresses

      • initial_peers

  • All. The RMW will use the ROS 2 settings instead of the Connext settings for the above QoS, plus these:

    • wire_protocol (enabled by RMW_CONNEXT_RTPS_AUTO_ID_FROM_UUID)

      • rtps_auto_id_kind = DDS_RTPS_AUTO_ID_FROM_UUID

    • resource_limits

      • contentfilter_property_max_length = RMW_CONNEXT_CONTENTFILTER_PROPERTY_MAX_LENGTH

      • type_code_max_serialized_length = RMW_CONNEXT_TYPE_CODE_MAX_SERIALIZED_SIZE

      • type_object_max_serialized_length = RMW_CONNEXT_TYPE_OBJECT_MAX_SERIALIZED_SIZE

    • database

      • shutdown_cleanup_period

        • sec = RMW_CONNEXT_SHUTDOWN_CLEANUP_PERIOD_SEC

        • nanosec = RMW_CONNEXT_SHUTDOWN_CLEANUP_PERIOD_NSEC

    • discovery_config (see RMW_CONNEXT_DISABLE_FAST_ENDPOINT_DISCOVERY)

      • publication_writer

        • fast_heartbeat_period = {0, 100000000}

        • late_joiner_heartbeat_period = {0, 100000000}

        • max_heartbeat_retries = 300

      • subscription_writer

        • fast_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:

    • property

      • com.rti.serv.load_plugin = com.rti.serv.secure

      • com.rti.serv.secure.library = nddssecurity

      • com.rti.serv.secure.create_function = RTI_Security_PluginSuite_create

      • com.rti.serv.secure.authentication.ca_file

      • com.rti.serv.secure.access_control.permissions_authority_file

      • com.rti.serv.secure.authentication.private_key_file

      • com.rti.serv.secure.authentication.certificate_file

      • com.rti.serv.secure.access_control.governance_file

      • com.rti.serv.secure.access_control.permissions_file

      • com.rti.serv.secure.logging.log_file (affected by the ROS_SECURITY_LOG_FILE environment variable)

      • com.rti.serv.secure.logging.distribute.enable (affected by the ROS_SECURITY_LOG_PUBLISH environment variable)

      • com.rti.serv.secure.logging.log_level (affected by the ROS_SECURITY_LOG_VERBOSITY environment 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:

  • history

    • depth

    • kind

  • reliability

    • max_blocking_time = DDS_DURATION_INFINITE

    • kind

  • durability

    • kind

  • deadline

    • period

  • liveliness

    • lease_duration

    • kind

  • lifespan (writer-only QoS)

    • duration

  • user_data

    • value

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.

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.