Inconsistent Constraint Motor Forces

Post Reply
Posts: 6
Joined: Fri Mar 23, 2012 7:18 am

Inconsistent Constraint Motor Forces

Post by jamesm6162 » Fri Apr 12, 2013 6:10 am

I have a question regarding the different ways each btxxConstraint sets it's maximum impulse for their respective motors.

For starters the sequential impulse constraint solver expects impulses in the m_lowerLimit and m_upperLimit fields of the btSolverConstraint.

The btHingeConstraint has method setMaxMotorImpulse() and indeed sets the +-m_maxMotorImpulse as the m_lowerLimit and m_upperLimit respectively in getInfo2

The btGeneric6DofConstraint has 1xbtTranslationalLimitMotor and 3x btRotationalLimitMotor members that each have a m_maxMotorForce which is applied in getInfo2 as if it is instead an impulse. (i.e. +-m_maxMotorForce assigned directly to m_lowerLimit and m_upperLimit)
So you might think your setting some force while in actual fact you are setting an impulse.

The btSliderConstraint is even more interesting. It takes the m_maxLinMotorForce (which is set by setMaxLinMotorForce), then multiplies it with info->fps before assigning it to the m_lowerLimit and m_upperLimit. So this is neither force nor impulse and to set an actual force one needs to first multiply the input to setMaxLinMotorForce with deltaT^2, essentially just because the function setMaxLinMotorForce expects you to pass maxImpulse * deltaT. Uh?

Now my question is why is there all this inconsistency with the way motor impulses are set? And more importantly why is naming of these members, not only ambiguous, but downright wrong?

Any further explanation would be greatly appreciated.


Post Reply