19 #include "nav2_behavior_tree/plugins/action/follow_object_action.hpp"
21 namespace nav2_behavior_tree
25 const std::string & xml_tag_name,
26 const std::string & action_name,
27 const BT::NodeConfiguration & conf)
35 getInput(
"pose_topic", goal_.pose_topic);
36 getInput(
"tracked_frame", goal_.tracked_frame);
38 getInput(
"max_duration", max_duration);
41 goal_.max_duration = rclcpp::Duration::from_seconds(max_duration);
46 setOutput(
"total_elapsed_time", result_.result->total_elapsed_time);
47 setOutput(
"error_code_id", ActionResult::NONE);
48 setOutput(
"error_msg",
"");
49 return BT::NodeStatus::SUCCESS;
54 setOutput(
"total_elapsed_time", result_.result->total_elapsed_time);
55 setOutput(
"error_code_id", result_.result->error_code);
56 setOutput(
"error_msg", result_.result->error_msg);
57 return BT::NodeStatus::FAILURE;
62 setOutput(
"total_elapsed_time", result_.result->total_elapsed_time);
63 setOutput(
"error_code_id", ActionResult::NONE);
64 setOutput(
"error_msg",
"");
65 return BT::NodeStatus::SUCCESS;
70 #include "behaviortree_cpp/bt_factory.h"
71 BT_REGISTER_NODES(factory)
73 BT::NodeBuilder builder =
74 [](
const std::string & name,
const BT::NodeConfiguration & config)
76 return std::make_unique<nav2_behavior_tree::FollowObjectAction>(
77 name,
"follow_object", config);
81 "FollowObject", builder);
Abstract class representing an action based BT node.
nav2_behavior_tree::BtActionNode class that wraps nav2_msgs/FollowObject
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.
FollowObjectAction(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::FollowObjectAction.
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.