Ranking of Constraints

dkfdkf
Posts: 8
Joined: Mon Jul 16, 2007 10:25 pm

Ranking of Constraints

Post by dkfdkf »

Right now, in bullet, if I create a bunch of constraints; sometimes, they get violated, and I can't control the conditions under which they happen.

Is there anyway I can "rank" the constraints where I can be like: I want to make sure that "A" holds, then I want you to make sure that "B" holds if possible, and after that, do whatever you can to have "C" hold, ... ?

If not, what should I read up on / which areas of bullet should I hack so that I can choose how the constraints are violated?

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

Re: Ranking of Constraints

Post by Erwin Coumans »

Does your 'ranking' refer to the ordering in which the constaints are solved?

This is currently not supported. It should be fairly easy to add, just derive/modify src\BulletDynamics\ConstraintSolver\btSequentialImpulseConstraintSolver.cpp

Hope this helps,
Erwin
dkfdkf
Posts: 8
Joined: Mon Jul 16, 2007 10:25 pm

Re: Ranking of Constraints

Post by dkfdkf »

The constraints aren't solve perfectly right? I.e. some are always violated.

I want to be able to control which ones are less/more violated.

Does the solver satisfy the property that:
if I solve constraint C0 at time step t0 < t1
and I violate C0 with < epsilon
and I solve constraint C1 at time step t1
then the violation of constraint C0 won't become > epsilon?

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

Re: Ranking of Constraints

Post by Erwin Coumans »

By default, Bullet uses an iterative constraint solver to solve the MLCP, similar to many other physics engines.

It should converge towards a solution for typical constraints, but certain conditions make convergence slower (or prevent it). In particular large mass ratios (connecting a very light objects with very heavy), high angular velocities can cause problems.

Convergence for constraint solvers is [url=http://www.bulletphysics.com/Bullet/php ... =6&t=1644a hot topic[/url]. When you need very accurate results, a different solver based on a Featherstone approach or a direct/pivoting LCP solver might be better.

Can you reproduce the issue in a Bullet demo?
Thanks,
Erwin