Nav2 Navigation Stack - jazzy  jazzy
ROS 2 Navigation Stack
clear_costmap_service.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_BEHAVIOR_TREE__PLUGINS__ACTION__CLEAR_COSTMAP_SERVICE_HPP_
16 #define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__CLEAR_COSTMAP_SERVICE_HPP_
17 
18 #include <string>
19 
20 #include "nav2_behavior_tree/bt_service_node.hpp"
21 #include "nav2_msgs/srv/clear_entire_costmap.hpp"
22 #include "nav2_msgs/srv/clear_costmap_around_robot.hpp"
23 #include "nav2_msgs/srv/clear_costmap_around_pose.hpp"
24 #include "nav2_msgs/srv/clear_costmap_except_region.hpp"
25 
26 namespace nav2_behavior_tree
27 {
28 
32 class ClearEntireCostmapService : public BtServiceNode<nav2_msgs::srv::ClearEntireCostmap>
33 {
34 public:
41  const std::string & service_node_name,
42  const BT::NodeConfiguration & conf);
43 
48  void on_tick() override;
49 };
50 
56  : public BtServiceNode<nav2_msgs::srv::ClearCostmapExceptRegion>
57 {
58 public:
65  const std::string & service_node_name,
66  const BT::NodeConfiguration & conf);
67 
72  void on_tick() override;
73 
78  static BT::PortsList providedPorts()
79  {
80  return providedBasicPorts(
81  {
82  BT::InputPort<double>(
83  "reset_distance", 1,
84  "Distance from the robot above which obstacles are cleared")
85  });
86  }
87 };
88 
93 class ClearCostmapAroundRobotService : public BtServiceNode<nav2_msgs::srv::ClearCostmapAroundRobot>
94 {
95 public:
102  const std::string & service_node_name,
103  const BT::NodeConfiguration & conf);
104 
109  void on_tick() override;
110 
115  static BT::PortsList providedPorts()
116  {
117  return providedBasicPorts(
118  {
119  BT::InputPort<double>(
120  "reset_distance", 1,
121  "Distance from the robot under which obstacles are cleared")
122  });
123  }
124 };
125 
132 class ClearCostmapAroundPoseService : public BtServiceNode<nav2_msgs::srv::ClearCostmapAroundPose>
133 {
134 public:
141  const std::string & service_node_name,
142  const BT::NodeConfiguration & conf);
143 
148  void on_tick() override;
149 
154  static BT::PortsList providedPorts()
155  {
156  return providedBasicPorts(
157  {
158  BT::InputPort<geometry_msgs::msg::PoseStamped>(
159  "pose", "Pose around which to clear the costmap"),
160  BT::InputPort<double>(
161  "reset_distance", 1.0,
162  "Distance from the pose under which obstacles are cleared")
163  });
164  }
165 };
166 
167 } // namespace nav2_behavior_tree
168 
169 #endif // NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__CLEAR_COSTMAP_SERVICE_HPP_
Abstract class representing a service based BT node.
static BT::PortsList providedBasicPorts(BT::PortsList addition)
Any subclass of BtServiceNode that accepts parameters must provide a providedPorts method and call pr...
A nav2_behavior_tree::BtServiceNode class that wraps nav2_msgs::srv::ClearCostmapAroundPose.
ClearCostmapAroundPoseService(const std::string &service_node_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::ClearCostmapAroundPoseService.
void on_tick() override
The main override required by a BT service.
static BT::PortsList providedPorts()
Creates list of BT ports.
A nav2_behavior_tree::BtServiceNode class that wraps nav2_msgs::srv::ClearCostmapAroundRobot.
ClearCostmapAroundRobotService(const std::string &service_node_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::ClearCostmapAroundRobotService.
void on_tick() override
The main override required by a BT service.
static BT::PortsList providedPorts()
Creates list of BT ports.
A nav2_behavior_tree::BtServiceNode class that wraps nav2_msgs::srv::ClearCostmapExceptRegion.
ClearCostmapExceptRegionService(const std::string &service_node_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::ClearCostmapExceptRegionService.
void on_tick() override
The main override required by a BT service.
static BT::PortsList providedPorts()
Creates list of BT ports.
A nav2_behavior_tree::BtServiceNode class that wraps nav2_msgs::srv::ClearEntireCostmap.
void on_tick() override
The main override required by a BT service.
ClearEntireCostmapService(const std::string &service_node_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::ClearEntireCostmapService.