ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Differential Drive not turning the vehicle

asked 2022-01-24 21:33:47 -0600

sameh4 gravatar image

updated 2022-01-24 21:35:13 -0600

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?

edit retag flag offensive close merge delete

Comments

1

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...

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

destogl gravatar image destogl  ( 2022-03-01 02:28:47 -0600 )edit

@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?

sameh4 gravatar image sameh4  ( 2022-03-01 10:02:06 -0600 )edit

@sameh4 I wrote my commend as answer. Please mark it as correct if you are happy with it.

destogl gravatar image destogl  ( 2022-03-02 06:32:50 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-03-02 06:32:06 -0600

updated 2022-03-02 06:34:48 -0600

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.

edit flag offensive delete link more

Comments

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!

sameh4 gravatar image sameh4  ( 2022-03-02 06:37:34 -0600 )edit
1

answered 2022-01-25 07:37:52 -0600

osilva gravatar image

updated 2022-01-25 07:40:01 -0600

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 descriptionSource: https://en.wikipedia.org/wiki/Ackerma...

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=WlFdL...

Another example: https://github.com/ros-simulation/gaz...

edit flag offensive delete link more

Comments

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...

sameh4 gravatar image sameh4  ( 2022-01-25 09:37:11 -0600 )edit

A helpful link for this discussion https://www.quora.com/Why-do-cars-use...

sameh4 gravatar image sameh4  ( 2022-01-25 11:35:59 -0600 )edit

A research paper on 4WD controller EV where each wheel has an attached motor https://www.mdpi.com/1996-1073/11/11/...

sameh4 gravatar image sameh4  ( 2022-01-25 11:37:13 -0600 )edit

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_contro...

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.

osilva gravatar image osilva  ( 2022-01-25 12:11:24 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-01-24 21:33:47 -0600

Seen: 1,911 times

Last updated: Mar 02 '22