Rigid Body Dynamics (III) Constraint-based Dynamics UNC Chapel Hill M. C. Lin Bodies intersect ! classify contacts Bodies separating – vrel > – No response required Colliding contact (Part I) – vrel < - Resting contact (Part II) – - < vrel < – Gradual contact forces avoid interpenetration – All resting contact forces must be computed and applied together because they can influence one another UNC Chapel Hill M. C. Lin Outline Algorithm overview Computing constrained accelerations Computing a frictional impulse Extensions - Discussion UNC Chapel Hill M. C. Lin Outline Algorithm overview Computing constrained accelerations Computing a frictional impulse Extensions - Discussion UNC Chapel Hill M. C. Lin Algorithm Overview UNC Chapel Hill M. C. Lin Algorithm Overview Two modules – Collision detection – Dynamics Calculator Two sub-modules for the dynamics calculator – Constrained motion computation (accelerations/forces) – Collision response computation (velocities/impulses) UNC Chapel Hill M. C. Lin Algorithm Overview Two modules – Collision detection – Dynamics Calculator Two sub-modules for the dynamics calculator – Constrained motion computation (accelerations/forces) – Collision response computation (velocities/impulses) Two kinds of constraints – Unilateral constraints (non-penetration constraints…) – Bilateral constraints (hinges, joints…) UNC Chapel Hill M. C. Lin Outline Algorithm overview Computing constrained accelerations Computing a frictional impulse Extensions - Discussion UNC Chapel Hill M. C. Lin Constrained accelerations Solving unilateral constraints is enough When vrel ~= 0 -- have resting contact All resting contact forces must be computed and applied together because they can influence one another UNC Chapel Hill M. C. Lin Constrained accelerations UNC Chapel Hill M. C. Lin Constrained accelerations Here we only deal with frictionless problems Two different approaches – Contact-space : the unknowns are located at the contact points – Motion-space : the unknowns are the object motions UNC Chapel Hill M. C. Lin Constrained accelerations Contact-space approach – Inter-penetration must be prevented – Forces can only be repulsive – Forces should become zero when the bodies start to separate – Normal accelerations depend linearly on normal forces This is a Linear Complementarity Problem UNC Chapel Hill M. C. Lin Constrained accelerations Motion-space approach – The unknowns are the objects’ accelerations Gauss’ principle of least contraints – “The objects’ constrained accelerations are the closest possible accelerations to their unconstrained ones” UNC Chapel Hill M. C. Lin Constrained accelerations Formally, the accelerations minimize the distance over the set of possible accelerations a is the acceleration of the system M is the mass matrix of the system UNC Chapel Hill M. C. Lin Constrained accelerations The set of possible accelerations is obtained from the non-penetration constraints This is a Projection problem UNC Chapel Hill M. C. Lin Constrained accelerations Example with a particle The particle’s unconstrained acceleration is projected on the set of possible accelerations (above the ground) UNC Chapel Hill M. C. Lin Constrained accelerations Both formulations are mathematically equivalent The motion space approach has several algorithmic advantages – J is better conditionned than A – J is always sparse, A can be dense – less storage required – no redundant computations UNC Chapel Hill M. C. Lin Outline Algorithm overview Computing constrained accelerations Computing a frictional impulse Extensions - Discussion UNC Chapel Hill M. C. Lin Computing a frictional impulse We consider -one- contact point only The problem is formulated in the collision coordinate system -j +j UNC Chapel Hill M. C. Lin Computing a frictional impulse Notations – v : the contact point velocity of body 1 relative to the contact point velocity of body 2 – vz : the normal component of v – vt : the tangential component of v – v̂ t : a unit vector in the direction of vt – fz and ft : the normal and tangential (frictional) components of force exerted by body 2 on body 1, respectively. UNC Chapel Hill M. C. Lin Computing a frictional impulse When two real bodies collide there is a period of deformation during which elastic energy is stored in the bodies followed by a period of restitution during which some of this energy is returned as kinetic energy and the bodies rebound of each other. UNC Chapel Hill M. C. Lin Computing a frictional impulse The collision occurs over a very small period of time: 0 tmc tf. tmc is the time of maximum compression vz UNC Chapel Hill vz is the relative normal velocity. (We used vrel before) M. C. Lin Computing a frictional impulse jz UNC Chapel Hill jz is the impulse magnitude in the normal direction. Wz is the work done in the normal direction. M. C. Lin Computing a frictional impulse v-=v(0), v0=v(tmc), v+=v(tf), vrel=vz Newton’s Empirical Impact Law: v z εv z Poisson’s Hypothesis: jz j0z εj0z jz (1 ε)j0z Stronge’s Hypothesis: Wz Wz0 ε 2 Wz0 Wz (1 ε 2 )Wz0 – Energy of the bodies does not increase when friction present UNC Chapel Hill M. C. Lin Computing a frictional impulse Sliding (dynamic) friction v t 0 ft μ fn vˆ t Dry (static) friction v t 0 ft μ fn Assume no rolling friction UNC Chapel Hill M. C. Lin Computing a frictional impulse 1 1 ~ ~ ~ ~ 1 1 Δv(t) 1 r1I1 r1 r2I2 r2 j(t) Kj(t) m1 m2 where: r = (p-x) is the vector from the center of mass to the contact point 0 ~r r z - ry UNC Chapel Hill - rz 0 rx ry - rx 0 M. C. Lin The K Matrix K is constant over the course of the collision, symmetric, and positive definite UNC Chapel Hill M. C. Lin Collision Functions Change variables from t to something else that is monotonically increasing during the collision: Δv( ) Kj( ) Let the duration of the collision 0. The functions v, j, W, all evolve over the compression and the restitution phases with respect to . UNC Chapel Hill M. C. Lin Collision Functions We only need to evolve vx, vy, vz, and Wz directly. The other variables can be computed from the results. (for example, j can be obtained by inverting K) UNC Chapel Hill M. C. Lin Sliding or Sticking? Sliding occurs when the relative tangential velocity v t 0 – Use the friction equation to formulate v t 0 ft μ fn vˆ t Sticking occurs otherwise – Is it stable or instable? – Which direction does the instability get resolved? UNC Chapel Hill M. C. Lin Sliding Formulation For the compression phase, use v z – v z is the relative normal velocity at the start of the collision (we know this) – At the end of the compression phase, v 0z 0 For the restitution phase, use Wz – Wz0 is the amount of work that has been done in the compression phase – From Stronge’s hypothesis, we know that Wz (1 ε 2 )Wz0 UNC Chapel Hill M. C. Lin Sliding Formulation Compression phase equations are: vx k xξ(θ) d 1 vy k yξ(θ) dv z k zξ(θ) Wz v z UNC Chapel Hill M. C. Lin Sliding Formulation Restitution phase equations are: v x k x ξ(θ) d 1 1 v y K ξ(θ) k y ξ(θ) dWz v z vz v z k zξ(θ) UNC Chapel Hill M. C. Lin Sliding Formulation where the sliding vector is: μv x 2 v2 v x y μcosθ μv y ξ(θ) μsinθ 2 2 vx vy 1 1 UNC Chapel Hill M. C. Lin Sliding Formulation These equations are based on the sliding mode v t 0 ft μ fn vˆ t Sometimes, sticking can occur during the integration UNC Chapel Hill M. C. Lin Sticking Formulation UNC Chapel Hill M. C. Lin Sticking Formulation Stable if 2 1 K13 2 1 K 23 μ2 2 1 K 33 – This means that static friction takes over for the rest of the collision and vx and vy remain 0 If instable, then in which direction do vx and vy leave the origin of the vx, vy plane? – There is an equation in terms of the elements of K which yields 4 roots. Of the 4 only 1 corresponds to a diverging ray – a valid direction for leaving instable sticking. UNC Chapel Hill M. C. Lin Impulse Based Experiment Platter rotating with high velocity with a ball sitting on it. Two classical models predict different behaviors for the ball. Experiment and impulse-based dynamics agree in that the ball rolls in circles of increasing radii until it rolls off the platter. Correct macroscopic behavior is demonstrated using the impulse-based contact model. UNC Chapel Hill M. C. Lin Outline Algorithm overview Computing constrained accelerations Computing a frictional impulse Extensions - Discussion UNC Chapel Hill M. C. Lin Extensions - Discussion Systems can be classified according to the frequency at which the dynamics calculator has to solve the dynamics sub-problems UNC Chapel Hill M. C. Lin Extensions - Discussion Systems can be classified according to the frequency at which the dynamics calculator has to solve the dynamics sub-problems It is tempting to generalize the solutions (fame !) – Lasting non-penetration constraints can be viewed as trains of micro-collisions, resolved by impulses – The LCP / projection problems can be applied to velocities and impulses UNC Chapel Hill M. C. Lin Extensions - Discussion Problems with micro-collisions – creeping : a block on a ramp can’t be stabilized UNC Chapel Hill M. C. Lin Extensions - Discussion Problems with micro-collisions – creeping : a block on a ramp can’t be stabilized UNC Chapel Hill M. C. Lin Extensions - Discussion Problems with micro-collisions – creeping : a block on a ramp can’t be stabilized – A hybrid system is required to handle bilateral constraints (non-trivial) UNC Chapel Hill M. C. Lin Extensions - Discussion Problems with micro-collisions – creeping : a block on a ramp can’t be stabilized – A hybrid system is required to handle bilateral constraints (non-trivial) – Objects stacks can’t be handled for more than three objects (in 1996), because numerous micro-collisions cause the simulation to grind to a halt UNC Chapel Hill M. C. Lin Extensions - Discussion Extending the LCP – accelerations are replaced by velocities – forces are replaced by impulses – constraints are expressed on velocities and forces z z v εv Problem : – constraints are expressed on velocities and forces (!) This can add energy to the system – Integrating Stronge’s hypothesis in this formulation ? UNC Chapel Hill M. C. Lin Extensions - Discussion Extending the projection problem – accelerations are replaced by velocities – constraints are expressed on velocities and forces z z v εv UNC Chapel Hill M. C. Lin Extensions - Discussion Extending the projection problem – accelerations are replaced by velocities – constraints are expressed on velocities z z v εv Problem : – constraints are expressed on velocities (!) – This can add energy to the system UNC Chapel Hill M. C. Lin