btMultiBodyJointMotor and target settings

Post Reply
michi
Posts: 8
Joined: Tue Dec 13, 2016 10:11 am

btMultiBodyJointMotor and target settings

Post by michi »

Hi,
I am trying to use a setPositionTarget and a setVelocityTarget of a btMultiBodyJointMotor the following way
=============================
btMultiBodyJointMotor* motor = new btMultiBodyJointMotor(m_multiBody, index, 0, 0.0f, maxMotorImpulse);
if (index == A)
motor->setPositionTarget(0.0f, 0.0f);
else
motor->setPositionTarget(0.0f, 1.0f);
=============================

The aim is that for link A I will be able to increase the target velocity and have the other links as "stiff as possible".
This works usually well but if I try this for A=15 then even with velocity=0.0f I get a rotating link 15.
It looks like the constraint solver is not finding a solution (but just for this one link) ... But if I rotate some (or just one) of the other links a bit then link15 suddenly behaves as expected.

I tried already to increase the simulation step but that did not help. Not sure how to debug this the best way. The odd thing is only one link of many behave that way.
If I use a btMultiBodyJointLimitConstraint instead of the motor then my btMultiBody looks ok.

Maybe its related to the m_kd or m_kp settings of the targets but as I said things behave once other links get moved a little bit.
michi
Posts: 8
Joined: Tue Dec 13, 2016 10:11 am

Re: btMultiBodyJointMotor and target settings

Post by michi »

still stabbing in the dark here but I have the feeling that my problem is related to
the bit in btMultiBodyConstraint::fillMultiBodyConstraint
where it calculated denom0

ndofA = multiBodyA->getNumDofs() + 6;
jacA = &data.m_jacobians[solverConstraint.m_jacAindex];
deltaVelA = &data.m_deltaVelocitiesUnitImpulse[solverConstraint.m_jacAindex];
for (int i = 0; i < ndofA; ++i)
{
btScalar j = jacA ;
btScalar l = deltaVelA;
denom0 += j*l;
}

Now, my problematic link has index 15 ... and the only non 0.0 entry for jacA is i =17 (not sure exactly where the +2 is from).
deltaVelA[17] is quite large and I think this results in the strange behaviour I am seeing. Might be a red-herring.
michi
Posts: 8
Joined: Tue Dec 13, 2016 10:11 am

Re: btMultiBodyJointMotor and target settings

Post by michi »

my bad .. I set an unrealistic value for inertia tensor for some of the links ... fixed now .. hurray!
Post Reply