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

Add 'best available' QoS policies #320

Merged
merged 9 commits into from
May 3, 2022
Merged

Conversation

jacobperron
Copy link
Member

@jacobperron jacobperron commented Apr 15, 2022

Resolves #304
Alternative to #319

The best available policy should select the highest level of service for the QoS setting while matching with the majority of endpoints.
For example, in the case of a DDS middleware subscription, this means:

  • Prefer reliable reliability if all existing publishers on the same topic are reliable, otherwise use best effort.
  • Prefer transient local durability if all existing publishers on the same topic are transient local, otherwise use volatile.
  • Prefer manual by topic liveliness if all existing publishers on the same topic are manual by topic, otherwise use automatic.
  • Use a deadline that is equal to the largest deadline of existing publishers on the same topic.
  • Use a liveliness lease duration that is equal to the largest lease duration of existing publishers on the same topic.

Connected PRs:

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

I've created branches named jacob/qos_best_available from PRs which are not using that name so CI will pick up the relevant changes.

The best available policy should select the highest level of service for the QoS setting while matching with the majority of endpoints.
For example, in the case of a DDS middleware subscription, this means:

- Prefer reliable reliability if all existing publishers on the same topic are reliable, otherwise use best effort.
- Prefer transient local durability if all existing publishers on the same topic are transient local, otherwise use volatile.
- Prefer manual by topic liveliness if all existing publishers on the same topic are manual by topic, otherwise use automatic.
- Use a deadline that is equal to the largest deadline of existing publishers on the same topic.
- Use a liveliness lease duration that is equal to the largest lease duration of existing publishers on the same topic.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron
Copy link
Member Author

jacobperron commented Apr 15, 2022

The implementation for DDS middlewares is in ros2/rmw_dds_common#60
I've integrated the feature into rmw_fastrtps in ros2/rmw_fastrtps#598

I still need to:

  • integrate feature into rmw_cyclonedds and rmw_connextdds
  • add some integration tests (e.g. in system_tests).
  • find and update places above rcl that might care about the new enum values.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

One comment about the naming, "best" seems natural, but technically there's no reason to consider some of these better than the alternative.

For example, we could say RMW_QOS_POLICY_RELIABILITY_RELIABLE_IF_POSSIBLE instead of RMW_QOS_POLICY_RELIABILITY_BEST_AVAILABLE and it would be more accurate I think. I'm not sold on that name really, but "best" is definitely ambiguous to me, especially for things like duration and lifespace, etc. Not a blocker, just wanted to bring it up.

rmw/include/rmw/types.h Outdated Show resolved Hide resolved
rmw/include/rmw/types.h Outdated Show resolved Hide resolved
rmw/include/rmw/types.h Outdated Show resolved Hide resolved
rmw/include/rmw/types.h Outdated Show resolved Hide resolved
Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed interface sounds pretty reasonable.

We should really document that this options should be used with care.
Abusing it can create issues of qos profiles changing randomly when launching a bunch of nodes together (because of discovery timing).

rmw/include/rmw/types.h Outdated Show resolved Hide resolved
@jacobperron
Copy link
Member Author

"best" seems natural, but technically there's no reason to consider some of these better than the alternative.

True. It could be misleading to users who may think this is the "best" option. While a name like RMW_QOS_POLICY_RELIABILITY_RELIABLE_IF_POSSIBLE makes sense for reliability, durability, and liveliness, what would we call the new deadline and lease duration sentinel values? Maybe something like RMW_QOS_DEADLINE_MATCH_ENDPOINTS?

@jacobperron
Copy link
Member Author

I think there is something nice about using the same term for all policy types, e.g. how should we name the functions introduced in ros2/rmw_dds_common#60?

@jacobperron
Copy link
Member Author

Maybe instead of "best available" we call it "highest available" (as in highest level of service, while matching the most endpoints)?

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron
Copy link
Member Author

We should really document that this options should be used with care.

PTAL at the latest changes to the documentation.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jacobperron added a commit to ros2/rclpy that referenced this pull request Apr 19, 2022
If users set certain a QoS policy to 'best available', then the middleware will query the graph
for endpoint info before creating a subscription or publisher.
A QoS policy will be selected such that is matches the majority of endpoints while maintaining
the highest level of service possible.

