18 #include "opennav_docking_bt/dock_robot.hpp"
20 namespace opennav_docking_bt
24 const std::string & xml_tag_name,
25 const std::string & action_name,
26 const BT::NodeConfiguration & conf)
27 : BtActionNode<Action>(xml_tag_name, action_name, conf)
34 [[maybe_unused]]
auto res = getInput(
"use_dock_id", goal_.use_dock_id);
35 if (goal_.use_dock_id) {
36 getInput(
"dock_id", goal_.dock_id);
38 getInput(
"dock_pose", goal_.dock_pose);
39 getInput(
"dock_type", goal_.dock_type);
40 getInput(
"max_staging_time", goal_.max_staging_time);
42 getInput(
"navigate_to_staging_pose", goal_.navigate_to_staging_pose);
47 setOutput(
"success", result_.result->success);
48 setOutput(
"num_retries", result_.result->num_retries);
49 setOutput(
"error_code_id", ActionResult::NONE);
50 return BT::NodeStatus::SUCCESS;
55 setOutput(
"success", result_.result->success);
56 setOutput(
"num_retries", result_.result->num_retries);
57 setOutput(
"error_code_id", result_.result->error_code);
58 return BT::NodeStatus::FAILURE;
63 setOutput(
"error_code_id", ActionResult::NONE);
64 return BT::NodeStatus::SUCCESS;
74 #include "behaviortree_cpp/bt_factory.h"
75 BT_REGISTER_NODES(factory)
77 BT::NodeBuilder builder =
78 [](
const std::string & name,
const BT::NodeConfiguration & config)
80 return std::make_unique<opennav_docking_bt::DockRobotAction>(
81 name,
"dock_robot", config);
85 "DockRobot", builder);
nav2_behavior_tree::BtActionNode class that wraps opnav2_msgsennav_docking_msgs/DockRobot
void on_tick() override
Function to perform some user-defined operation on tick.
BT::NodeStatus on_cancelled() override
Function to perform some user-defined operation upon cancellation of the action.
BT::NodeStatus on_aborted() override
Function to perform some user-defined operation upon abortion of the action.
BT::NodeStatus on_success() override
Function to perform some user-defined operation upon successful completion of the action.
void halt() override
Override required by the a BT action. Cancel the action and set the path output.
DockRobotAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for opennav_docking_bt::DockRobotAction.