Search code examples
drake

Weird behavior from model when simulating it on drake


I'm trying to upload my hexapod urdf onto drake. I followed the online instructions and finally got model run successfully on drake. However, its behavior is weird. Its legs are all pointing up, as shown below, which doesn't make sense. When I have the model freely floating and with gravity, all the legs should be on the ground. The gravity works fine when all my legs are not on the ground, the hexapod drops. Can you please enlighten me what happens with my model?

hexapod

Here is my github if you want to take a look:hexapod_drake

At first, I thought that was the gravity problem, but after checking it, the gravity works perfectly. I see this only happens when I have static friction on. Without it, my model just slides away, which makes sense to me.


Solution

  • Either in model_visualizer or your simulation's meshcat display, open the "Open Controls" control panel, then unfold the "Scene > drake > inertia" tree and click the checkbox on inertia to see a visual representation of each body's inertia.

    Pretty obviously the inertia is in the wrong places, which is probably why the dynamics seem counter-intuitive.

    enter image description here

    One quick way to repair the inertia values would be to run fix_inertia on the model. This assumes a constant-density collision geometry so might not be perfect in this case, but it's at least better than what's there now.