From 816bedcd9df74fb558b5f2f488df7209e8a919b9 Mon Sep 17 00:00:00 2001 From: suchetanrs <79915569+suchetanrs@users.noreply.github.com> Date: Fri, 10 Nov 2023 13:57:00 +0100 Subject: [PATCH] Added controller_namesapce to the left_wheel_names and right_wheel_names parameters The controller namespace is added to the odom_frame_id and the base_frame_id. However, it is not done to the left_wheel_names and right_wheel_names. The differential drive controller is often used as a gazebo plugin like below. Since this is defined inside a xacro, the Rewritten yaml cannot be used to add namespaces to joints. Adding the namespace in the cpp file bypasses this issue. In the PR, the convention is followed. That is, "robot_namespace/left_wheel_name". Please let me know if I need to change it in any other place. The modified changes solves my issue. ``` ${robot_namespace} robot_description robot_state_publisher package://scout_description/config/robot_control.yaml ``` --- diff_drive_controller/src/diff_drive_controller.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/diff_drive_controller/src/diff_drive_controller.cpp b/diff_drive_controller/src/diff_drive_controller.cpp index 2913838138..6acea74226 100644 --- a/diff_drive_controller/src/diff_drive_controller.cpp +++ b/diff_drive_controller/src/diff_drive_controller.cpp @@ -405,7 +405,16 @@ controller_interface::CallbackReturn DiffDriveController::on_configure( const auto odom_frame_id = controller_namespace + params_.odom_frame_id; const auto base_frame_id = controller_namespace + params_.base_frame_id; - + + for (auto & joint_name : params_.left_wheel_names) + { + joint_name = controller_namespace + joint_name; + } + for (auto & joint_name : params_.right_wheel_names) + { + joint_name = controller_namespace + joint_name; + } + auto & odometry_message = realtime_odometry_publisher_->msg_; odometry_message.header.frame_id = odom_frame_id; odometry_message.child_frame_id = base_frame_id;