Solving collisions and constraints, causes unwanted movement

Post Reply
eplk
Posts: 8
Joined: Wed Jul 29, 2015 9:37 pm

Solving collisions and constraints, causes unwanted movement

Post by eplk »

I have a system of three dynamic bodies: A, B and C. Both A and C are connected to B with hinge constraints. Collisions between connected bodies are turned off, but A and C can collide. Now when I set the motor targets of both constraints to a position in which they do collide, the solving of the collision and the constraints, causes a resulting force on the system (ABC) as a whole.
In certain configurations of the bodies and with reasonably high max motor force, this resulting force can become so large that even though none of the bodies appear to move relative to each other, the whole system starts tumbling over itself uncontrollably.
Any ideas on how to solve that problem without sacrificing the configuration of the bodies/constraints and motor force?
amatic
Posts: 13
Joined: Sun Oct 25, 2015 10:17 am

Re: Solving collisions and constraints, causes unwanted move

Post by amatic »

Did you try a different constraint solver?

Maybe something like this would help:

Code: Select all

m_constraintSolver = new btMLCPSolver(new btDantzigSolver());
I don't have a deep understanding of these things yet, but changing the solver and reducing simulation timestep seemed to have helped.
eplk
Posts: 8
Joined: Wed Jul 29, 2015 9:37 pm

Re: Solving collisions and constraints, causes unwanted move

Post by eplk »

Thanks for the suggestion! Are these solvers supposed to be interchangeable? Do they all support all the shapes/constraints etc.? When I try to use any other than the standard one, I get an exception somewhere in the step function.. I'll see if I can track down the problem. In the mean time, is there any documentation on these other solvers? Where can I learn more about them?
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Solving collisions and constraints, causes unwanted move

Post by Basroil »

eplk wrote:Thanks for the suggestion! Are these solvers supposed to be interchangeable? Do they all support all the shapes/constraints etc.? When I try to use any other than the standard one, I get an exception somewhere in the step function.. I'll see if I can track down the problem. In the mean time, is there any documentation on these other solvers? Where can I learn more about them?
Other than multibody/featherstone, yes, they are "interchangeable", but can have wildly different performance.

Usually constraint issues can be solved by three things:
1) Increasing simulation frequency (smaller timesteps)
2) Increasing iterations (for iterative solvers)
3) Changing solvers

That is of course given that the constraints are valid in the first place.
Post Reply