Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
persistent_sequence.hpp
1 // Copyright (c) 2025 Enjoy Robotics
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__PERSISTENT_SEQUENCE_HPP_
16 #define NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__PERSISTENT_SEQUENCE_HPP_
17 
18 #include <string>
19 #include "behaviortree_cpp/control_node.h"
20 #include "behaviortree_cpp/bt_factory.h"
21 
22 namespace nav2_behavior_tree
23 {
47 class PersistentSequenceNode : public BT::ControlNode
48 {
49 public:
50  PersistentSequenceNode(const std::string & name, const BT::NodeConfiguration & conf);
51 
52  ~PersistentSequenceNode() override = default;
53 
55  static BT::PortsList providedPorts()
56  {
57  return {
58  BT::BidirectionalPort<int>("current_child_idx", "The index of the current child"),
59  };
60  }
61 
62 private:
63  BT::NodeStatus tick() override;
64 };
65 
66 } // namespace nav2_behavior_tree
67 
68 #endif // NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__PERSISTENT_SEQUENCE_HPP_
The PersistentSequenceNode is similar to the SequenceNode, but it stores the index of the last runnin...
static BT::PortsList providedPorts()
Declare ports.