How to obtain the gravity force from a link or a joint in a gazebo plugin?

asked 2016-03-23 04:29:19 -0600

gabri89 gravatar image

Hi,

I'm writing a plugin to implement a particular behaviour of a motor, then it will be included in a RR robot to make same test.

I implemented the dynamic, with a external input ad a noise. I set the gravity on in the .xacro file. The problem is that I can't see the influence of the gravity in my model: I think that somehow, I have to extrapolate the gravity force from the model and introduce it in the dynamic equation.

I tried to use the command

force=joint->GetLinkForce(1);

This command should return the force applied in the centre of mass of the link. But I don't understand in which frame this force is referred to : doesn't seem the joint reference frame.

Can you tell me something more?

The command

    torque=joint->GetLinkTorque(1);

should return torque applied in the centre of mass. What does it mean? Does it intend that the point from which we calculate the moment is the centre of mass? If it is true, the result of the command is not due to the gravity force.

Then I tried to use other command of the link class of gazebo. For example I used

torque=link->GetWorldTorque();

or

force=link->GetWorldForce();

These commands returns the force/torque applied to the link expressed in the world frame. The problem is that probably in the return are included constrain force, so I'm not able to isolate the gravity force (or the generated moment).

There is same method to solve my problem?

Are there other command that can help me to extrapolate the gravity force in the world frame, or in another frame with a known rotation?

Thank you, bye.

edit retag flag offensive close merge delete