-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fix QoS history being unknown when copied from existing publisher #233
Conversation
When the QoS profile is copied from another existing publisher, it can happen that the history policy is `Unknown`, leading to an error when subsequently trying to create a publisher with that QoS profile. As a fix, we explicitly set the history policy to the system default. Fixes #200
@@ -582,7 +582,9 @@ void FoxgloveBridge::clientAdvertise(const foxglove::ClientAdvertisement& advert | |||
}); | |||
const rclcpp::QoS qos = otherPublisherIt == otherPublishers.end() | |||
? rclcpp::SystemDefaultsQoS() | |||
: otherPublisherIt->qos_profile(); | |||
: rclcpp::QoS(otherPublisherIt->qos_profile()) | |||
// Override the history policy as it can be `unknown` |
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.
Would it be better to only override if it is unknown
and leave it otherwise?
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.
Yes, will do. Although it seems that this is ROS distro specific. On humble
this is always unknown
(might be a bug), on galactic
the history is always 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.
LGTM
I would include some shorter version of your PR description as a code comment. I found the description helpful in clarifying that it will cause a publisher error
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.
Is there any possibility to add a test for this?
rclcpp::QoS qos = otherPublisherIt == otherPublishers.end() ? rclcpp::SystemDefaultsQoS() | ||
: otherPublisherIt->qos_profile(); | ||
if (qos.history() == rclcpp::HistoryPolicy::Unknown) { | ||
qos.history(rclcpp::HistoryPolicy::SystemDefault); |
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.
Comment on why this is necessary?
Yes, added one. Fails for distros starting from humble without the history policy fix. |
Public-Facing Changes
Fix QoS history being unknown when copied from existing publisher
Description
When the QoS profile is copied from another existing publisher, it can happen that the history policy is
Unknown
, leading to an error when subsequently trying to create a publisher with that QoS profile. As a fix, we explicitly set the history policy to the system default.Fixes #200