Skip to content

Commit

Permalink
Fix QoS deprecation warnings (ros-controls#879)
Browse files Browse the repository at this point in the history
Co-authored-by: Bence Magyar <[email protected]>
Co-authored-by: Denis Štogl <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2023
1 parent ec31f61 commit 570bbb8
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ static constexpr const char * kChainableControllerInterfaceClassName =
"controller_interface::ChainableControllerInterface";

// Changed services history QoS to keep all so we don't lose any client service calls
static const rmw_qos_profile_t rmw_qos_profile_services_hist_keep_all = {
RMW_QOS_POLICY_HISTORY_KEEP_ALL,
1, // message queue depth
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false};
rclcpp::QoS qos_services =
rclcpp::QoS(rclcpp::QoSInitialization(RMW_QOS_POLICY_HISTORY_KEEP_ALL, 1))
.reliable()
.durability_volatile();

inline bool is_controller_inactive(const controller_interface::ControllerInterfaceBase & controller)
{
Expand Down Expand Up @@ -234,47 +228,47 @@ void ControllerManager::init_services()
using namespace std::placeholders;
list_controllers_service_ = create_service<controller_manager_msgs::srv::ListControllers>(
"~/list_controllers", std::bind(&ControllerManager::list_controllers_srv_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
qos_services, best_effort_callback_group_);
list_controller_types_service_ =
create_service<controller_manager_msgs::srv::ListControllerTypes>(
"~/list_controller_types",
std::bind(&ControllerManager::list_controller_types_srv_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
std::bind(&ControllerManager::list_controller_types_srv_cb, this, _1, _2), qos_services,
best_effort_callback_group_);
load_controller_service_ = create_service<controller_manager_msgs::srv::LoadController>(
"~/load_controller", std::bind(&ControllerManager::load_controller_service_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
qos_services, best_effort_callback_group_);
configure_controller_service_ = create_service<controller_manager_msgs::srv::ConfigureController>(
"~/configure_controller",
std::bind(&ControllerManager::configure_controller_service_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
std::bind(&ControllerManager::configure_controller_service_cb, this, _1, _2), qos_services,
best_effort_callback_group_);
reload_controller_libraries_service_ =
create_service<controller_manager_msgs::srv::ReloadControllerLibraries>(
"~/reload_controller_libraries",
std::bind(&ControllerManager::reload_controller_libraries_service_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
qos_services, best_effort_callback_group_);
switch_controller_service_ = create_service<controller_manager_msgs::srv::SwitchController>(
"~/switch_controller",
std::bind(&ControllerManager::switch_controller_service_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
std::bind(&ControllerManager::switch_controller_service_cb, this, _1, _2), qos_services,
best_effort_callback_group_);
unload_controller_service_ = create_service<controller_manager_msgs::srv::UnloadController>(
"~/unload_controller",
std::bind(&ControllerManager::unload_controller_service_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
std::bind(&ControllerManager::unload_controller_service_cb, this, _1, _2), qos_services,
best_effort_callback_group_);
list_hardware_components_service_ =
create_service<controller_manager_msgs::srv::ListHardwareComponents>(
"~/list_hardware_components",
std::bind(&ControllerManager::list_hardware_components_srv_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
std::bind(&ControllerManager::list_hardware_components_srv_cb, this, _1, _2), qos_services,
best_effort_callback_group_);
list_hardware_interfaces_service_ =
create_service<controller_manager_msgs::srv::ListHardwareInterfaces>(
"~/list_hardware_interfaces",
std::bind(&ControllerManager::list_hardware_interfaces_srv_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
std::bind(&ControllerManager::list_hardware_interfaces_srv_cb, this, _1, _2), qos_services,
best_effort_callback_group_);
set_hardware_component_state_service_ =
create_service<controller_manager_msgs::srv::SetHardwareComponentState>(
"~/set_hardware_component_state",
std::bind(&ControllerManager::set_hardware_component_state_srv_cb, this, _1, _2),
rmw_qos_profile_services_hist_keep_all, best_effort_callback_group_);
qos_services, best_effort_callback_group_);
}

controller_interface::ControllerInterfaceBaseSharedPtr ControllerManager::load_controller(
Expand Down

0 comments on commit 570bbb8

Please sign in to comment.