Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
recovery_node.hpp
1 // Copyright (c) 2019 Intel Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__RECOVERY_NODE_HPP_
16 #define NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__RECOVERY_NODE_HPP_
17 
18 #include <string>
19 #include "behaviortree_cpp_v3/control_node.h"
20 
21 namespace nav2_behavior_tree
22 {
35 class RecoveryNode : public BT::ControlNode
36 {
37 public:
44  const std::string & name,
45  const BT::NodeConfiguration & conf);
46 
50  ~RecoveryNode() override = default;
51 
56  static BT::PortsList providedPorts()
57  {
58  return {
59  BT::InputPort<int>("number_of_retries", 1, "Number of retries")
60  };
61  }
62 
63 private:
64  unsigned int current_child_idx_;
65  unsigned int number_of_retries_;
66  unsigned int retry_count_;
67 
72  BT::NodeStatus tick() override;
73 
77  void halt() override;
78 };
79 
80 } // namespace nav2_behavior_tree
81 
82 #endif // NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__RECOVERY_NODE_HPP_
The RecoveryNode has only two children and returns SUCCESS if and only if the first child returns SUC...
static BT::PortsList providedPorts()
Creates list of BT ports.
RecoveryNode(const std::string &name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::RecoveryNode.
~RecoveryNode() override=default
A destructor for nav2_behavior_tree::RecoveryNode.