Home | Tutorials | Wiki | Issues
Ask Your Question

Wrong direction of gravity

asked 2016-04-07 03:17:09 -0500

Hanson gravatar image

updated 2016-04-10 20:24:10 -0500

So I built a human-like robot with some 3d models. It worked pretty well with the default inertial settings. But after I tried to simulate using real inertia parameters, following the tutorial, it just behave strangely (exploding, jittering, etc.). So at the end I have to pretend it is a robot one order of magnitude greater (so the mass and inertia tensor are much greater as well). The new inertia tensor pretty much solved my problems except for one new problem. When gravity is on, one of the arms just rotate by itself as the photo below shows:

When robot just spawned in the world


After a few second


If I turned off the gravity for this arm (for both upper arm and forearm, turning off one segment doesn't help) it will be alright. And I also tried to detach the arm from the shoulder (remove the joint), even on the ground it is moving by itself toward the same direction. I literally copied the setting of the normal arm and applied it on this problematic arm (changed the direction of course), no help. In the world sdf file I explicitly defined the gravity direction to be 0 0 -9.8, nothing changed. I adjusted the damping and friction of the shoulder and elbow joint from 0 to several thousand, still the same.

It seems like the gravity of this arm has a different direction and there is no way to fix it. Does anyone have any idea what could be the cause of the problem? Thanks a lot!

Edit: I attached the sdf file. But I am not sure if it helps, because I can't upload proprietary model files so it is hard to replicate the problem. But the model files for both arms are also identical except for the orientation so it should not be the cause of the problem. C:\fakepath\model.sdf

Edit2: I also attached the sdf file with real inertia. But the assumed damping and friction may not be very accurate. C:\fakepath\model real inertia.sdf

edit retag flag offensive close merge delete


If you can share the sdf causing the problem it might help. Have you inspected the joints to see they're properly placed?

chapulina gravatar imagechapulina ( 2016-04-07 09:17:15 -0500 )edit

Hi chapulina, thanks for the comment. I did inspected the joints and I also copied the settings of joints on the normal side, but this strange phenomenon still occurred. And I attached the sdf file. But probably it is not very helpful as I am not allowed to provide the model files.

Hanson gravatar imageHanson ( 2016-04-07 11:16:50 -0500 )edit

To my experience, this kind of error can apper for two reasons: 1) Two joined link have a difference of inertials in an order of magnitude higher than 10. 2) The iterations for the physic engine solver are two low. Can you verify that ?

debz gravatar imagedebz ( 2016-04-10 16:01:50 -0500 )edit

Hi debz. The two joined links (right upper arm and forearm) are very close in inertia. The shoulder, though, is almost an order of magnitude smaller, strangely if that is the cause it did not affect the left arm. For the iterations, currently I am using the default value (50), and increased it to 200 doesn't solve this. So I am not sure if 50 too low. But still it cannot explain why the problem only happened on right arm

Hanson gravatar imageHanson ( 2016-04-10 21:31:07 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-04-07 12:49:37 -0500

Thanks for sharing the model. After inspecting it a bit, I noticed the weird movement happens on joint joint_right_shoulder_upperarm:

<joint name='joint_right_shoulder_upperarm' type='revolute'>
  <pose frame=''>0 0 0 0 -0 0</pose>
    <xyz>0 1 0</xyz>

So I went ahead and cleared all the not required settings and left it like this:

<joint name='joint_right_shoulder_upperarm' type='revolute'>
    <xyz>0 1 0</xyz>

This way, the weird motion stops. So I guess when you copied the joint from one side to the other, you probably forgot to change the sign for some gain. I would try change these parameters one by one to see what's at fault.

edit flag offensive delete link more


Hi chapulina. In my simulation this workaround produces the same effect as set both damping and friction to 0. And even after doing so, the right arm still behaves differently. Instead of moving towards one direction, it now slightly "swings" from side to side as if it is a pendulum, not really like the normal left arm. And I think it is really necessary to be able to use damping and friction. But thanks for your answer anyway.

Hanson gravatar imageHanson ( 2016-04-07 22:00:35 -0500 )edit

answered 2016-04-07 11:37:41 -0500

hsu gravatar image

updated 2016-04-08 12:25:23 -0500

Please provide sdf with realistic inertia. It's better if we debug the real robot to figure out what the issue is.

== respond to comment below ==

I personally prefer starting with a realistic model, find out why dynamics is not behaving correctly (deal with all the problem such as "exploded all over the place" is fixable). You'll be surprised the issues you saw before changing inertia might not be a completely different problem at all; as numerical errors have a strange way of exposing themselves sometimes.

Normally, in addition to realistic inertia, I'd ask for realistic estimates of friction, joint damping, actuation details, etc. Those things are optional because we can estimate them to the right order of magnitude by simple assumptions for now. But provide them as a bonus if you have them.

With a working as-realistic-as-possible model as a baseline, we can then make additional trade-offs for performance by tweaking the model physically.

I personally don't think debugging a brand new robot with physically non-realistic parameters is a good approach. The direction of gravity issue might come from various unexpected side effects of numerical updates for one


edit flag offensive delete link more


Hi Hsu, thanks for the suggestion. I change the inertia only because the real values are too small and whatever damping and friction I set (from 0 to several hundred) the robot just exploded all over the place. That's a different problem and is even worse than now. I have also tried all the answers to similar questions (robot explosion, dance, etc.) but nothing can help. Since the two problems are so different I don't think it is caused by proportionally larger inertia. But I do want to solve it

Hanson gravatar imageHanson ( 2016-04-07 21:23:42 -0500 )edit

updating the answer with a response. Thanks.

hsu gravatar imagehsu ( 2016-04-08 12:19:13 -0500 )edit

You're absolutely right. Maybe I also made mistakes when I converted the realistic inertia to the new one. Well now I attached the original model file for "exploding" robot. But I am not very sure how to estimate damping and friction correctly so they may not be accurate.

Hanson gravatar imageHanson ( 2016-04-10 20:29:51 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2016-04-07 03:17:09 -0500

Seen: 322 times

Last updated: Apr 10 '16