18 #include "nav2_behavior_tree/plugins/action/navigate_through_poses_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::NavigateThroughPoses>(xml_tag_name, action_name, conf)
33 if (!getInput(
"goals", goal_.poses)) {
36 "NavigateThroughPosesAction: goal not provided");
39 getInput(
"behavior_tree", goal_.behavior_tree);
44 setOutput(
"error_code_id", ActionResult::NONE);
45 setOutput(
"error_msg",
"");
46 return BT::NodeStatus::SUCCESS;
51 setOutput(
"error_code_id", result_.result->error_code);
52 setOutput(
"error_msg", result_.result->error_msg);
53 return BT::NodeStatus::FAILURE;
59 setOutput(
"error_code_id", ActionResult::NONE);
60 setOutput(
"error_msg",
"");
61 return BT::NodeStatus::SUCCESS;
66 setOutput(
"error_code_id", ActionResult::TIMEOUT);
67 setOutput(
"error_msg",
"Behavior Tree action client timed out waiting.");
72 #include "behaviortree_cpp/bt_factory.h"
73 BT_REGISTER_NODES(factory)
75 BT::NodeBuilder builder =
76 [](
const std::string & name,
const BT::NodeConfiguration & config)
78 return std::make_unique<nav2_behavior_tree::NavigateThroughPosesAction>(
79 name,
"navigate_through_poses", config);
83 "NavigateThroughPoses", builder);
Abstract class representing an action based BT node.
A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::NavigateThroughPoses.
void on_timeout() override
Function to perform work in a BT Node when the action server times out Such as setting the error code...
BT::NodeStatus on_cancelled() override
Function to perform some user-defined operation upon cancellation of the action.
NavigateThroughPosesAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::NavigateThroughPosesAction.
BT::NodeStatus on_success() override
Function to perform some user-defined operation upon successful completion of the action.
void on_tick() override
Function to perform some user-defined operation on tick.
BT::NodeStatus on_aborted() override
Function to perform some user-defined operation upon abortion of the action.