Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
follow_object_cancel_node.cpp
1 // Copyright (c) 2024 Open Navigation LLC
2 // Copyright (c) 2024 Alberto J. Tudela Roldán
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #include <string>
17 #include <memory>
18 
19 #include "nav2_behavior_tree/plugins/action/follow_object_cancel_node.hpp"
20 
21 namespace nav2_behavior_tree
22 {
23 
25  const std::string & xml_tag_name,
26  const std::string & action_name,
27  const BT::NodeConfiguration & conf)
28 : nav2_behavior_tree::BtCancelActionNode<nav2_msgs::action::FollowObject>(
29  xml_tag_name, action_name, conf)
30 {
31 }
32 
33 } // namespace nav2_behavior_tree
34 
35 #include "behaviortree_cpp/bt_factory.h"
36 BT_REGISTER_NODES(factory)
37 {
38  BT::NodeBuilder builder =
39  [](const std::string & name, const BT::NodeConfiguration & config)
40  {
41  return std::make_unique<nav2_behavior_tree::FollowObjectCancel>(
42  name, "follow_object", config);
43  };
44 
45  factory.registerBuilder<nav2_behavior_tree::FollowObjectCancel>(
46  "CancelFollowObject", builder);
47 }
Abstract class representing an action for cancelling BT node.
A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::FollowObject.
FollowObjectCancel(const std::string &xml_tag_name, const std::string &action_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::FollowObject.