17 #ifndef NAV2_BEHAVIOR_TREE__PLUGINS__DECORATOR__GOAL_UPDATER_NODE_HPP_
18 #define NAV2_BEHAVIOR_TREE__PLUGINS__DECORATOR__GOAL_UPDATER_NODE_HPP_
24 #include "behaviortree_cpp/decorator_node.h"
25 #include "behaviortree_cpp/json_export.h"
26 #include "geometry_msgs/msg/pose_stamped.hpp"
27 #include "nav_msgs/msg/goals.hpp"
28 #include "nav2_behavior_tree/bt_utils.hpp"
29 #include "nav2_behavior_tree/json_utils.hpp"
30 #include "rclcpp/rclcpp.hpp"
33 namespace nav2_behavior_tree
57 const std::string & xml_tag_name,
58 const BT::NodeConfiguration & conf);
67 BT::RegisterJsonDefinition<geometry_msgs::msg::PoseStamped>();
68 BT::RegisterJsonDefinition<nav_msgs::msg::Goals>();
71 BT::InputPort<geometry_msgs::msg::PoseStamped>(
"input_goal",
"Original Goal"),
72 BT::InputPort<nav_msgs::msg::Goals>(
"input_goals",
"Original Goals"),
73 BT::OutputPort<geometry_msgs::msg::PoseStamped>(
75 "Received Goal by subscription"),
76 BT::OutputPort<nav_msgs::msg::Goals>(
78 "Received Goals by subscription")
90 void createROSInterfaces();
95 BT::NodeStatus tick()
override;
101 void callback_updated_goal(
const geometry_msgs::msg::PoseStamped::ConstSharedPtr & msg);
107 void callback_updated_goals(
const nav_msgs::msg::Goals::ConstSharedPtr & msg);
109 nav2::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr goal_sub_;
110 nav2::Subscription<nav_msgs::msg::Goals>::SharedPtr goals_sub_;
112 geometry_msgs::msg::PoseStamped last_goal_received_;
113 bool last_goal_received_set_{
false};
114 nav_msgs::msg::Goals last_goals_received_;
115 bool last_goals_received_set_{
false};
117 nav2::LifecycleNode::SharedPtr node_;
118 rclcpp::CallbackGroup::SharedPtr callback_group_;
119 rclcpp::executors::SingleThreadedExecutor callback_group_executor_;
120 std::string goal_updater_topic_;
121 std::string goals_updater_topic_;
122 std::chrono::milliseconds bt_loop_duration_;
A BT::DecoratorNode that subscribes to a goal topic and updates the current goal on the blackboard.
GoalUpdater(const std::string &xml_tag_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::GoalUpdater.
static BT::PortsList providedPorts()
Creates list of BT ports.