Constraits to fix the joints

Post Reply
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Constraits to fix the joints

Post by CarinaCruz »

Hello I'm trying to build a hand with joints using the code below

btGeneric6DofConstraint * joint6DOF;

btTransform indicadorBase, palma;
/* IndicadorBase - Palma */
indicadorBase.getBasis().setEulerZYX(0, SIMD_HALF_PI, 0);
palma.setOrigin(btVector3(5, 22, btScalar(0.)));
joint6DOF = new btGeneric6DofConstraint (*bodyIndicadorBase, *bodyPalma, indicadorBase, palma,useLinearReferenceFrameA);
m_joints[0] = joint6DOF;
m_dynamicsWorld->addConstraint(m_joints[0], false);

but when I move a finger, the three parts that make up this finger, move independently of the movement. There is a way to fix these joints for moving together? Or I am using the wrong constraint?

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

Re: Constraits to fix the joints

Post by Erwin Coumans »

By default, all constraints are free in the 6dof constraint.

setAngularLowerLimit(btVector3(0,0,0));
setAngularUpperLimit(btVector3(0,0,0));
setLinearLowerLimit(btVector3(0,0,0));
setLinearUpperLimit(btVector3(0,0,0));

You can also use the btFixedConstraint instead. It is derived from :btGeneric6DofSpring2Constraint
(note the 'Spring2' part, this constraint will replace btGeneric6DofConstraint.
(assuming you are using Bullet 2.83 or later)
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Re: Constraits to fix the joints

Post by CarinaCruz »

Hi Erwin! Thansk for the answer!

Changing the code to add what you pointed me I got the error: MyApp.exe has triggered a breakpoint in line btAssert(fsum > SIMD_EPSILON); of btSequentialImpulseConstraintSolver... The same error i got with other attempts to constraints...


Why this error happens?

Thak you very much
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Constraits to fix the joints

Post by Basroil »

Sounds like your joint is exploding, either bodies attached to it are too different (100000:1 ratio), you have dynamic redundancy (closed chains), or some settings that don't work well with your solver parameters. Are you having the fingers press up against each other?

As for hand joints, fingers are for the most part 1DoF hinge joints (even the thumb, since the axis of rotation is slightly offset), and it's usually easier to use hinge joints than 6dof.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Constraits to fix the joints

Post by Erwin Coumans »

CarinaCruz wrote: Changing the code to add what you pointed me I got the error: MyApp.exe has triggered a breakpoint in line btAssert(fsum > SIMD_EPSILON); of btSequentialImpulseConstraintSolver... The same error i got with other attempts to constraints...
Please re-create the issue by modifying one of the Bullet examples, such as the Bullet/examples/Constraints/ConstraintDemo or Bullet/examples/Constraints/Dof6Spring2Setup.cpp
Then you can attached the zipped source file to this forum topic, hopefully someone can look at it.
Thanks,
Erwin
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Re: Constraits to fix the joints

Post by CarinaCruz »

Hi Basroil

For every constraint different of 6DOF this error happens...

Its so very strange....

Thanks for the answers!


Erwin i'll do this!
Thanks!
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Re: Constraits to fix the joints

Post by CarinaCruz »

I managed to create together with btHingeConstraint,but the joints are rotating all the time (as shown in Figure 1). And when I add rotation values on the fingers (with data received from a data glove) parts of the fingers come off the hand and go "flying" the environment (as shown in Figure 2).

This is an example of the joints implementation:

Code: Select all

 indicadorBase.getBasis().setEulerZYX(0, SIMD_HALF_PI, 0);
	palma.setOrigin(btVector3(5, 22, btScalar(0.)));
	hingeC = new btHingeConstraint(*m_bodies[INDICADOR_BASE], *m_bodies[PALMA], indicadorBase, palma);
	m_joints[JOINT_PALMA_INDICADOR] = hingeC;
	m_dynamicsWorld->addConstraint(m_joints[JOINT_PALMA_INDICADOR], true);
 
Anyone can help me with this?
Attachments
ProblemaHinge.png
ProblemaHinge.png (6.75 KiB) Viewed 5330 times
ProblemaHinge2.png
ProblemaHinge2.png (4.88 KiB) Viewed 5330 times
Post Reply