Skip to content

Commit

Permalink
Added controller_namesapce to the left_wheel_names and right_wheel_na…
Browse files Browse the repository at this point in the history
…mes 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.
```
    <gazebo>
      <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
        <namespace>${robot_namespace}</namespace>
        <robot_param>robot_description</robot_param>
        <robot_param_node>robot_state_publisher</robot_param_node>
        <parameters>package://scout_description/config/robot_control.yaml</parameters>
      </plugin>
    </gazebo>
```
  • Loading branch information
suchetanrs authored Nov 10, 2023
1 parent cc84c5b commit 816bedc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion diff_drive_controller/src/diff_drive_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 816bedc

Please sign in to comment.