Connects to ros2/rmw#320

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jacobperron added a commit to ros2/rclcpp that referenced this pull request Apr 19, 2022
If users set a policy as 'best available', then the middleware will pick a policy
that is most compatible with the current set of discovered endpoints while maintaining
the highest level of service possible.

For details about the expected behavior, see connected changes:

- ros2/rmw#320
- ros2/rmw_dds_common#60

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jacobperron added a commit to ros2/system_tests that referenced this pull request Apr 20, 2022
Testing feature added in ros2/rmw#320 for all supported rmw implementations.

Test creating a subscription and publisher with 'best available' policies and confirm the actual
QoS policies are what we expect (adapting to an existing endpoint).

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only open discussion is #320 (comment), otherwise it looks good to me

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, but generally lgtm, nothing blocking.

rmw/include/rmw/types.h Outdated Show resolved Hide resolved
rmw/include/rmw/types.h Outdated Show resolved Hide resolved
rmw/include/rmw/types.h Outdated Show resolved Hide resolved
* Avoid changing existing enum values
* Clarify that actual reported QoS may be best effort or other values

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
In case users are relying on integer values.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

After thinking about it, I can't come up with a better name than "best available", we'll just want to document it well.

If the other discussions are resolved, then this is g2g for me.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron
Copy link
Member Author

I added a note about services: 492c48f

@jacobperron
Copy link
Member Author

CI is passing for all connected PRs 🎉 #320 (comment)
I think the only thing left to resolve is the comment on this ticket: ros2/rmw_connextdds#84 (comment)

@j-rivero
Copy link

Run an smoke CI on ci_linux with --packages-up-to test_communication test_quality_of_service to check how things are in all the open PRs after latest changes on ros2/rmw_connextdds#85. I've used this ros2.repos file.
CI is passing there 🎉 @jacobperron a final look to that rmw_connextdds PR and we should be in a good moment to run the full CI again I think.

@jacobperron jacobperron merged commit ac633c0 into master May 3, 2022
@delete-merged-branch delete-merged-branch bot deleted the jacob/qos_best_available branch May 3, 2022 17:34
jacobperron added a commit to ros2/rclcpp that referenced this pull request May 3, 2022
If users set a policy as 'best available', then the middleware will pick a policy
that is most compatible with the current set of discovered endpoints while maintaining
the highest level of service possible.

For details about the expected behavior, see connected changes:

- ros2/rmw#320
- ros2/rmw_dds_common#60

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jacobperron added a commit to ros2/rclpy that referenced this pull request May 3, 2022
* Expose 'best available' QoS policies

If users set certain a QoS policy to 'best available', then the middleware will query the graph
for endpoint info before creating a subscription or publisher.
A QoS policy will be selected such that is matches the majority of endpoints while maintaining
the highest level of service possible.

Connects to ros2/rmw#320

* Add BEST_AVAILABLE to QoSPresetProfiles enum

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jacobperron added a commit to ros2/system_tests that referenced this pull request May 3, 2022
* Add tests for 'best available' QoS policies

Testing feature added in ros2/rmw#320 for all supported rmw implementations.

Test creating a subscription and publisher with 'best available' policies and confirm the actual
QoS policies are what we expect (adapting to an existing endpoint).

* Add tests for services and clients

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jefferyyjhsu pushed a commit to irobot-ros/rmw that referenced this pull request Sep 2, 2022
The best available policy should select the highest level of service for the QoS setting while matching with the majority of endpoints.
For example, in the case of a DDS middleware subscription, this means:

- Prefer reliable reliability if all existing publishers on the same topic are reliable, otherwise use best effort.
- Prefer transient local durability if all existing publishers on the same topic are transient local, otherwise use volatile.
- Prefer manual by topic liveliness if all existing publishers on the same topic are manual by topic, otherwise use automatic.
- Use a deadline that is equal to the largest deadline of existing publishers on the same topic.
- Use a liveliness lease duration that is equal to the largest lease duration of existing publishers on the same topic.

* Add note about durability behavior with transient local publishers

* Add note about getting actual QoS policy

* Make best available enum value last to minimize disruption
In case users are relying on integer values.

* Document behavior for services

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get most compatibility QoS policies given QoS for multiple endpoints
4 participants