Peg In Hole
A two dimensional "peg in hole" program allowing you to manipulate the "peg" (red circle) and attempt to insert it into the hole (gap between green obsticles). There are also various physical properties you can adjust, along with a reset button if anything goes wrong.


Java 2 SE, v1.5

Important Note

This Java application relies on the PATH solver for solving the linear complementarity problem used in formulating the equations of motion. The application uses the Java Native Interface to load this library, and therefore is limited to run only on systems the solver is available for.  Currently, the PATH solver exists for Linux (x86 and AMD64), Windows (x86) and Solaris only, and therefore the above application will only work on those systems.

Things to Try

  1. While the Dynamics method is set to Stewart-Trinkle, no matter what you do the peg will never get into the hole.
  2. Set the method to Anitescu-Potra (increase the Time Step and gravity to make it even easier) and now you will be able to insert the peg into the hole if you can get it to drop fast enough.
  3. While using the Anitescu-Potra method, ram the circle into the horizontal surface of the green obstacle. The circle will penetrate the surface. Now switch to the Stewart-Trinkle method. The position level constraint stabilization kicks in, and the circle will "shoot" up due to the suddenly large constraint impulse being applied.

What's going on here?

The main point of this simple demonstration is to illustrate how various dynamics settings and models can have vastly different outcomes on the simulation. For this example, the diameter of the circle is slightly larger than the width of the insertion hole. Assuming a rigid body model, one would expect the peg can never be inserted into the hole. This fact is true while using the Stewart-Trinkle method, however, by choosing the Anitescu-Potra time stepping method and a large enough time-step it becomes possible to insert the circle into the hole! This is because the Anitescu-Potra method is enforcing the non-penetration constraint at the velocity level, whereas the Stewart-Trinkle method enforces it at the position level.

References

D.E. Stewart and J.C. Trinkle, "An Implicit Time-Stepping Scheme for Rigid Body Dynamics with Inelastic Collisions and Coulomb Friction," Int'l Jrnl. of Numerical Methods in Engineering, 39:2673-2691, 1996. pdf.

M. Anitescu and F.A. Potra, "Formulating Dynamic Multi-Rigid-Body Contact Problems with Friction as a Solvable Linear Complementarity Problem," Nonlinear Dynamics, 14,3:231-247, 1997. ps.

R.W. Cottle, J.-S. Pang, and R.E. Stone, "The linear complementarity problem," Academic PressBoston, 1992