Greetings,
I have the beginnings of a constraint based engine and when i started to do some performance tweaks, some questions arose. My constraint solver uses the JWJt * lamba = f formula and solves the LCP with a conjugate gradient algorithm. My performance tweaks consist of changing the step value and tolerance of the CG solver, among other things. However, my tests have been a bit inconclusive. Changing the values by trial and error isn't helping and so I was wondering which functions of the system are the most lossy? To be more specific, what are the most error prone functions for floats? My thinking is that if i locate the more inaccurate functions, i could improve them so that I can take bigger steps. If the answer is implementation dependent, then maybe some general rules of thumb for float arithmetic.
Another reason my results are inconclusive is that I'm not sure how well my solver *should* be performing. What is a good step size for a constraint solver? ( or any engine for that matter ) How much does stabilization account for before skewing results? Right now I'm doing my tests without any stabilization so that I reduce the number of variables. Perhaps I'm foolish for thinking a non-stabilized solver can handle 0.01s time steps for more than 100k steps.
Thanks, all comments are appreciated,
Bilbert
Accuracy of Constraint based engines
-
- Posts: 861
- Joined: Sun Jul 03, 2005 4:06 pm
- Location: Kirkland, WA
Re: Accuracy of Constraint based engines
1) How do you handle contacts and friction when using the CG solver or do you use a projected CG? Actually you have to solve a boxed LCP for constrained rigid body dynamics with friction and not a linear system as you stated here.
2) Why not use Baumgarte stabilization? I don't see why this should add aditional variables. It just changes the right had side of the system to solve.
An iterative Gauss-Seidel like solver should run stable at 4-8 iterations with gravity 10 at 60 Hz. Maybe a little more iterations for very long chains or large articulated structures (16 - 32). This should be the basic setup. Still the solver should give reasonable results and not explode at 15-30 Hz even with larger gravities like e.g. 20 - 30. The solver should also not be limited to a maximum number of time steps.
The most problematic issues for the solver are high angular velocities coupled with the linearization of the position constraint when using e.g. Baumgarte stabilization.
2) Why not use Baumgarte stabilization? I don't see why this should add aditional variables. It just changes the right had side of the system to solve.
An iterative Gauss-Seidel like solver should run stable at 4-8 iterations with gravity 10 at 60 Hz. Maybe a little more iterations for very long chains or large articulated structures (16 - 32). This should be the basic setup. Still the solver should give reasonable results and not explode at 15-30 Hz even with larger gravities like e.g. 20 - 30. The solver should also not be limited to a maximum number of time steps.
The most problematic issues for the solver are high angular velocities coupled with the linearization of the position constraint when using e.g. Baumgarte stabilization.
-
- Posts: 11
- Joined: Sun Feb 10, 2008 5:12 am
Re: Accuracy of Constraint based engines
Right now, I'm not doing any contact or friction. Gonna jump that hurdle when I get there. My simulation is a number of bars connected head to tail with ball and socket joints, basically forming a rope. I'm varying the number of segments, step size, and CG tolerance, and then reviewing the performance.
I am going to use Baumgarte stabilization(or something better?), but first I wanted to minimize the error in my solver before I stabilize. When I said limit the variables, I meant limit the number of variables that would affect stability and thereby any results i get would be purely solver.
From the numbers you provide, it seems my results are a right on match. When I set my step size to 0.015s(~60Hz), I get about 10 iterations before I get noticeable error. Good to hear =D
Thanks,
Bilbert
I am going to use Baumgarte stabilization(or something better?), but first I wanted to minimize the error in my solver before I stabilize. When I said limit the variables, I meant limit the number of variables that would affect stability and thereby any results i get would be purely solver.
From the numbers you provide, it seems my results are a right on match. When I set my step size to 0.015s(~60Hz), I get about 10 iterations before I get noticeable error. Good to hear =D
Thanks,
Bilbert