at the moment I develop a simulation for a humanoid robot, but i have a problem with the constraints.
I use the btGeneric6DofConstraint for all joints of my robot an set angular and linear Limits 0.
I set the CFM- and ERP-parameter with follow values:
linearStopERP = 0.6
linearStopCFM = 0.9
linearCFM = 0.9
angularStopERP = 0.6
angularStopCFM = 0.9
angularCFM = 0.9
Unfortunately, the joints bounce when the robot walk or hit on the ground. I tried to test some ERP-CFM-Configurations without a success. There are some pictures of my problem at the attachment and here a little demo video :
http://www.youtube.com/watch?v=aPJdQCXqWeU
Here some Code:
Code: Select all
btGeneric6DofConstraint * Robot::addbtGeneric6DofSpringConstraint (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 btGeneric6DofSpringConstraint(*partA->getRigidBody(),*partB->getRigidBody(),tInA,tInB,false);
partA->getRigidBody()->setActivationState(DISABLE_DEACTIVATION);
partB->getRigidBody()->setActivationState(DISABLE_DEACTIVATION);
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);
allConstraints.push_back(cons);
return cons;
}
Thanks,
Oliver