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)
33 getInput(
"path", goal_.path);
34 getInput(
"controller_id", goal_.controller_id);
35 getInput(
"goal_checker_id", goal_.goal_checker_id);
36 getInput(
"progress_checker_id", goal_.progress_checker_id);
41 setOutput(
"error_code_id", ActionResult::NONE);
42 return BT::NodeStatus::SUCCESS;
47 setOutput(
"error_code_id", result_.result->error_code);
48 return BT::NodeStatus::FAILURE;
54 setOutput(
"error_code_id", ActionResult::NONE);
55 return BT::NodeStatus::SUCCESS;
59 std::shared_ptr<const Action::Feedback>)
62 nav_msgs::msg::Path new_path;
63 getInput(
"path", new_path);
66 if (goal_.path != new_path && new_path != nav_msgs::msg::Path()) {
68 goal_.path = new_path;
72 std::string new_controller_id;
73 getInput(
"controller_id", new_controller_id);
75 if (goal_.controller_id != new_controller_id) {
76 goal_.controller_id = new_controller_id;
80 std::string new_goal_checker_id;
81 getInput(
"goal_checker_id", new_goal_checker_id);
83 if (goal_.goal_checker_id != new_goal_checker_id) {
84 goal_.goal_checker_id = new_goal_checker_id;
88 std::string new_progress_checker_id;
89 getInput(
"progress_checker_id", new_progress_checker_id);
91 if (goal_.progress_checker_id != new_progress_checker_id) {
92 goal_.progress_checker_id = new_progress_checker_id;
99 #include "behaviortree_cpp/bt_factory.h"
100 BT_REGISTER_NODES(factory)
102 BT::NodeBuilder builder =
103 [](
const std::string & name,
const BT::NodeConfiguration & config)
105 return std::make_unique<nav2_behavior_tree::FollowPathAction>(
106 name,
"follow_path", config);
110 "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.
BT::NodeStatus on_success() override
Function to perform some user-defined operation upon successful completion of the action.
FollowPathAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::FollowPathAction.
BT::NodeStatus on_aborted() override
Function to perform some user-defined operation upon abortion of the action.
void on_wait_for_result(std::shared_ptr< const Action::Feedback > feedback) override
Function to perform some user-defined operation after a timeout waiting for a result that hasn't been...
BT::NodeStatus on_cancelled() override
Function to perform some user-defined operation upon cancellation of the action.