I've implemented Featherstone's algorithm in 2D and I've observed some stability problems for multi-link pendulums at large angular velocities.
The case I'm using is identical to Demo 0 in Box2D: a 10-link pendulum starting with zero velocity, aligned with the horizontal axis. The pendulum swings down then folds over onto itself (no collision), then starts whipping around and shortly blows up.
My integrator is semi-implicit Euler:
qDot = qDot + dt * qDotDot
q = q + dt * qDot
I believe the instability is due to velocity-squared inertia forces. I can't remove the v-squared terms because they are necessary to get a plausible simulation.
Here are some solutions:
- clamp the joint's relative angular velocity and use damping.
- if the angular velocity is large then integrate the v-squared terms with sub-steps. This can be viewed as adaptive integration.
Has anyone ran into this problem? Are there any other tricks to deal with the instability?
Featherstone Stability
-
- Posts: 126
- Joined: Wed Jul 27, 2005 10:28 am
- Location: SCEE London
Re: Featherstone Stability
- increase inertiaErin Catto wrote:I've implemented Featherstone's algorithm in 2D and I've observed some stability problems for multi-link pendulums at large angular velocities.
The case I'm using is identical to Demo 0 in Box2D: a 10-link pendulum starting with zero velocity, aligned with the horizontal axis. The pendulum swings down then folds over onto itself (no collision), then starts whipping around and shortly blows up.
My integrator is semi-implicit Euler:
qDot = qDot + dt * qDotDot
q = q + dt * qDot
I believe the instability is due to velocity-squared inertia forces. I can't remove the v-squared terms because they are necessary to get a plausible simulation.
Here are some solutions:
- clamp the joint's relative angular velocity and use damping.
- if the angular velocity is large then integrate the v-squared terms with sub-steps. This can be viewed as adaptive integration.
Has anyone ran into this problem? Are there any other tricks to deal with the instability?
- add joint limits . This will definitely fix it
cheers,
Antonio
-
- Posts: 52
- Joined: Sat Oct 08, 2005 1:16 am
- Location: Itinerant
I had the same problem with Featherstone. Since the joints are stiff you end up with an effect like cracking a whip; in the demo you described. So the angular velocity for the last link in your chain gets really high. Semi-implicit Euler did not seem to be much better than Euler. I had good results with RK45 and Midpoint, but they are more expensive ( I can't recall if they were better than equivilant substeps of Euler or not ).
Adding joint damping helps. Most actual applications to constrained systems will have plenty of limits and collisions, so the stability in practice is not a problem.
Adding joint damping helps. Most actual applications to constrained systems will have plenty of limits and collisions, so the stability in practice is not a problem.