constrained dynamics
play

Constrained dynamics Simple particle system In principle, you can - PowerPoint PPT Presentation

Constrained dynamics Simple particle system In principle, you can make just about anything out of spring systems In practice, you can make just about anything as long as its jello Hard constraints Constraint force


  1. Constrained dynamics

  2. Simple particle system • In principle, you can make just about anything out of spring systems � • In practice, you can make just about anything as long as it’s jello

  3. Hard constraints

  4. • Constraint force � • Single implicit constraint � • Multiple implicit constraint � • Parametric constraint � • Implementation

  5. A simple example A bead on a wire The bead can slide freely along the wire, but cannot come off no matter how hard you pull it. How do we simulate the motion of the bead when arbitrary forces applied to it?

  6. Penalty constraints • Why not use a spring to hold the bead on the wire? � • Problems: � • weak springs won’t do the job � • strong springs give you stiff systems

  7. First order world N In this world, f = m v f ˆ f N f What is the legal velocity? f ′ f T What is the legal force? ˆ Add constraint force to f cancel the illegal part of f f ′ = f + ˆ f f = − N · f ˆ N · NN

  8. The real world N f In the real world, f = m a v What is the legal acceleration? a depends on both and N v ˆ f ? the faster you’re going, the faster you have to turn ˆ Compute such that only f ′ f generates legal acceleration f ′ = f + ˆ f

  9. Constraint force • Need to compute constraint forces that cancel the illegal applied forces � • Which means we need to know what legal acceleration is

  10. • Constraint force � • Single implicit constraint � • Multiple implicit constraint � • Parametric constraint � • Implementation

  11. Constraints Implicit: C ( x ) = | x | − r = 0 x θ Parametric: r � cos θ � x = r sin θ

  12. Legal acceleration What is the legal position? C = 0 C ( x ) = 1 2 x · x − 1 ˙ 2 = 0 C = 0 ¨ C = 0 What is the legal velocity? ˙ C ( x ) = x · ˙ x = 0 What is the legal acceleration? ¨ C ( x ) = ¨ x · x + ˙ x · ˙ x = 0

  13. Legal conditions If we start with legal position C = 0 and velocity ˙ C = 0 ¨ C ( x ) = 0 C = 0 ˙ C ( x ) = 0 We need only ensure the legal acceleration ¨ C ( x ) = 0

  14. Constraint force Use the legal condition to compute the constraint force Rewrite the legal condition in a general form C ( x ) = ∂ ˙ C x + ∂ C ∂ C ¨ : constraint gradient ∂ x · ˙ ∂ x · ¨ x = 0 ∂ x x = f + ˆ f x with Substitute ¨ ¨ m C = ∂ ˙ ∂ x · f + ˆ C x + ∂ C f ¨ ∂ x · ˙ = 0 m ˙ ∂ C f = − ∂ C C ∂ x · ˆ ∂ x · f − m x ∂ x ˙

  15. Constraint force ˙ ∂ C f = − ∂ C C ∂ x · ˆ ∂ x · f − m x ∂ x ˙ How many variables do we have? Need one more condition to solve the constraint force

  16. Virtual work Constraint force is passive - no energy gain or loss T = 1 Kinetic energy of the system: 2 m ˙ x · ˙ x Virtual work done by and : ˆ ˙ x · ˆ f f T = ˙ x · m ¨ = ˙ x · f + ˙ f x Make sure does no work for every legal velocity: ˆ f x | ∂ C C ( x ) = ∂ C x · ˆ ˙ ∂ x · ˙ f = 0 , ∀ ˙ x = 0 ∂ x · ˙ ˙ x = 0

  17. Constraint force x | ∂ C x · ˆ ∂ x · ˙ f = 0 , ∀ ˙ x = 0 ˙ must point in the direction of ∂ C ˆ f ∂ x f = λ∂ C ˆ ∂ x ˙ ∂ C f = − ∂ C C ˆ ∂ x · ˆ Substituting for in f ∂ x · f − m x ∂ x ˙ ∂ x · f − m ∂ ˙ λ = − ∂ C C x ∂ x · ˙ ∂ C ∂ x · ∂ C ∂ x

  18. Two conditions • Legal acceleration � � ˙ ∂ C f = − ∂ C C ∂ x · ˆ ∂ x · f − m x ∂ x ˙ � • Principle of virtual work f = λ∂ C ˆ ∂ x

  19. The Bead Example N f C ( x ) = 1 2 x · x − 1 2 = 0 v f = λ∂ C ˆ ˆ f ? ∂ x ∂ x · f − m ∂ ˙ λ = − ∂ C C x ∂ x · ˙ ∂ C ∂ x · ∂ C ∂ x

  20. Quiz x = (0 , − 2) C ( x ) = 1 2 x · x − 1 2 r 2 x = ( − 4 , 0) ˙ m = 10 kg g = (0 , − 9 . 8) f = λ∂ C r = 2 ˆ ∂ x ∂ x · f − m ∂ ˙ λ = − ∂ C C x ∂ x · ˙ ∂ C ∂ x · ∂ C ∂ x What is the constraint force at the current state?

  21. Feedback • In principle, ensuring legal acceleration can keep the particle exactly on the circle � • In practice, two problems cause the particle to drift � • numerical errors can accumulate when the ODE is not solved exactly � • constraints might not be met initially

  22. Feedback • A feedback term handles both problems: C = − k s C − k d ˙ ¨ C instead of ¨ C = 0

  23. Quiz What is the new formula for lambda after adding the feedback term? C = − k s C − k d ˙ ¨ C ∂ x · f − m ∂ ˙ λ = − ∂ C C x ∂ x · ˙ ∂ C ∂ x · ∂ C ∂ x

  24. • Constraint force � • Single implicit constraint � • Multiple implicit constraint � • Parametric constraint � • Implementation

  25. Tinkertoys • Now we know how to simulate a bead on a wire � • Apply the simple idea, we can create a constrained particle system

  26. Constrained particles • Particles: each particle represents a point in the phase space � • Forces: each force affects the acceleration of certain particles � • Constraints: Each is a function C i ( x 1 , x 2 , . . . ) Legal state: C i ( x 1 , x 2 , . . . ) = 0 , ∀ i Constraint force: linear combination of constraint gradients ∂ C i ∂ x , ∀ i

  27. Constraint gradients Normal of C 1 : ∂ C 1 ∂ x Normal of C 2 : ∂ C 2 ∂ x Legal states: the intersection of two planes Normal of the legal states: ∂ C 1 ∂ C 2 λ 1 ∂ x + λ 2 ∂ x

  28. Implicit constraint • Each constraint is represented by an implicit function � • What does the normal of a hypersurface mean? The direction where the particle is not allowed to move � • What does the intersection of the hypersurface represent? Legal state � • The constraint force lies in the space spanned by the normals of constraints

  29. Particle system notations General 3D case Q W q 1 f 1 x 1 I q : 3 n long position vector 1 m 1 x 2 f 2 I m 2 ... Q : 3 n long force vector . . . : 3 n 3 n inverse mass matrix W × 1 I f n x n m n

  30. Constraint notations Additional notations ˙ λ J J ∂ ˙ ∂ ˙ ∂ ˙ ∂ C 1 ∂ C 1 ∂ C 1 C 1 C 1 C 1 λ 1 ∂ q 1 ∂ q 2 ∂ q 3 n ∂ q 1 ∂ q 2 ∂ q 3 n λ 2 ∂ ˙ ∂ C 2 C 2 ∂ q 1 ∂ q 1 ... ... ∂ ˙ ∂ C m C m λ m ∂ q 3 n ∂ q 3 n λ : m Lagrangian multipliers J : m 3n Jacobian matrix × J : time derivative of Jacobian matrix ˙

  31. Constraint equations C = ∂ ˙ C x + ∂ C C = ˙ ¨ ¨ J ˙ q + J ¨ q ∂ x · ˙ ∂ x · ¨ x C = ∂ ˙ ∂ x · f + ˆ C x + ∂ C f C = ˙ ¨ q + JW ( Q + ˆ ¨ J ˙ Q ) = 0 ∂ x · ˙ = 0 m ˙ ∂ C f = − ∂ C C JW ˆ Q = − ˙ ∂ x · ˆ J ˙ q − JWQ ∂ x · f − m x ∂ x ˙ ˙ ∂ C ∂ x · λ∂ C ∂ x = − ∂ C C JWJ T λ = − ˙ J ˙ q − JWQ ∂ x · f − m x ∂ x ˙

  32. Multiple force constraints To solve for force constraints, we need to solve for this linear system JWJ T λ = − ˙ J ˙ q − JWQ One nice property of is that it is symmetric JWJ T positive definite matrix Can you prove that? Once the linear system has been solved, the vector is λ multiplied by to produce the global constraint force J T vector ˆ Q

  33. Impress your friends • The requirement that constraints not add or remove energy is called the Principle of Virtual Work � • The λ ’ s are called Lagrangain Multipliers � • The derivative matrix J is called the Jacobian Matrix

  34. Quiz C ( x 1 , x 2 ) = 1 2( x 1 − x 2 ) · ( x 1 − x 2 ) − 1 2 d 2 Can you write down the formula of the Jacobian of this constraint?

  35. • Constraint force � • Single implicit constraint � • Multiple implicit constraint � • Parametric constraint � • Implementation

  36. Constraints Implicit: C ( x ) = | x | − r = 0 x θ Parametric: r � cos θ � x = r sin θ

  37. Parametric constraints � cos θ � x = r sin θ f x Constraint is always met exactly θ r 1 degree of freedom: ¨ Solve for θ

  38. First order world In this world, f = m v N x = f + ˆ f ˙ x m T = ∂ x x = T ˙ ˙ θ ∂θ θ θ = f + ˆ f T ˙ m ˆ θ = T · f f f = λ∂ C T · T ˙ ˆ m + T · ∂ x = λ N m T · f θ = 1 ˙ T · T m

  39. The real world In the real world, f = m a N T = ∂ x x = T ˙ ˙ θ x ∂θ θ = f + ˆ f x = ˙ T ˙ θ + T ¨ ¨ m θ ˆ θ = T · f f T · ˙ T ˙ θ + T · T ¨ m + T · m T ˙ m − T · ˙ θ = T · f θ ¨ T · T

  40. Particle system notations General 2D case Q M q : 2 n long position vector q u m 1 I f 1 θ 1 x 1 θ 2 f 2 x 2 m 2 I : n long parameter vector u . . ... . . . . Q : 2 n long force vector . . . : 2 n by 2 n mass matrix M θ n f n m n I x n

  41. Constraint notations Additional notations ˙ J J ∂ q 1 ∂ q 1 ∂ ˙ ∂ ˙ q 1 q 1 ∂ u 1 ∂ u n ∂ u 1 ∂ u n ∂ q 2 ∂ ˙ q 2 ∂ u 1 ∂ u 1 J : 2n by n Jacobian matrix ... ... J : time derivative of J ˙ ∂ q 2 n ∂ q 2 n ∂ ˙ ∂ ˙ q 2 n q 2 n ∂ u 1 ∂ u n ∂ u 1 ∂ u n

  42. Constraint equations θ = f + ˆ f q = M ( ˙ u ) = Q + ˆ T ˙ θ + T ¨ x = ˙ J ˙ u + J ¨ M ¨ Q ¨ m θ = T · f J T M ( ˙ u ) = J T Q T · ˙ T ˙ θ + T · T ¨ J ˙ u + J ¨ m m − T · ˙ T ˙ θ = T · f θ J T MJ ¨ u = − J T M ˙ u + J T Q ¨ J ˙ T · T T = ∂ x J = ∂ q where where ∂θ ∂ u

Recommend


More recommend