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: http://www.youtube.com/watch?v=6ggX2nnU-CQ
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
Code: Select all
btGeneric6DofConstraint * Robot::addbtGeneric6DofConstraint (RobotPart *partA, RobotPart *partB,btVector3 pointInA,btVector3 pointInB, bool useLinearReferenceFrameA){
pointInA.setValue((btScalar)pointInA.x()*(btScalar)scale.x(),(btScalar)pointInA.y()*(btScalar)scale.y(),(btScalar)pointInA.z()*(btScalar)scale.z());
pointInB.setValue((btScalar)pointInB.x()*(btScalar)scale.x(),(btScalar)pointInB.y()*(btScalar)scale.y(),(btScalar)pointInB.z()*(btScalar)scale.z());
btTransform tInA;
tInA.setIdentity();
tInA.setOrigin( pointInA );
btTransform tInB;
tInB.setIdentity();
tInB.setOrigin( pointInB );
btGeneric6DofConstraint *cons = new btGeneric6DofConstraint(*partA->getRigidBody(),*partB->getRigidBody(),tInA,tInB,false);
partA->getRigidBody()->setActivationState(DISABLE_DEACTIVATION);
partB->getRigidBody()->setActivationState(DISABLE_DEACTIVATION);
cons->enableFeedback(true);
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;
cons->setAngularLowerLimit(btVector3(0,0,0));
cons->setLinearLowerLimit(btVector3(0,0,0));
cons->setAngularUpperLimit(btVector3(0,0,0));
cons->setLinearLowerLimit(btVector3(0,0,0));
dynamicsWorld->addConstraint(cons,true); // true = allow collisions with linked objects
allConstraints.push_back(cons);
return cons;
}