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

[Question] How to activate and deactive subscriber in side custom nav2_behavior_tree plugin? #4075

Closed
GPrathap opened this issue Jan 26, 2024 · 1 comment

Comments

@GPrathap
Copy link

The goal is to build a custom nav2_behavior_tree action plugin that leverages external data to drive real-time decision-making. I can see we can access its node by node_ = config().blackboard->get<rclcpp::Node::SharedPtr>("node")

Is it possible to create a subscriber inside the nav2_behavior_tree action plugin? And how to activate and deactivate the subscriber that was created? Or it is not necessary to deactivate?

I can do reset subscriber_.reset() but not sure when I should do it?

@SteveMacenski
Copy link
Member

Yes! See isBatteryLow condition node for an example of that in action: https://github.com/ros-planning/navigation2/blob/main/nav2_behavior_tree/plugins/condition/is_battery_low_condition.cpp

There are no (currently) lifecycle subscriptions, so once you create it on initialize(), you're good to go for the lifecycle of that BT instance.

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

No branches or pull requests

2 participants