Skip to content

Commit adc17b0

Browse files
author
Gibbon OPC
committed
dedicated callback group
1 parent 3059536 commit adc17b0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

elevation_mapping_cupy/include/elevation_mapping_cupy/elevation_mapping_ros.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ class ElevationMappingNode : public rclcpp::Node {
141141
rclcpp::Service<elevation_map_msgs::srv::Initialize>::SharedPtr initializeMapService_;
142142
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr setPublishPointService_;
143143
rclcpp::Service<elevation_map_msgs::srv::CheckSafety>::SharedPtr checkSafetyService_;
144+
145+
rclcpp::CallbackGroup::SharedPtr servicesCallbackGroup_;
144146

145147
rclcpp::TimerBase::SharedPtr updateVarianceTimer_;
146148
rclcpp::TimerBase::SharedPtr updateTimeTimer_;

elevation_mapping_cupy/src/elevation_mapping_ros.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,14 @@ ElevationMappingNode::ElevationMappingNode(const rclcpp::NodeOptions& options)
262262

263263
gridMap_.setFrameId(mapFrameId_);
264264

265-
rawSubmapService_ = this->create_service<grid_map_msgs::srv::GetGridMap>("get_raw_submap", std::bind(&ElevationMappingNode::getSubmap, this, std::placeholders::_1, std::placeholders::_2));
266-
clearMapService_ = this->create_service<std_srvs::srv::Empty>("clear_map", std::bind(&ElevationMappingNode::clearMap, this, std::placeholders::_1, std::placeholders::_2));
267-
initializeMapService_ = this->create_service<elevation_map_msgs::srv::Initialize>("initialize", std::bind(&ElevationMappingNode::initializeMap, this, std::placeholders::_1, std::placeholders::_2));
268-
clearMapWithInitializerService_ = this->create_service<std_srvs::srv::Empty>("clear_map_with_initializer", std::bind(&ElevationMappingNode::clearMapWithInitializer, this, std::placeholders::_1, std::placeholders::_2));
269-
setPublishPointService_ = this->create_service<std_srvs::srv::SetBool>("set_publish_points", std::bind(&ElevationMappingNode::setPublishPoint, this, std::placeholders::_1, std::placeholders::_2));
270-
checkSafetyService_ = this->create_service<elevation_map_msgs::srv::CheckSafety>("check_safety", std::bind(&ElevationMappingNode::checkSafety, this, std::placeholders::_1, std::placeholders::_2));
265+
servicesCallbackGroup_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
266+
267+
rawSubmapService_ = this->create_service<grid_map_msgs::srv::GetGridMap>("get_raw_submap", std::bind(&ElevationMappingNode::getSubmap, this, std::placeholders::_1, std::placeholders::_2), rmw_qos_profile_services_default, servicesCallbackGroup_);
268+
clearMapService_ = this->create_service<std_srvs::srv::Empty>("clear_map", std::bind(&ElevationMappingNode::clearMap, this, std::placeholders::_1, std::placeholders::_2), rmw_qos_profile_services_default, servicesCallbackGroup_);
269+
initializeMapService_ = this->create_service<elevation_map_msgs::srv::Initialize>("initialize", std::bind(&ElevationMappingNode::initializeMap, this, std::placeholders::_1, std::placeholders::_2), rmw_qos_profile_services_default, servicesCallbackGroup_);
270+
clearMapWithInitializerService_ = this->create_service<std_srvs::srv::Empty>("clear_map_with_initializer", std::bind(&ElevationMappingNode::clearMapWithInitializer, this, std::placeholders::_1, std::placeholders::_2), rmw_qos_profile_services_default, servicesCallbackGroup_);
271+
setPublishPointService_ = this->create_service<std_srvs::srv::SetBool>("set_publish_points", std::bind(&ElevationMappingNode::setPublishPoint, this, std::placeholders::_1, std::placeholders::_2), rmw_qos_profile_services_default, servicesCallbackGroup_);
272+
checkSafetyService_ = this->create_service<elevation_map_msgs::srv::CheckSafety>("check_safety", std::bind(&ElevationMappingNode::checkSafety, this, std::placeholders::_1, std::placeholders::_2), rmw_qos_profile_services_default, servicesCallbackGroup_);
271273

272274
if (updateVarianceFps > 0) {
273275
updateVarianceTimer_ = this->create_wall_timer(std::chrono::duration<double>(1.0 / (updateVarianceFps + 0.00001)), std::bind(&ElevationMappingNode::updateVariance, this));

0 commit comments

Comments
 (0)