Mesure force and torque

Post Reply
Posts: 1
Joined: Thu Apr 20, 2017 11:21 am

Mesure force and torque

Post by felix » Thu Apr 20, 2017 4:23 pm


I'm currently trying to do some simulations of a humanoid robot (for the moment I'm just experimenting on hinges).

My robot will only use hinge constraints (for the moment I'm experimenting with only one, between a static lower part of the leg and a dynamic upper part connected by one hinge (the knee)).

I used the enableAngularMotor method of the class btHingeConstraint to command the angle (using a PD control (for the moment without D)). Up to this point it works quite well (even if I can't make out what exactly is the last argument ( btScalar maxMotorImpulse )).

Now I would like to know how much torque the motor is providing. For that, I use a btJointFeedback, and I read the m_appliedTorqueBodyB field. However, the results doesn't seem coherent : once the upper part of the leg reaches its target, the torque becomes 0, even if the upper part of the leg is horizontal (it weights 10kg for a length of 40cm, so it should be a torque of 10kg*9.81N/kg*0.4m/2 = 20 N.m).

Do you have some idea what may be going wrong? Or How to get my motor's torque?

I also tried to get the total forces and torques applied on the rigid bodies (using the getTotalForce/Torque methods of the class btRigidBody), but I get 0 on all axis all the time (even when the upper leg is acting like a pendulum (ie there are clearly a non 0 total force and a non zero torque). Any Idea what I'm doing wrong? In particular, I would like to measure the ground reaction for each feet : is it possible?

Thank you very much in advance

PS : there is my code
(10.53 KiB) Downloaded 64 times
(1.07 KiB) Downloaded 61 times
(it's compiling as a standalone app with GUI ; I'm printing lots of measures on std::cout (witch are also put in a .cvs file for plotting)

Post Reply