my linked rigid bodies limp, how can I get joints locked

Post Reply
scrispin
Posts: 5
Joined: Fri Sep 02, 2016 2:11 am

my linked rigid bodies limp, how can I get joints locked

Post by scrispin »

I have an N by N grid of spherical rigid bodies that are all linked to their neighbors in a grid, four links per body to its neighbors

I'm dropping them on a sphere and the desired outcome I'd like is for the grid of linked bodies to behave as if it was one solid object, not to bend or deform to the spherical shape whatsoever.

I'm new to bullet and have been searching the manual/forms/ and made some progress but, I've tried nearly everything I can think of to get them stiff

each rigid body sphere has:

radius equal to half the distance between them
mass 0.1
restitution 0
friction 0.99

with 6DOF joints between them having settings as:

AngularLowerLimit (0,0,0)
AngularUpperLimit(0,0,0)
LinearLowerLimit(0,0,0)
LinearUpperLimit(0,0,0)
ConstraintForceMixing(0)
ErrorReduction(1)
disabled collisions between linked bodies

and it still behaves like some kind of odd sheet of rubber,

My real end goal is to simulate a wide range of plant leafs, like a piece of kale for example which has rigid segments and flexible segments. I thought I ought to make a linked plane that was absolutely rigid, and then back off from there. But I can't seem to achieve that.
Attachments
Screen Shot 2016-09-01 at 8.28.43 PM.png
Screen Shot 2016-09-01 at 8.28.43 PM.png (141.56 KiB) Viewed 9945 times
NickHardeman
Posts: 4
Joined: Sat Mar 14, 2015 4:03 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by NickHardeman »

Make sure not to set any of the following params:

Code: Select all

_joint->setParam(BT_CONSTRAINT_STOP_CFM,0.8,0);
	_joint->setParam(BT_CONSTRAINT_STOP_CFM,0.8,1);
	_joint->setParam(BT_CONSTRAINT_STOP_CFM,0.8,2);
	_joint->setParam(BT_CONSTRAINT_STOP_CFM,0.8,3);
	_joint->setParam(BT_CONSTRAINT_STOP_CFM,0.8,4);
	_joint->setParam(BT_CONSTRAINT_STOP_CFM,0.8,5);
	
	_joint->setParam(BT_CONSTRAINT_STOP_ERP,0.1,0);
	_joint->setParam(BT_CONSTRAINT_STOP_ERP,0.1,1);
	_joint->setParam(BT_CONSTRAINT_STOP_ERP,0.1,2);
	_joint->setParam(BT_CONSTRAINT_STOP_ERP,0.1,3);
	_joint->setParam(BT_CONSTRAINT_STOP_ERP,0.1,4);
	_joint->setParam(BT_CONSTRAINT_STOP_ERP,0.1,5);
and then setting the angular and linear limits should constrain the joint to a single axis. It is constrained by default.
scrispin
Posts: 5
Joined: Fri Sep 02, 2016 2:11 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by scrispin »

well I was setting those values

jointsA[jointsA.size()-1]->setConstraintForceMixing(0);
jointsA[jointsA.size()-1]->setErrorReduction(1);

because people recommended they would make it fixed

Setting these values to 0 and 1 make it much more rigid, commenting this code out makes the shape super soft

(anyone else reading this for context I'm using ofxBullet with openFrameworks)
Attachments
Screen Shot 2016-09-01 at 9.52.41 PM.png
Screen Shot 2016-09-01 at 9.52.41 PM.png (53.04 KiB) Viewed 9926 times
NickHardeman
Posts: 4
Joined: Sat Mar 14, 2015 4:03 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by NickHardeman »

All axes of a btGeneric6DofConstraint are supposed to be locked on construction. In ofxBullet, _setDefaults() is being called in the create function. If you try commenting out the _setDefaults and then set all of the limits after create and before calling add(), does that fix the issue?
scrispin
Posts: 5
Joined: Fri Sep 02, 2016 2:11 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by scrispin »

same results if I comment that out unfortunately,

also tried making the joints only locked on the Y axis as a test and thats not giving me anything either
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: my linked rigid bodies limp, how can I get joints locked

Post by drleviathan »

There is no way to achieve this using 6Dof's or even btFixedConstraint. You are using the btSequentialImpulseConstraintSolver because that is the only btConstraintSolver that Bullet currently has and as its name suggests it solves piles of constraints sequentially one at a time... because solving them correctly all at once requires too much CPU -- it can be done, but not in real-time, and Bullet is a real-time physics engine.

You'll get better results the fewer constraints you use but from my experience: beyond about 5 or 6 Fixed constraints in a single chain it gets noticeably soft. Cross buttressing across a regular grid could probably make larger mostly rigid structures, I'm not sure. I haven't experimented with so many rigid constraints in a regular grid but I have made a humanoid character with less than 20.

My advice if you pursue this project: use as few rigid bodies and constraints as possible. The most rigid parts should each just be one shape, use a btCompoundShape to get interesting parts but when you do this I suspect you'll have to make sure to compute reasonable inertia tensors -- when making constraints between differently sized pieces you need to get the mass properties right, and you can't have too large of ratios of masses (really big mass connected to really small mass --> bad idea) if you want the simulation to be stable.

If you must have the physics right and don't need real-time simulation then consider one of the non-real-time physics engines. I don't have any experience with them so I can't recommend a particular one but I did some online research a while ago and know there are a few.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: my linked rigid bodies limp, how can I get joints locked

Post by drleviathan »

Sorry, I misremembered my success at building a character with Fixed constraints (which it turns out are just 6Dofs with all degrees locked down). I found my old post about it and discovered that in order to get the stability I wanted I used custom verlet relaxation constraints.

Maybe you should be using soft-body dynamics?
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: my linked rigid bodies limp, how can I get joints locked

Post by benelot »

Check out the ExtendedTutorial examples, we provided one where we create a softbody tissue. Also it is easily possible to attach rigidbodies to the tissue, making it very similar to what you want to do.
scrispin
Posts: 5
Joined: Fri Sep 02, 2016 2:11 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by scrispin »

awesome thanks for the advice

Drlev - good to know its impossible, I like the idea of trying btCompoundShape ,


I had considered soft body dynamics maybe its time I take a second look at it
scrispin
Posts: 5
Joined: Fri Sep 02, 2016 2:11 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by scrispin »

benelot wrote:Check out the ExtendedTutorial examples, we provided one where we create a softbody tissue. Also it is easily possible to attach rigidbodies to the tissue, making it very similar to what you want to do.
I looked through all of the examples and didn't find what you were talking about, which one?
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: my linked rigid bodies limp, how can I get joints locked

Post by benelot »

It is in Extended Tutorials-> Simple Cloth

https://github.com/bulletphysics/bullet ... eCloth.cpp

In the SoftBody examples, I remember having seen one adding rigid bodies to the softbody surface.

Edit:

This function creates the example:

https://github.com/bulletphysics/bullet ... o.cpp#L565
hyyou
Posts: 96
Joined: Wed Mar 16, 2016 10:11 am

Re: my linked rigid bodies limp, how can I get joints locked

Post by hyyou »

@drleviathan, thank for the useful link to your thread.

Code: Select all

There is no way to achieve this using 6Dof's or even btFixedConstraint.
Is btFixedConstraint somehow stable than 6Dof? Why?
I always thought they were the same.
beyond about 5 or 6 Fixed constraints in a single chain it gets noticeably soft.
I agree, 64 constraints can make the whole chain explode.
But how scrispin can do that in OP? It seems nice and stable.
Is it because of 4-neighbour link hard to be unstable?
Post Reply