Skip to content

Commit

Permalink
feat: add a "best_effort_if_volatile" option
Browse files Browse the repository at this point in the history
MrBlenny authored Dec 10, 2024
2 parents c005570 + 7e3aa4b commit 3111aae
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -84,7 +84,11 @@ Parameters are provided to configure the behavior of the bridge. These parameter
* (ROS 2) __num_threads__: The number of threads to use for the ROS node executor. This controls the number of subscriptions that can be processed in parallel. 0 means one thread per CPU core. Defaults to `0`.
* (ROS 2) __min_qos_depth__: Minimum depth used for the QoS profile of subscriptions. Defaults to `1`. This is to set a lower limit for a subscriber's QoS depth which is computed by summing up depths of all publishers. See also [#208](https://github.com/foxglove/ros-foxglove-bridge/issues/208).
* (ROS 2) __max_qos_depth__: Maximum depth used for the QoS profile of subscriptions. Defaults to `25`.
* (ROS 2) __qos_reliability__: The default QoS reliability setting for subscriptions the bridge creates. Can be 'reliable', 'best_effort', or 'automatic'. Defaults to `automatic`.
* (ROS 2) __qos_reliability__: The default QoS reliability setting for subscriptions the bridge creates. Defaults to `automatic`.
* `reliable`: ALWAYS subscribe with a "reliable" QoS profile.
* `best_effort`: ALWAYS subscribe with a "best effort" QoS profile.
* `best_effort_if_volatile`: subscribe as "best effort" if all the participants are "volatile". If any are "transient_local", subscribe as "reliable".
* `automatic`: Subscribes as "reliable" if all publishers are reliable. Otherwise, if mixed reliability, subscribes as "best effort" to maxmize compatibility.
* (ROS 2) __include_hidden__: Include hidden topics and services. Defaults to `false`.
* (ROS 2) __disable_load_message__: Do not publish as loaned message when publishing a client message. Defaults to `true`.

2 changes: 1 addition & 1 deletion ros2_foxglove_bridge/src/param_utils.cpp
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ void declareParameters(rclcpp::Node* node) {
qosReliabilityDescription.type = rcl_interfaces::msg::ParameterType::PARAMETER_STRING;
qosReliabilityDescription.description =
"The default QoS reliability setting for subscriptions the bridge "
"creates. Can be 'reliable', 'best_effort', or 'automatic'.";
"creates. Can be 'reliable', 'best_effort', 'best_effort_if_volatile', or 'automatic'.";
qosReliabilityDescription.read_only = true;
node->declare_parameter(PARAM_QOS_RELIABILITY, DEFAULT_QOS_RELIABILITY,
qosReliabilityDescription);
6 changes: 6 additions & 0 deletions ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp
Original file line number Diff line number Diff line change
@@ -501,6 +501,12 @@ void FoxgloveBridge::subscribe(foxglove::ChannelId channelId, ConnectionHandle c
qos.reliable();
} else if (_qosReliability == "best_effort") {
qos.best_effort();
} else if (_qosReliability == "best_effort_if_volatile") {
if (durabilityTransientLocalEndpointsCount > 0) {
qos.reliable();
} else {
qos.best_effort();
}
} else {
// If all endpoints are reliable, ask for reliable
if (!publisherInfo.empty() && reliabilityReliableEndpointsCount == publisherInfo.size()) {

0 comments on commit 3111aae

Please sign in to comment.