From 47274dcb36e9177d6ce4f0596276790422b3b639 Mon Sep 17 00:00:00 2001 From: Matt Spencer Date: Fri, 17 Jul 2026 08:28:02 +0000 Subject: [PATCH] Refactor the robot description, and include mecanum control. --- .../config/ros2_controllers.yaml | 23 +- .../meshes/{ => wheels}/wheel_lb_link.stl | Bin .../meshes/{ => wheels}/wheel_lf_link.stl | Bin .../meshes/{ => wheels}/wheel_rb_link.stl | Bin .../meshes/{ => wheels}/wheel_rf_link.stl | Bin .../urdf/agv_pro.gazebo.xacro | 38 +- .../urdf/agv_pro.ros2_control.xacro | 59 --- .../urdf/agv_pro.urdf.xacro | 353 +++++++----------- .../urdf/control/agv_pro.ros2_control.xacro | 55 +++ .../urdf/parts/inertia.urdf.xacro | 59 +++ .../urdf/parts/wheel_macro.xacro | 113 ++++++ .../agv_pro_gazebo/config/agv_control.yaml | 18 +- 12 files changed, 373 insertions(+), 345 deletions(-) rename src/elephant_robotics/agv_pro_description/meshes/{ => wheels}/wheel_lb_link.stl (100%) rename src/elephant_robotics/agv_pro_description/meshes/{ => wheels}/wheel_lf_link.stl (100%) rename src/elephant_robotics/agv_pro_description/meshes/{ => wheels}/wheel_rb_link.stl (100%) rename src/elephant_robotics/agv_pro_description/meshes/{ => wheels}/wheel_rf_link.stl (100%) delete mode 100644 src/elephant_robotics/agv_pro_description/urdf/agv_pro.ros2_control.xacro create mode 100644 src/elephant_robotics/agv_pro_description/urdf/control/agv_pro.ros2_control.xacro create mode 100644 src/elephant_robotics/agv_pro_description/urdf/parts/inertia.urdf.xacro create mode 100644 src/elephant_robotics/agv_pro_description/urdf/parts/wheel_macro.xacro diff --git a/src/elephant_robotics/agv_pro_bringup/config/ros2_controllers.yaml b/src/elephant_robotics/agv_pro_bringup/config/ros2_controllers.yaml index 721baa0..0054f27 100644 --- a/src/elephant_robotics/agv_pro_bringup/config/ros2_controllers.yaml +++ b/src/elephant_robotics/agv_pro_bringup/config/ros2_controllers.yaml @@ -11,26 +11,21 @@ controller_manager: # ───────────────────────────────────────────────────────────────────────────── # Mecanum drive controller # ───────────────────────────────────────────────────────────────────────────── -# NOTE: The URDF joint names do not match the physical wheel positions due to a -# naming inconsistency in agv_pro.urdf. The mapping between the controller's -# logical positions and the URDF joint names is as follows: -# -# Physical position │ URDF joint name -# ──────────────────┼──────────────────────────── -# front-left (FL) │ left_front_wheel_joint ✓ -# front-right (FR) │ left_rear_wheel_joint ← physically front-right -# rear-left (RL) │ right_front_wheel_joint ← physically rear-left -# rear-right (RR) │ right_rear_wheel_joint ✓ +# Wheel link names match their physical corners: +# front-left (FL) -> left_front_wheel_joint +# front-right (FR) -> right_front_wheel_joint +# rear-left (RL) -> left_rear_wheel_joint +# rear-right (RR) -> right_rear_wheel_joint # # The same mapping is used by the hardware interface (front_left_joint / # front_right_joint / rear_left_joint / rear_right_joint params in the URDF # block). mecanum_drive_controller: ros__parameters: - front_left_wheel_command_joint_name: left_front_wheel_joint - front_right_wheel_command_joint_name: left_rear_wheel_joint - rear_left_wheel_command_joint_name: right_front_wheel_joint - rear_right_wheel_command_joint_name: right_rear_wheel_joint + front_left_wheel_command_joint_name: front_left_wheel_joint + front_right_wheel_command_joint_name: front_right_wheel_joint + rear_left_wheel_command_joint_name: rear_left_wheel_joint + rear_right_wheel_command_joint_name: rear_right_wheel_joint odom_frame_id: odom base_frame_id: base_footprint diff --git a/src/elephant_robotics/agv_pro_description/meshes/wheel_lb_link.stl b/src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_lb_link.stl similarity index 100% rename from src/elephant_robotics/agv_pro_description/meshes/wheel_lb_link.stl rename to src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_lb_link.stl diff --git a/src/elephant_robotics/agv_pro_description/meshes/wheel_lf_link.stl b/src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_lf_link.stl similarity index 100% rename from src/elephant_robotics/agv_pro_description/meshes/wheel_lf_link.stl rename to src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_lf_link.stl diff --git a/src/elephant_robotics/agv_pro_description/meshes/wheel_rb_link.stl b/src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_rb_link.stl similarity index 100% rename from src/elephant_robotics/agv_pro_description/meshes/wheel_rb_link.stl rename to src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_rb_link.stl diff --git a/src/elephant_robotics/agv_pro_description/meshes/wheel_rf_link.stl b/src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_rf_link.stl similarity index 100% rename from src/elephant_robotics/agv_pro_description/meshes/wheel_rf_link.stl rename to src/elephant_robotics/agv_pro_description/meshes/wheels/wheel_rf_link.stl diff --git a/src/elephant_robotics/agv_pro_description/urdf/agv_pro.gazebo.xacro b/src/elephant_robotics/agv_pro_description/urdf/agv_pro.gazebo.xacro index 25aa39b..0fad2ca 100644 --- a/src/elephant_robotics/agv_pro_description/urdf/agv_pro.gazebo.xacro +++ b/src/elephant_robotics/agv_pro_description/urdf/agv_pro.gazebo.xacro @@ -2,40 +2,18 @@ - - - - - - 0.8 - 0.8 - 100000.0 - 1.0 - - - 0.1 0.1 0.1 1 - 0.1 0.1 0.1 1 - 0.1 0.1 0.1 1 - - - - - - - - - - - + + name="gz_ros2_control::GazeboSimROS2ControlPlugin"> ${controllers_file} - + \ No newline at end of file diff --git a/src/elephant_robotics/agv_pro_description/urdf/agv_pro.ros2_control.xacro b/src/elephant_robotics/agv_pro_description/urdf/agv_pro.ros2_control.xacro deleted file mode 100644 index 6ffdfbd..0000000 --- a/src/elephant_robotics/agv_pro_description/urdf/agv_pro.ros2_control.xacro +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - gz_ros2_control/GazeboSimSystem - - - agv_pro_hardware/AgvProHardwareInterface - ${port_name} - 0.072 - 0.172 - 0.180 - - ${namespace}left_front_wheel_joint - ${namespace}left_rear_wheel_joint - ${namespace}right_front_wheel_joint - ${namespace}right_rear_wheel_joint - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/elephant_robotics/agv_pro_description/urdf/agv_pro.urdf.xacro b/src/elephant_robotics/agv_pro_description/urdf/agv_pro.urdf.xacro index f481bfc..696f688 100644 --- a/src/elephant_robotics/agv_pro_description/urdf/agv_pro.urdf.xacro +++ b/src/elephant_robotics/agv_pro_description/urdf/agv_pro.urdf.xacro @@ -1,255 +1,152 @@ - + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - - - + + + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + - - - - - - - - - + - - - - - - - + - - - - - - + - - - - - - + - - - - - - - - - - - - - - - - + + + + + + - - - - - - + + + + + + + + + - - - - - - + + + + + + + - - - - - - - - - + + + + + - - - - - - - + - - - - - - + + + + + - - - - - - + - - - - - - - - - + + + + + - - - - - - - + + + - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/src/elephant_robotics/agv_pro_description/urdf/control/agv_pro.ros2_control.xacro b/src/elephant_robotics/agv_pro_description/urdf/control/agv_pro.ros2_control.xacro new file mode 100644 index 0000000..60198f9 --- /dev/null +++ b/src/elephant_robotics/agv_pro_description/urdf/control/agv_pro.ros2_control.xacro @@ -0,0 +1,55 @@ + + + + + + + + + gz_ros2_control/GazeboSimSystem + + + agv_pro_hardware/AgvProHardwareInterface + ${port_name} + 0.072 + 0.172 + 0.180 + ${prefix}front_left_wheel_joint + ${prefix}front_right_wheel_joint + ${prefix}rear_left_wheel_joint + ${prefix}rear_right_wheel_joint + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/elephant_robotics/agv_pro_description/urdf/parts/inertia.urdf.xacro b/src/elephant_robotics/agv_pro_description/urdf/parts/inertia.urdf.xacro new file mode 100644 index 0000000..81f4994 --- /dev/null +++ b/src/elephant_robotics/agv_pro_description/urdf/parts/inertia.urdf.xacro @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/elephant_robotics/agv_pro_description/urdf/parts/wheel_macro.xacro b/src/elephant_robotics/agv_pro_description/urdf/parts/wheel_macro.xacro new file mode 100644 index 0000000..4e7196e --- /dev/null +++ b/src/elephant_robotics/agv_pro_description/urdf/parts/wheel_macro.xacro @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0 + 0.0 + + 1 -1 0 + + + 1 1 0 + + + + + + 100000.0 + 10.0 + + + + + + + + + \ No newline at end of file diff --git a/src/elephant_robotics/agv_pro_gazebo/config/agv_control.yaml b/src/elephant_robotics/agv_pro_gazebo/config/agv_control.yaml index 83ce34c..cc4b7be 100644 --- a/src/elephant_robotics/agv_pro_gazebo/config/agv_control.yaml +++ b/src/elephant_robotics/agv_pro_gazebo/config/agv_control.yaml @@ -17,23 +17,13 @@ controller_manager: # (gz_ros2_control/GazeboSimSystem here vs agv_pro_hardware/AgvProHardwareInterface # on the real robot); the controller parameters are identical. # -# NOTE: The URDF joint names do not match the physical wheel positions due to a -# naming inconsistency in the shared robot model. The controller compensates via -# the front/rear/left/right command-joint mapping below: -# -# Physical position │ URDF joint name -# ──────────────────┼──────────────────────────── -# front-left (FL) │ left_front_wheel_joint ✓ -# front-right (FR) │ left_rear_wheel_joint ← physically front-right -# rear-left (RL) │ right_front_wheel_joint ← physically rear-left -# rear-right (RR) │ right_rear_wheel_joint ✓ # ───────────────────────────────────────────────────────────────────────────── mecanum_drive_controller: ros__parameters: - front_left_wheel_command_joint_name: left_front_wheel_joint - front_right_wheel_command_joint_name: left_rear_wheel_joint - rear_left_wheel_command_joint_name: right_front_wheel_joint - rear_right_wheel_command_joint_name: right_rear_wheel_joint + front_left_wheel_command_joint_name: front_left_wheel_joint + front_right_wheel_command_joint_name: front_right_wheel_joint + rear_left_wheel_command_joint_name: rear_left_wheel_joint + rear_right_wheel_command_joint_name: rear_right_wheel_joint odom_frame_id: odom base_frame_id: base_footprint