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

Use rclcpp::guard_condition #8

Closed

Conversation

mauropasse
Copy link
Owner

Signed-off-by: Mauro Passerino [email protected]

@@ -67,7 +67,7 @@ class SubscriptionIntraProcess : public SubscriptionIntraProcessBase
const std::string & topic_name,
rmw_qos_profile_t qos_profile,
rclcpp::IntraProcessBufferType buffer_type)
: SubscriptionIntraProcessBase(topic_name, qos_profile),
: SubscriptionIntraProcessBase(context, topic_name, qos_profile),
Copy link
Owner Author

Choose a reason for hiding this comment

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

I have to pass the context to SubscriptionIntraProcessBase so it can init the guard condition in the member initialization list of SubscriptionIntraProcessBase constructor. Before there was no need for this because the guard condition was initalized here, but now I can't do anymore:

SubscriptionIntraProcess::SubscriptionIntraProcess
{
  // Instead of initialize the member gc_, this is creating a new local variable gc_
  rclcpp::GuardCondition gc_(context);
}

nor I can do

SubscriptionIntraProcess(rclcpp::Context::SharedPtr context)
  : SubscriptionIntraProcessBase(topic_name, qos_profile),
    any_callback_(callback), gc_(context) // gc_ doesnt belong to SubscriptionIntraProcess, so this is an error

RCLCPP_PUBLIC
rclcpp::GuardCondition *
get_guard_condition() override;

Copy link
Owner Author

Choose a reason for hiding this comment

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

I created the new get_guard_condition() because in the original PR william said:

Also, anywhere the API is changed in a way that would break existing code calling it in one of our .hpp files, we need to consider deprecating it rather than just changing it. It isn't always possible, desirable, or necessary, but we need to think about each case and justify it if we don't deprecate things.

I think he was refering to I changed the original get_notify_guard_condition to return a rclcpp::GuardCondition *, but I'm not sure

@mauropasse mauropasse force-pushed the mauro/master-use-rclcpp-guard-cond-3 branch from 1e59529 to 1bf3ee2 Compare April 7, 2021 16:25
Signed-off-by: Mauro Passerino <[email protected]>
@mauropasse mauropasse force-pushed the mauro/master-use-rclcpp-guard-cond-3 branch from 0d372e6 to 2fc5501 Compare April 8, 2021 13:10
@mauropasse mauropasse closed this Apr 9, 2021
@mauropasse mauropasse deleted the mauro/master-use-rclcpp-guard-cond-3 branch April 9, 2021 13:28
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.

1 participant