Function rclcpp::qos_check_compatible

Function Documentation

QoSCheckCompatibleResult rclcpp::qos_check_compatible(const QoS &publisher_qos, const QoS &subscription_qos)

Check if two QoS profiles are compatible.

Two QoS profiles are compatible if a publisher and subcription using the QoS policies can communicate with each other.

If any policies have value “system default” or “unknown” then it is possible that compatiblity cannot be determined. In this case, the value QoSCompatility::Warning is set as part of the returned structure.

Example usage:

rclcpp::QoSCheckCompatibleResult result = rclcpp::qos_check_compatible(
  publisher_qos, subscription_qos);
if (rclcpp::QoSCompatibility::Error != result.compatibility) {
  // QoS not compatible ...
  // result.reason contains info about the incompatibility
} else if (rclcpp::QoSCompatibility::Warning != result.compatibility) {
  // QoS may not be compatible ...
  // result.reason contains info about the possible incompatibility
}
Parameters:
  • publisher_qos[in] The QoS profile for a publisher.

  • subscription_qos[in] The QoS profile for a subscription.

Throws:

rclcpp::exceptions::QoSCheckCompatibilityException – if an unexpected error occurs.

Returns:

Struct with compatiblity set to QoSCompatibility::Ok if the QoS profiles are compatible, or

Returns:

Struct with compatibility set to QoSCompatibility::Warning if there is a chance the QoS profiles are not compatible, or

Returns:

Struct with compatibility set to QoSCompatibility::Error if the QoS profiles are not compatible.