Joint Torque...

jcrada
Posts: 11
Joined: Thu Oct 09, 2008 10:59 pm

Joint Torque...

Post by jcrada »

Hi, I have been looking all over the forum to find a way to apply torque at a joint.
I am building a robotics simulation with a ragdoll and I really need to apply torque at its joints in order to make it move. Given what I have seen, Bullet only offers me to apply torque at the center of mass. However, it allows me to apply force at a given relative position. Is there a similar method but

Code: Select all

btRigidBody::applyRelativeTorque(const btVector3& xyz, const btVector3& rel_pos);
?

If not, any ideas on how can I implement it?

Thanks!
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Joint Torque...

Post by ola »

Torque is never applied at a certain position on an object, so you do not need such a function. This is not a Bullet limitation, it is just how torque is defined. So you will just need to orient your torque around the rotation axis of your joint.

You can also look into using a constraint motor, if the constraint you are using for the joint has support for this. This gives you a more servo-like behavior which might be what you are looking for.

Hope this helps you further :-)

Best regards,
Ola
Last edited by ola on Mon Jan 19, 2009 6:35 pm, edited 1 time in total.
jcrada
Posts: 11
Joined: Thu Oct 09, 2008 10:59 pm

Re: Joint Torque...

Post by jcrada »

Thank you very much! You have been of great help!
I am using btGeneric6DofConstraint and it does have a btRotationalMotorLimit, but it is not behaving as I wish it would. In fact, it is not behaving at all. Do you know where can I find examples or help on how to use motors? Is it just enabling it and playing with its variables?

Thanks again.
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Joint Torque...

Post by ola »

You can look at the code in the following demos: (see in Bullet's Demo directory)
ConstraintDemo
SliderConstraintDemo
DynamicControlDemo
ForkLiftDemo

These demos use motors, but not with the generic constraint, rather the hinge constraint and the slider constraint. I use the hinge constraint mostly myself, which is pretty easy to set up.

Best regards,
Ola