17 #include "nav2_behavior_tree/plugins/condition/goal_updated_condition.hpp"
19 namespace nav2_behavior_tree
22 GoalUpdatedCondition::GoalUpdatedCondition(
23 const std::string & condition_name,
24 const BT::NodeConfiguration & conf)
25 : BT::ConditionNode(condition_name, conf)
30 if (status() == BT::NodeStatus::IDLE) {
31 config().blackboard->get<std::vector<geometry_msgs::msg::PoseStamped>>(
"goals", goals_);
32 config().blackboard->get<geometry_msgs::msg::PoseStamped>(
"goal", goal_);
33 return BT::NodeStatus::FAILURE;
36 std::vector<geometry_msgs::msg::PoseStamped> current_goals;
37 config().blackboard->get<std::vector<geometry_msgs::msg::PoseStamped>>(
"goals", current_goals);
38 geometry_msgs::msg::PoseStamped current_goal;
39 config().blackboard->get<geometry_msgs::msg::PoseStamped>(
"goal", current_goal);
41 if (goal_ != current_goal || goals_ != current_goals) {
43 goals_ = current_goals;
44 return BT::NodeStatus::SUCCESS;
47 return BT::NodeStatus::FAILURE;
52 #include "behaviortree_cpp_v3/bt_factory.h"
53 BT_REGISTER_NODES(factory)
A BT::ConditionNode that returns SUCCESS when goal is updated on the blackboard and FAILURE otherwise...
BT::NodeStatus tick() override
The main override required by a BT action.