Stiffness of btGeneric6DofConstraint

Post Reply
Posts: 8
Joined: Wed Jun 27, 2012 9:13 am

Stiffness of btGeneric6DofConstraint

Post by Otz » Wed Sep 05, 2012 11:48 am

Hi there,

I am working on a humanoid robot physics simulator and I use btGeneric6DofConstraints for all the joints of the robot.
Please look at this little screen capture:
Here you can see my problem with the constraints. They aren't stiff.

Can somebody help me with this problem?

The ERP/CFM - Config:

Code: Select all

angularCFM : 0.0000001 
angularERP  : 0.9
linear CFM   : 0.0000001
angularERP  : 0.3
Here some Code:

Code: Select all

btGeneric6DofConstraint * Robot::addbtGeneric6DofConstraint (RobotPart *partA, RobotPart *partB,btVector3 pointInA,btVector3 pointInB, bool useLinearReferenceFrameA){


    btTransform tInA;
    tInA.setOrigin( pointInA );
    btTransform tInB;
    tInB.setOrigin( pointInB );
    btGeneric6DofConstraint *cons = new btGeneric6DofConstraint(*partA->getRigidBody(),*partB->getRigidBody(),tInA,tInB,false);



    btRotationalLimitMotor *motorX = cons->getRotationalLimitMotor(0);
    btRotationalLimitMotor *motorY = cons->getRotationalLimitMotor(1);
    btRotationalLimitMotor *motorZ = cons->getRotationalLimitMotor(2);
    motorX->m_normalCFM = motorY->m_normalCFM = motorZ->m_normalCFM = 0.0000000;
    motorX->m_stopCFM = motorY->m_stopCFM = motorZ->m_stopCFM = 0.0000000;
    motorX->m_bounce = motorY->m_bounce = motorZ->m_bounce = 0.0000000;
    motorX->m_targetVelocity = motorY->m_targetVelocity = motorZ->m_targetVelocity =1.0;
    motorX->m_maxMotorForce = motorY->m_maxMotorForce  = motorZ->m_maxMotorForce  =100.0;
    motorX->m_maxLimitForce = motorY->m_maxLimitForce  = motorZ->m_maxLimitForce  =10000.0;
    motorX->m_enableMotor = motorY->m_enableMotor = motorZ->m_enableMotor = true;


    dynamicsWorld->addConstraint(cons,true); // true = allow collisions with linked objects


    return cons;

Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Stiffness of btGeneric6DofConstraint

Post by Flix » Thu Sep 06, 2012 10:14 am

Otz wrote:Here you can see my problem with the constraints. They aren't stiff.Can somebody help me with this problem?
I have found some improvements by using a much higher mass (something like: 10x->1000x factor) when calculating the local inertia of the rigid bodies (I've already described it in this post: ... f=9&t=7863), but I'm not sure this method is useful in all the simulations: expecially in yours, because you probably need a bigger stiffness if you don't add some additional constraints to keep the robot from falling (like I did).

User avatar
Erwin Coumans
Site Admin
Posts: 4155
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Stiffness of btGeneric6DofConstraint

Post by Erwin Coumans » Fri Sep 14, 2012 6:37 pm

The easiest way to improve stifness is to increase the number of constraint solver iterations (can be done per constraint):

Code: Select all

also you can use a small INTERNAL simulation substep. For example run at 1000 Hertz:

btScalar simulationSubStep = 1.f/1000.f;

Code: Select all

world->stepSimulation(actualDeltaTime, 100, simulationSubStep);
Hope this helps,

Post Reply