Nav2 Navigation Stack - humble  humble
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 
31 class ClearEntireCostmapService : public BtServiceNode<nav2_msgs::srv::ClearEntireCostmap>
32 {
33 public:
40  const std::string & service_node_name,
41  const BT::NodeConfiguration & conf);
42 
47  void on_tick() override;
48 };
49 
55  : public BtServiceNode<nav2_msgs::srv::ClearCostmapExceptRegion>
56 {
57 public:
64  const std::string & service_node_name,
65  const BT::NodeConfiguration & conf);
66 
71  void on_tick() override;
72 
77  static BT::PortsList providedPorts()
78  {
79  return providedBasicPorts(
80  {
81  BT::InputPort<double>(
82  "reset_distance", 1,
83  "Distance from the robot above which obstacles are cleared")
84  });
85  }
86 };
87 
92 class ClearCostmapAroundRobotService : public BtServiceNode<nav2_msgs::srv::ClearCostmapAroundRobot>
93 {
94 public:
101  const std::string & service_node_name,
102  const BT::NodeConfiguration & conf);
103 
108  void on_tick() override;
109 
114  static BT::PortsList providedPorts()
115  {
116  return providedBasicPorts(
117  {
118  BT::InputPort<double>(
119  "reset_distance", 1,
120  "Distance from the robot under which obstacles are cleared")
121  });
122  }
123 };
124 
125 } // namespace nav2_behavior_tree
126 
127 #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.