problems of hinges (error reduction parameters)

lovefoster
Posts: 3
Joined: Wed Dec 30, 2009 5:40 am

problems of hinges (error reduction parameters)

Post by lovefoster »

hi!

I set a hinge (hinge3) between crank(pbodyD) and link(pbodyC),just look at my uploaded figure.
1.JPG
As the simulation proceeds the joint will gradually "come apart".i have tried, but i could not solve this problem. In the past, i posted the problem in the forum linked "http://www.bulletphysics.org/Bullet/php ... f=9&t=4545"

my codes:
//construct the hinge joint:
btTransform frameInA, frameInB;
frameInA = btTransform::getIdentity();
frameInA.setOrigin(btVector3(btScalar(-0.2f), btScalar(0.), btScalar(0.05)));
frameInB = btTransform::getIdentity();
frameInB.setOrigin(btVector3(btScalar(0.1f), btScalar(0.), btScalar(-0.05)));
btGeneric6DofConstraint* pHinge3 = new btGeneric6DofConstraint(*pBodyC, *pBodyD, frameInA, frameInB, true);

pHinge3->setLinearLowerLimit(btVector3(0., 0., 0.));
pHinge3->setLinearUpperLimit(btVector3(0., 0., 0.));
pHinge3->setAngularLowerLimit(btVector3(0.f,0., 1));
pHinge3->setAngularUpperLimit(btVector3(0.f,0., 0));

pHinge3->getRotationalLimitMotor(1)->m_ERP=1.0;//whether it is similar as ode's erp
m_dynamicsWorld->addConstraint(pHinge3, true);
pHinge3->setDbgDrawSize(btScalar(5.f));

//Add the torque on the crank(pbodyD):
btVector3 m_fT(0.0,0.0,15.0);
pBodyD->applyTorque(m_fT);

//stepsimulation:
m_dynamicsWorld->stepSimulation(0.0005);

//results:
see my uploaded figure

Any body can help me!
thanks very much!

foster
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: problems of hinges (error reduction parameters)

Post by Erwin Coumans »

Can you reproduce this using the latest Bullet trunk (or at least SVN revision 1871, download zipfile from http://code.google.com/p/bullet/downloads/list) ?

If not, please modify the Bullet/Demos/ConstraintDemo/ConstraintDemo.cpp with a reproduction case.

Thanks a lot,
Erwin