18 #include "nav2_behavior_tree/plugins/action/assisted_teleop_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::AssistedTeleop>(xml_tag_name, action_name, conf)
32 double time_allowance;
33 getInput(
"time_allowance", time_allowance);
34 getInput(
"is_recovery", is_recovery_);
37 goal_.time_allowance = rclcpp::Duration::from_seconds(time_allowance);
42 if (!BT::isStatusActive(status())) {
53 setOutput(
"error_code_id", ActionResult::NONE);
54 return BT::NodeStatus::SUCCESS;
59 setOutput(
"error_code_id", result_.result->error_code);
60 return is_recovery_ ? BT::NodeStatus::FAILURE : BT::NodeStatus::SUCCESS;
65 setOutput(
"error_code_id", ActionResult::NONE);
66 return BT::NodeStatus::SUCCESS;
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::AssistedTeleopAction>(
78 name,
"assisted_teleop", config);
A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::AssistedTeleop.
BT::NodeStatus on_aborted() override
Function to perform some user-defined operation upon abortion of the action.
AssistedTeleopAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::nav2_msgs::action::AssistedTeleop.
BT::NodeStatus on_success() override
Function to perform some user-defined operation upon successful completion of the action.
BT::NodeStatus on_cancelled() override
Function to perform some user-defined operation upon cancellation of the action.
void on_tick() override
Function to perform some user-defined operation on tick.
void initialize()
Function to read parameters and initialize class variables.
Abstract class representing an action based BT node.
void increment_recovery_count()
Function to increment recovery count on blackboard if this node wraps a recovery.