[ODE] Possible solution to unstable rotating bodies problem
hplus-ode at mindcontrol.org
Thu Apr 7 14:21:30 MST 2005
> - Maybe damping is enough to work around this problem. I strongly prefer
> solutions to workarounds though, as I believe most people do.
We are engineers, not perfectionists. Penetration-based penalty methods
are a big hack -- you want continuous collision detection systems if you
want perfection. Rigid body simulation is a hack -- you want to account
for non-rigid bodies. Meanwhile, we find that, by making lots of hacky,
simplifying assumptions, we can create a system that, when treated
correctly, hands us back results that are useful, using an acceptable
amount of machine resources.
You will never get perfection out of any simulation or engineered system.
My argument is that the cost/benefit ratio of your proposed solution is
not up to snuff: the cost (in cycles and memory) is too much for the very
Trying to argue that some specific behavior needs a solution, without
considering the full context, is something that a lot of computer science
professors, and recent graduates, do. I've found that after a few years
actually doing real software engineering, most people realize how
pointless and downright costly such an attitude (when taken to the
extreme) is. You can make the argument that the benefit is great, and that
the cost in space and cycles is thus worth it, but I haven't yet heard
something that convinces me that that argument is true; the only argument
I hear is "it's against my religion about what's the right way to skin a
cat." I'm a tad sensitive to that particular argument.
Or, to put it another way: If there's a real problem, that can't be solved
using existing wheels, then I'm willing to examine plans for new wheels.
> - I do not belive that there are "numerical problems inherent in this kind
> of simulation". In fact the "isolated rigid body spinning in space" problem
> has a simple closed form solution. I believe other special cases do as well
> (I'm thinking "spinning top" in particular here).
Yes, it has a closed form solution -- but not within the context of an
LCP solver, which is what we're dealing with here.
As soon as that space station has other things to interact with, there also
suddenly isn't a closed-form solution, so you have to deal with that anyway.
If you can never interact with the body at all, why are you simulating it in
the first place?
> What's the solution for a guy who wants, say, his space station to slowly
> spin forever?
Use an amotor between the static world and the space station. The amotor
will make sure the space station spins at exactly the right speed, by
applying torque or counter-torque as necessary.
> Explicitly enforcing conservation of momentum/energy would solve it
You _can't_ get that perfect within the context of an LCP solver, because
of the way the floating point maths work out. In fact, the solver TRIES
to conserve momentum, but because of the way the solver works, you get
some variation. It _may_ be the case that there's some deep bug inside
the solver that makes this problem much more visible than it should be,
and if so, we should go looking for that bug.
> "how can we enforce conservation of
> momentum/energy?", with sub-questions like, "how do we do it with minimum or
> even positve impact on runtime and/or memory?", "If it does have any
The solver already does as good as it can. My argument is that it's good
enough for all reasonable uses of an approximation like a time-stepped
penalty-based rigid-body simulation. The fact that you allow penetration
between supposedly fully rigid bodies is a rather bigger source of error
in most cases; if you want to fix the big problems, I suggest you start
As you say, this is all just talk (although it's possibly formative talk).
Meanwhile, I see someone submitted a patch that uses LESS cycles and makes
it more stable, although it makes the simulation even more of a hack. I'd
be more inclined towards that solution, if I could be convinced that
rotational stability really was bad enough to be a problem. (As if my
endorsement counted for anything, anyway :-)
More information about the ODE