18 #include "nav2_behavior_tree/plugins/action/navigate_to_pose_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)
32 if (!getInput(
"goal", goal_.pose)) {
35 "NavigateToPoseAction: goal not provided");
38 getInput(
"behavior_tree", goal_.behavior_tree);
43 setOutput(
"error_code_id", ActionResult::NONE);
44 setOutput(
"error_msg",
"");
45 return BT::NodeStatus::SUCCESS;
50 setOutput(
"error_code_id", result_.result->error_code);
51 setOutput(
"error_msg", result_.result->error_msg);
52 return BT::NodeStatus::FAILURE;
58 setOutput(
"error_code_id", ActionResult::NONE);
59 setOutput(
"error_msg",
"");
60 return BT::NodeStatus::SUCCESS;
65 setOutput(
"error_code_id", ActionResult::TIMEOUT);
66 setOutput(
"error_msg",
"Behavior Tree action client timed out waiting.");
71 #include "behaviortree_cpp/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::NavigateToPoseAction>(
78 name,
"navigate_to_pose", config);
82 "NavigateToPose", builder);
Abstract class representing an action based BT node.
A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::NavigateToPose.
BT::NodeStatus on_aborted() override
Function to perform some user-defined operation upon abortion of the action.
BT::NodeStatus on_cancelled() override
Function to perform some user-defined operation upon cancellation of the action.
BT::NodeStatus on_success() override
Function to perform some user-defined operation upon successful completion of the action.
void on_timeout() override
Function to perform work in a BT Node when the action server times out Such as setting the error code...
NavigateToPoseAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::NavigateToPoseAction.
void on_tick() override
Function to perform some user-defined operation on tick.