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 |DPs| and one for endpoints (|DWs| and |DRs|): * ``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. 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.) DomainParticipant ----------------- You can change the |DP| 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 |DP| when creating an RMW node through ``rmw_create_node``. (In ROS 2, a |DP| is equivalent to a node.) The |DP| 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) Endpoint -------- You can change the endpoint (|DW| and |DR|) 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 |DWs| or |DRs|. You can use the environment variables below to disallow overriding the corresponding QoS, disabling specific optimizations. DataWriter ^^^^^^^^^^ The |CONNEXT| RMW implementation modifies the |CONNEXT| QoS for the |DW| when creating an RMW publisher through ``rmw_create_publisher``. The affected |DW| 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| |DW| 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_writer`` * ``min_send_window_size`` * ``max_send_window_size`` * ``heartbeats_per_max_samples`` * ``heartbeat_period`` * ``late_joiner_heartbeat_period`` * ``fast_heartbeat_period`` * ``max_heartbeat_retries`` * ``max_nack_response_delay`` * ``high_watermark`` * ``low_watermark`` * ``property`` (no variable—always modified) * ``dds.data_writer.history.memory_manager.fast_pool.pool_buffer_max_size = 0`` DataReader ^^^^^^^^^^ The |CONNEXT| RMW implementation modifies the |CONNEXT| QoS for the |DR| when creating an RMW subscription through ``rmw_create_subscription``. The affected |DR| 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| |DR| ``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_reader`` * ``min_heartbeat_response_delay`` * ``max_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``