18 #include "nav2_behavior_tree/plugins/action/clear_costmap_service.hpp"
20 namespace nav2_behavior_tree
24 const std::string & service_node_name,
25 const BT::NodeConfiguration & conf)
26 :
BtServiceNode<nav2_msgs::srv::ClearEntireCostmap>(service_node_name, conf)
32 if (!getInput(
"plugins", request_->plugins)) {
33 request_->plugins.clear();
39 std::shared_ptr<typename nav2_msgs::srv::ClearEntireCostmap::Response> response)
41 RCLCPP_ERROR_EXPRESSION(node_->get_logger(), !response->success,
42 "ClearEntireCostmap: Failed to clear costmap layers");
43 return response->success ? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
47 const std::string & service_node_name,
48 const BT::NodeConfiguration & conf)
49 :
BtServiceNode<nav2_msgs::srv::ClearCostmapExceptRegion>(service_node_name, conf)
55 getInput(
"reset_distance", request_->reset_distance);
56 if (!getInput(
"plugins", request_->plugins)) {
57 request_->plugins.clear();
64 std::shared_ptr<typename nav2_msgs::srv::ClearCostmapExceptRegion::Response> response)
66 RCLCPP_ERROR_EXPRESSION(node_->get_logger(), !response->success,
67 "ClearCostmapExceptRegion: Failed to clear costmap layers");
68 return response->success ? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
72 const std::string & service_node_name,
73 const BT::NodeConfiguration & conf)
74 :
BtServiceNode<nav2_msgs::srv::ClearCostmapAroundRobot>(service_node_name, conf)
80 getInput(
"reset_distance", request_->reset_distance);
82 if (!getInput(
"plugins", request_->plugins)) {
83 request_->plugins.clear();
90 std::shared_ptr<typename nav2_msgs::srv::ClearCostmapAroundRobot::Response> response)
92 RCLCPP_ERROR_EXPRESSION(node_->get_logger(), !response->success,
93 "ClearCostmapAroundRobot: Failed to clear costmap layers");
94 return response->success ? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
98 const std::string & service_node_name,
99 const BT::NodeConfiguration & conf)
100 :
BtServiceNode<nav2_msgs::srv::ClearCostmapAroundPose>(service_node_name, conf)
106 getInput(
"pose", request_->pose);
107 getInput(
"reset_distance", request_->reset_distance);
109 if (!getInput(
"plugins", request_->plugins)) {
110 request_->plugins.clear();
117 std::shared_ptr<typename nav2_msgs::srv::ClearCostmapAroundPose::Response> response)
119 RCLCPP_ERROR_EXPRESSION(node_->get_logger(), !response->success,
120 "ClearCostmapAroundPose: Failed to clear costmap layers");
121 return response->success ? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
126 #include "behaviortree_cpp/bt_factory.h"
127 BT_REGISTER_NODES(factory)
131 "ClearCostmapExceptRegion");
133 "ClearCostmapAroundRobot");
135 "ClearCostmapAroundPose");
Abstract class representing a service based BT node.
void increment_recovery_count()
Function to increment recovery count on blackboard if this node wraps a recovery.
A nav2_behavior_tree::BtServiceNode class that wraps nav2_msgs::srv::ClearCostmapAroundPose.
BT::NodeStatus on_completion(std::shared_ptr< typename nav2_msgs::srv::ClearCostmapAroundPose::Response > response) override
Check the service response and return appropriate BT status.
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.
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.
BT::NodeStatus on_completion(std::shared_ptr< typename nav2_msgs::srv::ClearCostmapAroundRobot::Response > response) override
Check the service response and return appropriate BT status.
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.
BT::NodeStatus on_completion(std::shared_ptr< typename nav2_msgs::srv::ClearCostmapExceptRegion::Response > response) override
Check the service response and return appropriate BT status.
A nav2_behavior_tree::BtServiceNode class that wraps nav2_msgs::srv::ClearEntireCostmap.
BT::NodeStatus on_completion(std::shared_ptr< typename nav2_msgs::srv::ClearEntireCostmap::Response > response) override
Check the service response and return appropriate BT status.
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.