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
51 const std::string & xml_tag_name,
52 const BT::NodeConfiguration & conf);
61 BT::RegisterJsonDefinition<geometry_msgs::msg::PoseStamped>();
62 BT::RegisterJsonDefinition<nav_msgs::msg::Goals>();
65 BT::InputPort<geometry_msgs::msg::PoseStamped>(
"input_goal",
"Original Goal"),
66 BT::InputPort<nav_msgs::msg::Goals>(
"input_goals",
"Original Goals"),
67 BT::OutputPort<geometry_msgs::msg::PoseStamped>(
"output_goal",
68 "Received Goal by subscription"),
69 BT::OutputPort<nav_msgs::msg::Goals>(
"output_goals",
70 "Received Goals by subscription")
82 void createROSInterfaces();
87 BT::NodeStatus tick()
override;
93 void callback_updated_goal(
const geometry_msgs::msg::PoseStamped::SharedPtr msg);
99 void callback_updated_goals(
const nav_msgs::msg::Goals::SharedPtr msg);
101 nav2::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr goal_sub_;
102 nav2::Subscription<nav_msgs::msg::Goals>::SharedPtr goals_sub_;
104 geometry_msgs::msg::PoseStamped last_goal_received_;
105 bool last_goal_received_set_{
false};
106 nav_msgs::msg::Goals last_goals_received_;
107 bool last_goals_received_set_{
false};
109 nav2::LifecycleNode::SharedPtr node_;
110 rclcpp::CallbackGroup::SharedPtr callback_group_;
111 rclcpp::executors::SingleThreadedExecutor callback_group_executor_;
112 std::string goal_updater_topic_;
113 std::string goals_updater_topic_;
114 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.