1
$\begingroup$

I'm working on a urdf model of an ackermann car with 4 wheels. I want to use the ackerman gazebo plugin, in the github i found an example of usage that is the following:

<gazebo>
    <plugin name="gazebo_ros_ackermann_drive" filename="libgazebo_ros_ackermann_drive.so">

  <ros>
    <namespace>ackermann</namespace>
    <remapping>cmd_vel:=cmd_vel</remapping>
    <remapping>odom:=odom</remapping>
    <remapping>distance:=distance</remapping>
  </ros>

  <update_rate>100.0</update_rate>

  <!-- wheels -->
  <front_left_joint>front_left_joint</front_left_joint>
  <front_right_joint>front_eight_joint</front_right_joint>
  <rear_left_joint>rear_left_joint</rear_left_joint>
  <rear_right_joint>rear_right_joint</rear_right_joint>
  <left_steering_joint>left_steering_joint</left_steering_joint>
  <right_steering_joint>right_steering_joint</right_steering_joint>
  <steering_wheel_joint>steering_joint</steering_wheel_joint>
  

  <!-- Max absolute steer angle for tyre in radians-->
  <!-- Any cmd_vel angular z greater than this would be capped -->
  <max_steer>0.6458</max_steer>

  <!-- Max absolute steering angle of steering wheel -->
  <max_steering_angle>7.85</max_steering_angle>

  <!-- Max absolute linear speed in m/s -->
  <max_speed>20</max_speed>

  <!-- PID tuning -->
  <left_steering_pid_gain>1500 0 1</left_steering_pid_gain>
  <left_steering_i_range>0 0</left_steering_i_range>
  <right_steering_pid_gain>1500 0 1</right_steering_pid_gain>
  <right_steering_i_range>0 0</right_steering_i_range>
  <linear_velocity_pid_gain>1000 0 1</linear_velocity_pid_gain>
  <linear_velocity_i_range>0 0</linear_velocity_i_range>

  <!-- output -->
  <publish_odom>true</publish_odom>
  <publish_odom_tf>true</publish_odom_tf>
  <publish_wheel_tf>true</publish_wheel_tf>
  <publish_distance>true</publish_distance>

  <odometry_frame>odom</odometry_frame>
  <robot_base_frame>base_footprint</robot_base_frame>

</plugin>
</gazebo>

My problem is on the joints because I made 4 continuous joints to make the wheels roll and two revolute joints to make the front wheels rotate along the z axis. These 4 joints are the first four joints that you can see in the plugin tags. My question is, what actually is the steering wheel joint? Where do I have to put it and how should it be linked to the other part of the car? If I remove that I don't actually have an error message but all my wheels move under the car to the center. If I just display the urdf on Rviz the model seems good. My urdf structure is made by a base_link for the body of the car, 4 wheels and a base_footprint.

This is the model launched only using Rviz: model displayed only with Rviz

This is when i launch gazebo and the plugin:

what happen when I launch Gazebo with the plugin

$\endgroup$

3 Answers 3

1
$\begingroup$

I have been dealing with this for 4 months. The steering_wheel_joint is the steering wheel (like a real car) I started removing it but I remember the robot didn't move correctly. You can make a virtual link for it. ROS2 has an example with a Toyota Prius in:

/opt/ros/humble/share/gazebo_plugins/worlds/gazebo_ros_ackermann_drive_demo.world 

This example is not a .urdf, though. It is an .sdf file, namely, the format processed by Gazebo. I used it as a guide and I take two important points:

  1. For the collision link for the wheels use an sphere shape instead of a cylinder.
  2. Copy all the friction parameters and then set them up or remove them to see how the robot works.

Also in the Toyota example you are going to see that it use an universal joint (2 DoF). That kind of joint is not supported by ROS2 yet.

I hope I've helped you and Good luck!

$\endgroup$
0
$\begingroup$

For the steered wheels you should have to have 2 joints. The first joint is between the base of the robot and the wheel so that the wheel angle can be moved A second joint is needed to make the wheel rotate.

The first part of the code below will make the joint rotate in z-axis. The second joint will rotate in y-axis so that the wheel can rotate.

 <joint name="${prefix}_${object_name}_ackermann_joint" type="revolute">
  <axis xyz="0 0 1"/>
  <!-- <origin xyz="0.2 0.2 0" rpy="0 0 0" />  -->
  <parent link="${parent}"/>
  <child link="${prefix}_${object_name}_ackermann_link"/>
  <xacro:insert_block name="origin"/>
  <!-- limits -->
  <limit effort="100" lower="-0.41" upper="0.41" velocity="0.5"/> 
  <!-- dynamics-->
  
  <dynamics friction="1.0" damping="1"/> 
</joint>


<joint name="${prefix}_${object_name}_wheel_joint" type="continuous">
   <axis xyz="0 1 0"/> 
  <origin xyz="0 0 0" rpy="0 0 0" /> 
  <parent link="${prefix}_${object_name}_ackermann_link"/>
  <child link="${prefix}_${object_name}_wheel_link"/>
  <joint_properties damping="${wheel_joint_damping}" friction="{wheel_joint_friction}"/>
</joint> 
$\endgroup$
2
  • $\begingroup$ I’ve already did that for the two front steering wheel while for the back one I just make them rotate along the y axis. The problem is that the ackermann plugin requires a lot of joints. I’m okay for the 4 joints of the front wheels as you said too and for 2 joints for the back ones. But it requires an additional joint about steering joint and I don’t know what that exactly is. I tried by just adding a sort of fifth wheel between the two frontal ones. $\endgroup$ Commented Dec 14, 2023 at 18:00
  • $\begingroup$ When you look in the urdf the steering_wheel_joint is just to the chassis. To my idea it is just used to rotate the steer wheel. Normally rotate by the driver :) $\endgroup$
    – Nobel
    Commented Jan 6 at 16:23
0
$\begingroup$

I suggest removing the additional steering wheel joint from the plugin. The issue you are facing with the Ackerman plugin in ROS2 might be related to this extra joint.Check this issue for reference on using the Ackerman controller.

Also, make sure there are no typos, I can see a typo for the right joint.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.