From cc5082eae1afaa10a4712afa6a2025e59d56a257 Mon Sep 17 00:00:00 2001 From: Manuel M Date: Tue, 21 Feb 2023 08:40:29 +0100 Subject: [PATCH] apply suggestions from review --- .../controller_manager/controller_manager.hpp | 5 ++--- controller_manager/src/controller_manager.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/controller_manager/include/controller_manager/controller_manager.hpp b/controller_manager/include/controller_manager/controller_manager.hpp index 41ae7b638e..1d809b4309 100644 --- a/controller_manager/include/controller_manager/controller_manager.hpp +++ b/controller_manager/include/controller_manager/controller_manager.hpp @@ -40,8 +40,6 @@ #include "controller_manager_msgs/srv/switch_controller.hpp" #include "controller_manager_msgs/srv/unload_controller.hpp" -#include "std_msgs/msg/string.hpp" - #include "diagnostic_updater/diagnostic_updater.hpp" #include "hardware_interface/handle.hpp" #include "hardware_interface/resource_manager.hpp" @@ -54,6 +52,7 @@ #include "rclcpp/node_interfaces/node_parameters_interface.hpp" #include "rclcpp/parameter.hpp" #include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" namespace controller_manager { @@ -305,7 +304,7 @@ class ControllerManager : public rclcpp::Node std::shared_ptr response); CONTROLLER_MANAGER_PUBLIC - void init_resource_manager_cb(const std_msgs::msg::String & msg); + void robot_description_callback(const std_msgs::msg::String & msg); // Per controller update rate support unsigned int update_loop_counter_ = 0; diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index fdc590f8c8..5f8193a9a6 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -156,10 +156,11 @@ ControllerManager::ControllerManager( { // set QoS to transient local to get messages that have already been published // (if robot state publisher starts before controller manager) - RCLCPP_INFO(get_logger(), "Subscribing to robot_state_publisher for robot description file."); + RCLCPP_INFO( + get_logger(), "Subscribing to ~/robot_description topic for robot description file."); robot_description_subscription_ = create_subscription( - "/robot_description", rclcpp::QoS(1).transient_local(), - std::bind(&ControllerManager::init_resource_manager_cb, this, std::placeholders::_1)); + namespace_ + "/robot_description", rclcpp::QoS(1).transient_local(), + std::bind(&ControllerManager::robot_description_callback, this, std::placeholders::_1)); } else { @@ -201,10 +202,11 @@ ControllerManager::ControllerManager( init_services(); } -void ControllerManager::init_resource_manager_cb(const std_msgs::msg::String & robot_description) +void ControllerManager::robot_description_callback(const std_msgs::msg::String & robot_description) { - RCLCPP_ERROR( - get_logger(), "'init_resource_manager_cb called with %s", robot_description.data.c_str()); + RCLCPP_INFO(get_logger(), "Received robot description file."); + RCLCPP_DEBUG( + get_logger(), "'Content of robot description file: %s", robot_description.data.c_str()); // TODO(Manuel) errors should probably be caught since we don't want controller_manager node // to die if a non valid urdf is passed. However, should maybe be fine tuned. try