Joint Motor Torque / Impulse

honk
Posts: 1
Joined: Sun Apr 01, 2012 6:20 am

Joint Motor Torque / Impulse

Post by honk »

Hi,

I want to get the torque applied by a single rotational motor in a hinge constraint. When I first tried to measure the torque using a btHingeConstraint and reading the m_appliedImpulse member, I realized that the value is the sum of all torques added to the rigid bodies by the constraint. This includes torques to keep up the constraint in all three joint axes (not only the axis of the motor).

Now, I am trying to get the torque/impulse applied by a btRotationalLimitMotor from a btGeneric6DofConstraint. I thought that maybe the m_accumulatedImpulse member of the btRotationalLimitMotor would help me to solve my problem. But it is never updated in Bullet.

I searched the forum for answers to this question and stumbled upon these two posts:

http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=4766

In this post the same problem is discussed but it's not clear if there was a change in the way Bullet reports its joint feedback. I found nothing like the joint feedback of ODE in Bullet and no splitted torque values for constraints.

http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=7849

Quiet the same here: A btGeneric6DofConstraint was used. I tried to set the m_useSolveConstraintObsolete and get the applied impulse computed in btRotationalLimitMotor::solveAngularLimits. But the method doesn't seem to be called ever.
Next I took a look into the btSequentialConstraintSolver and I think the m_appliedImpulse is 'loosing its dimension' in btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGeneric.

Code: Select all

	btScalar deltaImpulse = c.m_rhs-btScalar(c.m_appliedImpulse)*c.m_cfm;
	const btScalar deltaVel1Dotn	=	c.m_contactNormal.dot(body1.internalGetDeltaLinearVelocity()) 	+ c.m_relpos1CrossNormal.dot(body1.internalGetDeltaAngularVelocity());
	const btScalar deltaVel2Dotn	=	-c.m_contactNormal.dot(body2.internalGetDeltaLinearVelocity()) + c.m_relpos2CrossNormal.dot(body2.internalGetDeltaAngularVelocity());

//	const btScalar delta_rel_vel	=	deltaVel1Dotn-deltaVel2Dotn;
	deltaImpulse	-=	deltaVel1Dotn*c.m_jacDiagABInv;
	deltaImpulse	-=	deltaVel2Dotn*c.m_jacDiagABInv;

	const btScalar sum = btScalar(c.m_appliedImpulse) + deltaImpulse;
Unfortunately I am not that deep into the math behind this operation to get a clue where to start to split these values again.

Does anyone experienced the same problem? Is there any feasible solution provided by the current version of Bullet?

Cheers,
Honk