-
Notifications
You must be signed in to change notification settings - Fork 68
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 declaration for function to check QoS profile compatibility #299
Conversation
Currently, users who are creating a publisher or subscription can receive 'QoS incompatibility' events from the RMW if an incompatible endpoint is discovered. While this is useful, we currently don't have a nice way for application to generally check if two QoS profiles are compatible. For example, it would be nice if tooling could query the communication graph and report any detected QoS incompatibilities. In order to reduce code duplication, I think an API for checking QoS compatibilty should live in a common place. I've opted for `rmw` (over a place like `rcl`) since it's possible QoS compatiblity rules may vary per RMW vendor. Since rules for all DDS implementations should be the same, we could put that common logic in `rmw_dds_common`. Signed-off-by: Jacob Perron <[email protected]>
Connected to ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]>
Use enum for output; if one or more policies is set to 'system default', then it's better to warn the caller that we aren't sure if QoS profiles are compatible. Add optional 'reason', and 'reason_size', parameters for outputing a description of what is (or might be) the incompatiblity. Update API docs. Signed-off-by: Jacob Perron <[email protected]>
I've refactored the proposed API. Two major changes:
@mjeronimo @gbiggs PTAL |
Oh, and I also renamed the function on a whim. |
Signed-off-by: Jacob Perron <[email protected]>
Signed-off-by: Jacob Perron <[email protected]>
I agree with the name change given the change in the return type. Looks good to me, although I would've preferred a definitive yes/no answer, which would, of course, require a way to query the underlying implementation for its QoS system defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some documentation improvements are needed.
👍 like this even more than what we talked about. |
Given QoS profiles for a publisher and a subscription, this function will return `true` if the profiles are compatible. Compatible profiles implies that the subscription and publisher will be able to communicate. Connected to ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]>
Signed-off-by: Jacob Perron <[email protected]>
I've opened a PR with the implementation for DDS RMWs here: ros2/rmw_dds_common#45 |
Signed-off-by: Jacob Perron <[email protected]>
This behaves more like other RMW functions. Signed-off-by: Jacob Perron <[email protected]>
Implements ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]>
Implements ros2/rmw#299 Depends on ros2/rmw_dds_common#45 Signed-off-by: Jacob Perron <[email protected]>
Implements ros2/rmw#299 Depends on ros2/rmw_dds_common#45 Signed-off-by: Jacob Perron <[email protected]>
Connected to ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]>
Thanks for the feedback! I've updated this PR and opened a bunch of connected PRs that implement this for our supported RMWs (see the updated description for a list). The common implementation lives in |
Depends on ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]>
Depends on ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]>
Signed-off-by: Jacob Perron <[email protected]>
* Must be pre-allocated by the caller. This parameter is optional and may be set to `NULL`. | ||
* \param[out] reason: A detailed reason for a QoS incompatibility or potential incompatibility. | ||
* Must be pre-allocated by the caller. | ||
* This parameter is optional and may be set to `NULL` if the reason information is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 'nullptr's here instead of NULLs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
is cpp only AFAIK
rmw/include/rmw/qos_profiles.h
Outdated
* If any of the profile policies has the value "system default", then it may not be | ||
* possible to determine the compatibilty. | ||
* In this case, the output parameter `compatibility` is set to `RMW_QOS_COMPATIBILITY_WARNING` | ||
* and `reason` is populated. | ||
* | ||
* Profile policies must not have the value "unknown". | ||
* An "unknown" value is considered an error and `RMW_RET_INVALID_ARGUMENT` is returned. | ||
* `compatibility` and `reason` will not be set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending discussion in another PR ros2/rmw_dds_common#45 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 93e9aa2
Unknown values now result in a compatibility warning instead of an error.
Since it's possible for rmw's to return an unknown value if the policy is set to an unsupported value by ROS 2. Signed-off-by: Jacob Perron <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks for all the feedback so far! I'm just waiting for ci.ros2.org to come back online and then I'll trigger CI and get this merged/released. |
* Add function for checking QoS profile compatibility Given QoS profiles for a publisher and a subscription, this function will return `true` if the profiles are compatible. Compatible profiles implies that the subscription and publisher will be able to communicate. Connected to ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]> * Refactor signature of _write_to_buffer Signed-off-by: Jacob Perron <[email protected]> * Set error message instead of setting reason Signed-off-by: Jacob Perron <[email protected]> * Error is null reason and non-zero reason_size Signed-off-by: Jacob Perron <[email protected]> * Do not set output parameter if an error occurs Signed-off-by: Jacob Perron <[email protected]> * Add test for reason buffer too small Signed-off-by: Jacob Perron <[email protected]> * Warn on unknown values instead of error Signed-off-by: Jacob Perron <[email protected]> * Fixes * Use vsnprintf over snprintf (or undefined things can happen) * Handle NULL return value from `*to_str()` functions * Add more tests Signed-off-by: Jacob Perron <[email protected]> * Guard against zero reason_size Add test case. Signed-off-by: Jacob Perron <[email protected]>
Implements ros2/rmw#299 Depends on ros2/rmw_dds_common#45 Signed-off-by: Jacob Perron <[email protected]>
* Add RMW function to check QoS compatibility Implements ros2/rmw#299 Depends on ros2/rmw_dds_common#45 Signed-off-by: Jacob Perron <[email protected]> * Add tests to exercise new API Signed-off-by: Jacob Perron <[email protected]>
Implements ros2/rmw#299 Depends on ros2/rmw_dds_common#45 Signed-off-by: Jacob Perron <[email protected]>
* Add function for checking QoS profile compatibility Connected to ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]> * Update tests Unknown values no longer cause errors, but possibly warnings instead. We can't test this since it is dependent on the RMW. We can test for compatibility with no default or unknown values as well as invalid input. Signed-off-by: Jacob Perron <[email protected]>
I noticed this new API from a new test failure in I also noticed that these changes have not yet made it to the Rolling Debian binaries, and I had to build the tree from source in order to validate them. What is the period with which those packages are usually regenerated? |
I think that releasing
IIUC the packages used by |
@ivanpauno is correct. If you switch to the testing repo (see instructions), then you should see these changes already released there. Syncs to main happen periodically (roughly every three weeks), though I don't think there has been one for a couple months now. @nuclearsandwich what do you think about doing a Rolling sync in the near future? |
* Add API for checking QoS profile compatibility Depends on ros2/rmw#299 Signed-off-by: Jacob Perron <[email protected]> * Refactor as free function Returns a struct containing the compatibility enum value and string for the reason. Updated tests to reflect behavior changes upstream. Signed-off-by: Jacob Perron <[email protected]>
Implements ros2/rmw#299 Depends on ros2/rmw_dds_common#45 Signed-off-by: Jacob Perron <[email protected]>
Currently, users who are creating a publisher or subscription can receive 'QoS incompatibility'
events from the RMW if an incompatible endpoint is discovered. While this is useful, we
currently don't have a nice way for application to generally check if two QoS profiles are
compatible. For example, it would be nice if tooling could query the communication graph and
report any detected QoS incompatibilities.
In order to reduce code duplication, I think an API for checking QoS compatibilty should live
in a common place. I've opted for
rmw
(over a place likercl
) since it's possible QoScompatiblity rules may vary per RMW vendor. Since rules for all DDS implementations should be
the same, we could put that common logic in
rmw_dds_common
.The motivation for this API is to add features to tooling like rqt_graph and ros2doctor to help diagnose QoS compatibility issues. E.g. it would be useful to change how incompatible links in the ROS graph are rendered in
rqt_graph
.Connected PRs:
CI for connected PRs listed above: