# Penalty Methods for Contact Resolution - PowerPoint PPT Presentation

1 / 20

Penalty Methods for Contact Resolution. interactive contact resolution that usually works pi david s wu. objective. Determine the force vector to ensure appropriate behavior for contacting objects or alternatively:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Penalty Methods for Contact Resolution

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

## Penalty Methods for Contact Resolution

interactive

contact resolution

that usually works

pi

david s wu

### objective

Determine the force vector to ensure appropriate behavior for contacting objects

or alternatively:

make the game do the right thing when objects collide with one another

- also make it work when they rest on one another

### customer requirements

Stability

Consistency

• Stability

• uncommon circumstances should not prevent further play

• Perceived accuracy

• behavior should appear correct

• Perceived precision or consistency

• known actions may be applied to produce consistent effect

• Performance

• avoid O(2n) complexity

• Iteration that never converges is not acceptable

• Stability

• really important

Customer

Satisfaction

Accuracy

Performance

### “what methods are there for solving the problem?”

• Apply impulses for collisions and forces for resting contact

• Solve using iterative constraints

• Declare collision resolution “beyond the scope of this simulator”

• Use Potentials that “encourage” appropriate behavior (penalty methods)

### “why penalty methods?”

• penalty methods are trivial to implement

• classic analytical methods have many degenerate configurations

• a lot of special cased code is required to ‘elegantly handle’ these

• penalty methods decay gracefully in awkward situations

• analytic methods tend to have worst case performance that is O(n!), O(2n), or O(n3)

• penalty methods extend robustly to more complex problems such as deformable representations such as FEM or FFD lattice

Doesn’t

explode

Few degenerate

cases

Tends to converge

### meeting the needs

• Penalty methods

• Stability

### “penalty methods are numerical hacks”

Before continuing, you will need to accept the following axioms:

• Penalty Methods are not all that bad

• They robustlysolve many difficult problems

• Implementation is intuitive

• Most physics researchers and programmers don’t trust penalty methods

• Most programmers who are about to write their first physics code will implement penalty methods, armed with their first year physics text

• Potential methods are not a good place to start, before you go off and throw arbitrary potentials at every problem you encounter, learn and understand the more established methods, these will specify the desired behavior for non-degenerate situations

### more persuasion

II. independence between numerical integration and contact resolution is a luxury

• combining the two can be justified

• solving the problems independently is the most most common implementation

• modular, independent components are nice, but in this case, they limit your potential methods for solution

### more persuasion

III. Implicit Euler is not a joke

• First order accuracy is really not all that bad

• provided that it is stable

• Stiff decay is a good thing

• when things get really nasty, diminishing high frequency components is desirable

• A-Stability is not just an inconsequential feature of obscure integration schemes

• Explicit integration schemes are not suitable for stiff systems

• No implicit or explicit multi-step methods are A-Stable

### implementation synopsis

• Each contact is classified as either a collision or a resting contact

• if (relative velocity * normal > [insert magic threshold] )

• collision

• otherwise,

• resting contact

• Two linear potentials are created. One acts along normal to repel objects, the other acts on the tangent plane to represent friction.

• nonlinear force along contact normal is approximated by a piecewise cubic spline

• Friction cone is approximated by a piecewise cubic patch

• ### Conventions (what do those obscure letters mean?)

• Scalar: lower case italic, e.g. ‘k’

• Vector: lower case e.g. ‘q’ vector

• Matrix: upper case e.g. ‘M’

• q = position

• q’ = velocity

• q’’ = acceleration

### more letters

• nf = unit vector along collision normal

• f = a vector constrained to the tangent plane

• sp = jacobian that projects the relative velocity contact point into the velocity space of the potential

• fn= contact normal reaction force

• ff= friction reaction force

### Equations

• Resting contact normal force:

• fn=L*(snt*kb+ksn*snt*q+kdn*snt*q’)

• Collision normal force:

• ksn is 0

• kdn is large

• in both cases:

• L is a piecewise cubic spline that smoothly interpolates (e.g. with continuity of G2)

• 0 when |f| <= 0

• 1 when |f| >= [insert magic threshold]

### continued

• Friction forces:

• ff = L * (q’ / |q’| *(k1 + k2*|q’| + k3*|q’|2) )

• L is a piecewise cubic spline that smoothly interpolates (e.g. with continuity of G2)

• 0 when |f| <= [insert small magic threshold]

• 1 when |f| >= [insert big magic threshold]

### “discontinuous potentials break my integrator”

• First and second derivatives w.r.t in q and q’ are continuous (due to the spline being C2), this should be sufficient for robust equation solvers)

• the numerical integration equation is nonlinear

(for Implicit Euler, q(t1) = q(t0) + [step size] * f(q(t1), t1))

• a technique that use a quadratic manifold to approximate equations will require multiple iterations (techniques such as Newton/Rhampson Iteration and Linear Conjugate Gradient)

• in my experience, Quasi-Newton and Nonlinear Conjugate Gradient are more effective

### Where do ksx, kdz, etc come from?

• Resting contact

• kdz = msz*p

• ksz = msz*sqr(p)/8.0

• Over damped, velocity half life of p

• Collision:

• kdzc = Msz*p

• p is very high, chosen such that 95% of desired velocity will be reached one after one step

### “kdz is too high”

• use a stable integrator

### “you are using potentials to emulate velocity constraints and impulses”

• With backward Euler integration, an impulse occurring at any point within a time step is equivalent to a force during the time step with an equal integral over the time step

• Solving the system: q(t1) = q(t0) + [step size] * f(q(t1), t1) handles over-determined systems gracefully

• Each potential is given an explicit priority

• Solution applies a weighted least square minimization to error