Idle robot drifts due to tilted inertia
Hi, I have a turtlebot 2 with an arm and a superstructure with two 3D cameras. The arm is of course mobile, so gazebo calculates its own inertia. But the superstructure is not, and so Gazebo join all the weights (reasonably calculated, as far as I can tell) together with the base, hence the tilted inertia box. The following video makes all much clearer:
The kobuki base alone doesn't drift, so it makes sense that the tilted inertia causes the drift. Of course I can hack my URDF with a weightless superstructure, but I wanted to fix this in a more realistic way. I tried all I can think about, and all failed:
- use the generic diff-drive gazebo plugin (byt default I use the kobuki one)
- set force and effort limit to 0 in the plugin.
- adding friction to the wheel joints only works when I send non-zero velocity commands to the robot (see video at the end)
- setting damping makes gazebo crash and/or freeze
btw, looks like gazebo ignores these 2 parameters if set for the joints in the URDF (I added
<joint_properties damping="10000000.0" friction="10000000000.0"/>
to each joint). But when I check the values within the gazebo plugin, both are 0. So I tried to set directly in the code (works for friction, crashes with damping)
I have found other 2 similar questions, so looks like an old issue. But nothing there helped me:
I'm using gazebo 9.14.0 with melodic. My URDF is dispersed in 3 repos, so no easy to follow. Here's kobuki base xacro file, but I did some local modifications. The whole URDF (quite big)
Thanks a lot in advance!
UPDATE Following @nlamprian question (thanks!), I check if the wheels actually move, and... Gazebo never fails to surprise me; one spin, the other glide!!
I also have non-zero min depth and mu, except for the casters. See xacro.
UPDATE 2 I solved the drift! I attach the caster wheels with continuous instead of fixed joints. Base movements also look reasonable. BUT (always a but with gazebo), when I try to grasp anything, the following happens:
(with fixed caster base didn't move at all; also, the grasped cube has reasonable physics):
Looks like now none of the wheels offer any friction (though I have very high mu values, 200/100 for the 4 wheels). I tried adding damping to the motor wheels, but then the robot moves horribly bad, even with very small number.
For sure, the problem is to simulate the resistance to motion of the motors; there must be a way to do so
You want high friction for the wheels and no friction for the casters. Otherwise, the contacts are fighting each other.