Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a "best_effort_if_volatile" option #3

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion ros2_foxglove_bridge/src/param_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Loading