18 #include "nav2_behavior_tree/plugins/action/follow_path_action.hpp"
20 namespace nav2_behavior_tree
24 const std::string & xml_tag_name,
25 const std::string & action_name,
26 const BT::NodeConfiguration & conf)
27 :
BtActionNode<nav2_msgs::action::FollowPath>(xml_tag_name, action_name, conf)
33 getInput(
"path", goal_.path);
34 getInput(
"controller_id", goal_.controller_id);
35 getInput(
"goal_checker_id", goal_.goal_checker_id);
39 std::shared_ptr<const nav2_msgs::action::FollowPath::Feedback>)
42 nav_msgs::msg::Path new_path;
43 getInput(
"path", new_path);
46 if (goal_.path != new_path && new_path != nav_msgs::msg::Path()) {
48 goal_.path = new_path;
52 std::string new_controller_id;
53 getInput(
"controller_id", new_controller_id);
55 if (goal_.controller_id != new_controller_id) {
56 goal_.controller_id = new_controller_id;
60 std::string new_goal_checker_id;
61 getInput(
"goal_checker_id", new_goal_checker_id);
63 if (goal_.goal_checker_id != new_goal_checker_id) {
64 goal_.goal_checker_id = new_goal_checker_id;
71 #include "behaviortree_cpp_v3/bt_factory.h"
72 BT_REGISTER_NODES(factory)
74 BT::NodeBuilder builder =
75 [](
const std::string & name,
const BT::NodeConfiguration & config)
77 return std::make_unique<nav2_behavior_tree::FollowPathAction>(
78 name,
"follow_path", config);
82 "FollowPath", builder);
Abstract class representing an action based BT node.
A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::FollowPath.
void on_tick() override
Function to perform some user-defined operation on tick.
FollowPathAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::FollowPathAction.
void on_wait_for_result(std::shared_ptr< const nav2_msgs::action::FollowPath::Feedback > feedback) override
Function to perform some user-defined operation after a timeout waiting for a result that hasn't been...