Robot base slowly drifting
After spawning my robot and without sending any Twist commands, I noticed that it slowly drifts. I checked the /gazebo/model_states topic and noticed that the twist of my base is not zero
linear:
x: 0.000147341651406
y: 1.44766752077e-05
z: 9.3220339335e-09
angular:
x: 7.15641334542e-09
y: 1.36163145416e-08
z: 0.000712493893403
Those are small values but integrated over a long time tend to make my robot change position. This is a big problem because I am working with laser scans and doing line detection iterated many times, which leads to line coefficients changing a lot in few seconds. I tried changing the friction of the wheels but it doesn't seem to help. How can I force the robot to stand still?
I am using a differential drive defined as follows:
toru2_diff_drive_controller:
type : "diff_drive_controller/DiffDriveController"
left_wheel : 'toru2_left_axle'
right_wheel : 'toru2_right_axle'
publish_rate: 50.0 # default: 50
pose_covariance_diagonal : [0.0001, 0.000001, 1000000.0,
1000000.0, 1000000.0, 0.0005]
twist_covariance_diagonal: [0.0001, 0.000001, 1000000.0,
1000000.0, 1000000.0, 0.0005]
# Wheel separation and diameter. These are both optional.
# diff_drive_controller will attempt to read either one or both from the
# URDF if not specified as a parameter
wheel_separation : 0.512
wheel_radius : 0.09
Check if the inertia values are correct, and try playing with those a bit, increasing the mass might help as well.
I'm having the exact same problem using Gazebo 2.2.3 and ROS Indigo. Even without any control input, the angular z velocity of the robot is even higher than @mehdi. Mine is around 0.002 so the robot slowly rotates in place from the moment Gazebo is fired up. @AndreiHaidu, can you please give us a hint regarding inertia values to try? I've tried a bunch of settings including increasing the mass, and nothing fixes the problem.
The same problem is present in my simulation using Gazebo 9.0.0 and ROS Kinetic. Did you ever find a fix?
You could try increasing the iterations of Gazebo (
iters
parameter). By default it's in 50 and you could set it to 200. The easiest way to do this is using the GUI.lol that is an ancient question, one solution would be creating dynamic fixed joints between robot base and world when the robot has to stand still, and detach that link when the robot should drive.