Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
behavior.hpp
1 // Copyright (c) 2019 Samsung Research America
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_CORE__BEHAVIOR_HPP_
16 #define NAV2_CORE__BEHAVIOR_HPP_
17 
18 #include <string>
19 #include <memory>
20 
21 #include "nav2_ros_common/lifecycle_node.hpp"
22 #include "nav2_ros_common/tf2_factories.hpp"
23 #include "nav2_costmap_2d/costmap_topic_collision_checker.hpp"
24 
25 namespace nav2_core
26 {
27 
28 enum class CostmapInfoType
29 {
30  NONE = 0,
31  LOCAL = 1,
32  GLOBAL = 2,
33  BOTH = 3
34 };
35 
40 class Behavior
41 {
42 public:
43  using Ptr = std::shared_ptr<Behavior>;
44 
48  virtual ~Behavior() {}
49 
56  virtual void configure(
57  const nav2::LifecycleNode::WeakPtr & parent,
58  const std::string & name, nav2::TransformBuffer::SharedPtr tf,
59  std::shared_ptr<nav2_costmap_2d::CostmapTopicCollisionChecker> local_collision_checker,
60  std::shared_ptr<nav2_costmap_2d::CostmapTopicCollisionChecker> global_collision_checker) = 0;
61 
65  virtual void cleanup() = 0;
66 
70  virtual void activate() = 0;
71 
75  virtual void deactivate() = 0;
76 
81  virtual CostmapInfoType getResourceInfo() = 0;
82 };
83 
84 } // namespace nav2_core
85 
86 #endif // NAV2_CORE__BEHAVIOR_HPP_
Abstract interface for behaviors to adhere to with pluginlib.
Definition: behavior.hpp:41
virtual void cleanup()=0
Method to cleanup resources used on shutdown.
virtual ~Behavior()
Virtual destructor.
Definition: behavior.hpp:48
virtual void activate()=0
Method to active Behavior and any threads involved in execution.
virtual void configure(const nav2::LifecycleNode::WeakPtr &parent, const std::string &name, nav2::TransformBuffer::SharedPtr tf, std::shared_ptr< nav2_costmap_2d::CostmapTopicCollisionChecker > local_collision_checker, std::shared_ptr< nav2_costmap_2d::CostmapTopicCollisionChecker > global_collision_checker)=0
virtual CostmapInfoType getResourceInfo()=0
Method to determine the required costmap info.
virtual void deactivate()=0
Method to deactivate Behavior and any threads involved in execution.