0
$\begingroup$

Rosanswers logo

I am using the differential drive controller from the ros2-control package and its gazebo plugin to simulate a 4WD drive differential drive robot. I am basing the measurements of the chassis, tire and their location/joints from the dimensions of a riding mower after converting from imperial to metric of course.

For the chassis I am using a standard box visual geometry for now, and just cylinder geometry for wheels...nothing fancy, you can see the entire URDF here . I studied carefully how to make gazebo valid URDF and was finally able to spawn a working model in gazebo from URDF which is important because the gazebo plugin launches the ros2 controller manager.

Here is the URDF for ros2-control gazebo plugin, and the ros2-control diff-drive controller config. Finally my launch file...

What this all yields is a nice small city world in gazebo (a few streets, road signs, traffic lights and other cars, and my robot model spawned and ready to be controlled via a PS4 controller using the ros2-teleop-joy package, or really just any /cmd_vel Twist message.

The problem is that it is moving forwards and backwards, but not turning, no matter what the angular velocity of the /cmd_vel command is.

I run the following command for example, which should make it move in circles, but instead it just moves forward

ros2 topic pub --rate 30 /tareeqav_base_controller/cmd_vel_unstamped geometry_msgs/msg/Twist "linear:
 x: 0.7
 y: 0.0
 z: 0.0
angular:
 x: 0.0
 y: 0.0
 z: 1.0"

I also tried the standard Gazebo diff drive plugin with the following config

<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
        

        <!-- wheels -->
      <left_joint>a_fr_left_joint</left_joint>
      <right_joint>b_fr_right_joint</right_joint>

      <!-- kinematics -->
      <wheel_separation>1.25</wheel_separation>
      <wheel_diameter>0.3</wheel_diameter>

      <!-- limits -->
      <max_wheel_torque>20</max_wheel_torque>
      <max_wheel_acceleration>1.0</max_wheel_acceleration>

      <!-- output -->
      <publish_odom>true</publish_odom>
      <publish_odom_tf>true</publish_odom_tf>
      <publish_wheel_tf>true</publish_wheel_tf>
      
      
      <odometry_frame>odom</odometry_frame>
      <robot_base_frame>base_footprint</robot_base_frame>
      <command_topic>cmd_vel</command_topic>
 </plugin>

I've played with the controller config min/max velocities, tried changing the wheel radius and distance between wheel. Nothing works beyond driving forwards and backwards.

I've built physical robots where I have 4 wheels and a control signal shared between the two motors on each side and the car drives and turns with no problems.

Any thoughts on what might be happening, or where I should look next?


Originally posted by sameh4 on ROS Answers with karma: 89 on 2022-01-24

Post score: 0


Original comments

Comment by destogl on 2022-03-01:
These issues are usually caused by friction parameters. It appears that you are using dead-reckoning for rotation. There is a longer discussion about this for husky robots: https://github.com/husky/husky/issues/192

Check PR 191 on how I tried to get this working by adjusting friction parameters in wheel.xacro file.

Comment by sameh4 on 2022-03-01:
@destogl many thanks for this reply! You are correct, the issue was the mu friction parameters. I tested with different mu1/mu2 combinations and found that m1="1.0" and m2="0.25" seem to work very well with the current state of the URDF. Thanks again for your reply! Do you mind to extend your comment to an answer so that it may help someone who has a similar issue?

Comment by destogl on 2022-03-02:
@sameh4 I wrote my commend as answer. Please mark it as correct if you are happy with it.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

These issues are usually caused by friction parameters. It appears that you are using dead-reckoning for rotation. There is a longer discussion about this for husky robots.

Check PR 191 on how I tried to get this working by adjusting friction parameters in wheel.xacro file. Check mu1/mu2 parameters.


Originally posted by destogl with karma: 877 on 2022-03-02

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by sameh4 on 2022-03-02:
I confirmed this answer to be correct, The issue was the mu friction parameters. I tested with different mu1/mu2 combinations and found that m1="1.0" and m2="0.25" seem to work very well with the current state of the URDF; i.e. robot base size, wheel radius, etc. Thanks again for your reply!

$\endgroup$
0
$\begingroup$

Rosanswers logo

The riding mower will require Ackermann steering model so you can turn with the front wheels.

Ackermann steering geometry is a geometric arrangement of linkages in the steering of a car or other vehicle designed to solve the problem of wheels on the inside and outside of a turn needing to trace out circles of different radii.

image description Source: https://en.wikipedia.org/wiki/Ackermann_steering_geometry

Take a look at this Gazebo plugin that you can adapt: https://github.com/froohoo/ackermansteer. And there is a good video that explains the application: https://www.youtube.com/watch?v=WlFdLkD3wa8

Another example: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/dashing/gazebo_plugins/worlds/gazebo_ros_ackermann_drive_demo.world


Originally posted by osilva with karma: 1650 on 2022-01-25

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by sameh4 on 2022-01-25:
Hi @osilva: thanks for the answer. I suspected this to be the case, and I well familiar with ackermann steering, and its bicycle model kinematics vs. the unicycle model of Diff Drive. The question I have is why do smaller robots work with Diff Drive? As I say I've built some robot chassis that use Diff Drive. Shouldn't be the same when it's a small chassis or when it's a big chassis? If the right side tires move faster, the vehicle turns left, no batter how big. Or am I mistaken here?

I wanted to avoid ackerman steering because it's much more complicated to implement on the actual mower. It's very easy to connect 4 motors to the wheels, but implementing a rack-and-pinion gears and servo motors, it's a big mess...

Comment by sameh4 on 2022-01-25:
A helpful link for this discussion https://www.quora.com/Why-do-cars-use-Ackerman-steering-instead-of-differential-drives

Comment by sameh4 on 2022-01-25:
A research paper on 4WD controller EV where each wheel has an attached motor https://www.mdpi.com/1996-1073/11/11/2892/pdf

Comment by osilva on 2022-01-25:
Please note:

Controller for differential drive wheel systems. Control is in the form of a velocity command, that is split then sent on the two wheels of a differential drive wheel base

Source: http://wiki.ros.org/diff_drive_controller

You can always make your own gazebo plugin and have individual motor control for each wheel but the existing differential won't allow you do it.

$\endgroup$

Your Answer

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