Nav2 Navigation Stack - kilted  kilted
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_except_region.hpp"
24 
25 namespace nav2_behavior_tree
26 {
27 
33 class ClearEntireCostmapService : public BtServiceNode<nav2_msgs::srv::ClearEntireCostmap>
34 {
35 public:
42  const std::string & service_node_name,
43  const BT::NodeConfiguration & conf);
44 
49  void on_tick() override;
50 };
51 
59  : public BtServiceNode<nav2_msgs::srv::ClearCostmapExceptRegion>
60 {
61 public:
68  const std::string & service_node_name,
69  const BT::NodeConfiguration & conf);
70 
75  void on_tick() override;
76 
81  static BT::PortsList providedPorts()
82  {
83  return providedBasicPorts(
84  {
85  BT::InputPort<double>(
86  "reset_distance", 1,
87  "Distance from the robot above which obstacles are cleared")
88  });
89  }
90 };
91 
98 class ClearCostmapAroundRobotService : public BtServiceNode<nav2_msgs::srv::ClearCostmapAroundRobot>
99 {
100 public:
107  const std::string & service_node_name,
108  const BT::NodeConfiguration & conf);
109 
114  void on_tick() override;
115 
120  static BT::PortsList providedPorts()
121  {
122  return providedBasicPorts(
123  {
124  BT::InputPort<double>(
125  "reset_distance", 1,
126  "Distance from the robot under which obstacles are cleared")
127  });
128  }
129 };
130 
131 } // namespace nav2_behavior_tree
132 
133 #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::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.