btTranslationalLimitMotor Problem: Stuck beyond limits!

Post Reply
Jonathan
Posts: 36
Joined: Sun Feb 10, 2013 6:52 pm

btTranslationalLimitMotor Problem: Stuck beyond limits!

Post by Jonathan »

I have a btGeneric6DofSpringConstraint that's using its btTranslationalLimitMotor, and it's working fine until m_currentLinearDiff exceeds the limits set for the constraint. Then the motor alone will not move the bodies, it simply stops working. If external forces then put the bodies back within the limits, it starts working again.

I'm not 100% sure, but I think this thread is related: http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=4746

But the solutions rponomarev gave did not work for me.

Does anyone know what I can do to solve this?

Thanks,
Jonathan
IresomPCH
Posts: 18
Joined: Tue Sep 24, 2013 12:29 pm

Re: btTranslationalLimitMotor Problem: Stuck beyond limits!

Post by IresomPCH »

I have exactly the same situation... :?
However, the "Generic6DofConstraint" and its "TranslationalLimitMotor" are used in my program.

I have a function to switch constraint motor:
void SetMotorON(Generic6DofConstraint^ _dof6, double _targetPosition)
{
TranslationalLimitMotor^ tMotor = _dof6->TranslationalLimitMotor;

tMotor->EnableMotor[2] = true;// Z motor
tMotor->MaxMotorForce = Vector3(0, 0, ActuatorStrength);

double errZ = (tMotor->CurrentLinearDiff.Z - _targetPosition);
tMotor->TargetVelocity = Vector3(0, 0, errZ * 5 );
}

void SetMotorOFF(Generic6DofConstraint^ _dof6)
{
TranslationalLimitMotor^ tMotor = _dof6->TranslationalLimitMotor;
tMotor->EnableMotor[2] = false;
}


For example, I got two rigidBodies connected by a Generic6DofConstraint in the vertical direction. The top rigidBody is static.
The constraint has a movable range of 2 to -1 on the Z axis.
When the motor is ON, the position/velocity control is fine "whithin" the (2,-1) limit.
When the motor is OFF, one rigidBody will fall down and drag the constraint position to the limit, say 2.
However, the motor->CurrentLinearDiff.Z is slightly out of the limit, ex: 2.000000XXXX... instead of 2.000000000 exactly.
And The motor stoped working when I set it back to ON.

The constraint CFM = 0.0000001, and ERP = 0.65.

Perhapse I can set the motor range to 2.1~-1.1, and use another Generic6DofConstraint (range 2~-1) without motor as a workaround, but the number of constraint object is doubled...

Any ideas? thanks~ :)
Post Reply