Differential drive can't turn

asked 2020-05-12 10:04:33 -0500

jeremy gravatar image

updated 2020-05-15 10:25:17 -0500

Hi, I am trying to do simulate a differential robot (It's based on a real robot, so I can't change the position of things ). The robot got 2 motorized wheels and 3 casters wheels places as such :

image description

The caster wheels don't have friction or joints, the mains wheels can touch the ground, and when I make it go straight the robot move. The problem is that when I when it to rotate (angular speed on Z ) the wheels rotates normally (each in opposite direction) but the robot doesn't move (the wheels accelerate at a moment, making it go forward then reverse to go back to the initial position, I guess it's the controller trying to fix it )

The urdf of the robot : https://pastebin.com/BKXvftYT

The wheels and casters (they are xacro's macro: https://pastebin.com/X56upVk0

And the control.yaml :

type: "joint_state_controller/JointStateController"
publish_rate: 50

  type: "diff_drive_controller/DiffDriveController"
  left_wheel: 'wheel_left_joint'
  right_wheel: 'wheel_right_joint'
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
  twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
  cmd_vel_timeout: 0.25
  velocity_rolling_window_size: 2

  # Base frame_id
  base_frame_id: base_footprint

  # Odometry fused with IMU is published by robot_localization, so
  # no need to publish a TF based on encoders alone.
 enable_odom_tf: true

 # Husky hardware provides wheel velocities
 estimate_velocity_from_position: false

 # Wheel separation and radius multipliers
wheel_separation_multiplier: 1.0 # default: 1.0
 wheel_radius_multiplier    : 1.0 # default: 1.0
 wheel_separation           : 0.434
 wheel_radius               : 0.100   

 # Velocity and acceleration limits
 # Whenever a min_* is unspecified, default to -max_*
     has_velocity_limits    : false
     max_velocity           : 1.0  # m/s
     min_velocity           : -0.5 # m/s
     has_acceleration_limits: false
     max_acceleration       : 0.8  # m/s^2
     min_acceleration       : -0.4 # m/s^2
     has_jerk_limits        : false
     max_jerk               : 5.0  # m/s^3
     has_velocity_limits    : false
     max_velocity           : 1.7  # rad/s
     has_acceleration_limits: false
     max_acceleration       : 1.5  # rad/s^2
     has_jerk_limits        : false
     max_jerk               : 2.5  # rad/s^3

the problem seems to be that the wheels don't stay straight (rotate on X ? ) and switch their contact, I don't know what cause it to occurs, or how to fix it. I tried a lot of things and can't figure out why this won't work. (I had made a robot with a different appearance, and it didn't have this type of behavior).

As anyone encounters that type of problems or know what can be the cause?



edit: the comment from kumpakri saying to remove the fdir seems to have made the robot work. I updated the codes in the question, I will verify if all work normally Monday but it looks like it was the source of the problem.

edit retag flag offensive close merge delete


what if you set the mu2 to 1.0 as well?

kumpakri gravatar imagekumpakri ( 2020-05-13 09:48:01 -0500 )edit

I tried to tweak the mus values without result, but I think I found the porblem : The wheels inertia is way lower than the inertia of anythings else, and when i increase it, the robot seems to act normaly. I will make inertia calculs to put more precise values and see if that fixe it :)

jeremy gravatar imagejeremy ( 2020-05-14 03:45:47 -0500 )edit

Well, I tried puting real value of inertia, and I came back to almost the same things, the robot shaking and can't turn :(

jeremy gravatar imagejeremy ( 2020-05-14 07:04:57 -0500 )edit

try to delete the fdir tag. gazebo (or ODE) computes that correctly during the simulation. If you put your value, you are overwriting the correct vector.

kumpakri gravatar imagekumpakri ( 2020-05-15 06:51:44 -0500 )edit

upper and lower limit for continuous joint does not apply. You can delete that. Not that it would do anything. It just doesn't make sense to keep it in code.

kumpakri gravatar imagekumpakri ( 2020-05-15 06:53:06 -0500 )edit

From my calculation accordint to wiki the ixx = 0,00780225, iyy=0,00780225 and izz=0,02525. How did you get to yours inertia matrix?

kumpakri gravatar imagekumpakri ( 2020-05-15 07:03:27 -0500 )edit

you can try to increase the limit for the effort in the wheel joint.

kumpakri gravatar imagekumpakri ( 2020-05-15 07:08:07 -0500 )edit

I think you found it ! I delete the fdir and it seems to work correctly ( didn't saw your others comments before, the inertia in the current question are wrong din't update yesterday when I changed it (it is the same as what you sayed. ) When I was trying random things I increase the effort, but the problem stay (Well, with the change of inertia, I had more of a "wheel go in and out of the ground" problem than they yawl but still ). I will run more complete test monday to be certain.

jeremy gravatar imagejeremy ( 2020-05-15 10:17:58 -0500 )edit

If that work correctly I will close the post at that time :) Thanks a lot :D

jeremy gravatar imagejeremy ( 2020-05-15 10:18:46 -0500 )edit