Constrained rigid body Detect collision simulation Compute - - PowerPoint PPT Presentation

constrained rigid body
SMART_READER_LITE
LIVE PREVIEW

Constrained rigid body Detect collision simulation Compute - - PowerPoint PPT Presentation

constraints Constrained rigid body Detect collision simulation Compute velocity change for colliding contact Compute contact forces when rigid bodies are in resting contact Bisection Collision detection Determine when the collision occurs


slide-1
SLIDE 1

Constrained rigid body simulation

constraints

Detect collision Compute velocity change for colliding contact Compute contact forces when rigid bodies are in resting contact

Collision detection

Determine when the collision occurs within a numerical tolerance Determine all pairs of bounding boxes that overlap Further check contact points between rigid bodies defined as convex polyhedra

Bisection

Y(t0) Y(t0 + ∆t) Y(t0 + 1 2∆t) Y(tc)

slide-2
SLIDE 2

Bounding boxes

Use bounding boxes to reduce the number of pairwise collision/contact determinations

If two bounding boxes have no overlap, no further comparisons are needed Determining all pairs of boxes that overlap can be done in time O(nlogd-2n+k) for d-dimensional bounding boxes Coherence can substantially improve the performance

Bounding boxes

Each bounding box i can be described as an interval (bi, ei) Find all pairs of interval that intersect

All the bi and ei are sorted from lowest to highest in a list Maintain an active list which is initially empty Whenever bi is encountered, all intervals on the active list are output as overlapping with i, and i is added to the list

Bounding boxes

Sweep and sort algorithm

I1 I2 I3 I4 I5 I6

b3 b5 b1 e5 e1 b6 b2 e3 b4 e6 e4 e2

Bounding boxes

We only need to do a full sort and sweep initially

What is the cost of the sorting process?

Subsequent comparisons can be improved by utilizing coherence

What is best sorting algorithm for a nearly sorted list?

slide-3
SLIDE 3

Convex polyhedra

Two polyhedra do not inter-penetrate if and only if a separating plane between them exists

Separating plane

Convex polyhedra

Separating plane

Check all possible edges or faces to find a separating plane at the very first time step of simulation or the first time two rigid bodies become close enough to require more than a bounding box test

Convex polyhedra

Defining face

Utilize coherence by caching defining faces or defining edges

Y(t0)

Defining face

Y(t0 + ∆t)

Convex polyhedra

Defining face Defining face

The defining face no longer separate the polyhedra and a new separating plane must be found If no separating plane is found, an inter-penetration has occurred at some earlier time The simulator must back up until the collision time is determined

slide-4
SLIDE 4

Contact points

Once we determine which bodies contact, we also need to determine the exact contact points We consider two types of contacts

vertex/faces edge/edge

Contact points

4 vertex/face 2 vertex/face 2 edge/edge

Contact points

A B A B

ˆ n ˆ n

pa(t) pb(t)

Although pa(t) and pb(t) are coincident at time tc, the velocity of the two points may be different

pa(tc) pb(tc)

Velocity of the contact point

vr = ˆ n(tc) · ( ˙ pa(tc) − ˙ pb(tc)) A B

ˆ n pa pb

˙ pb(tc) = vb(tc) + ωb(tc) × (pb(tc) − xb(tc)) ˙ pa(tc) = va(tc) + ωa(tc) × (pa(tc) − xa(tc))

This quantity gives the component of the relative velocity in the normal direction

slide-5
SLIDE 5

Velocity of the contact point

vr = 0 vr > 0 vr < 0

A B

˙ pa(tc) − ˙ pb(tc) ˆ n

Separation

A B

˙ pa(tc) − ˙ pb(tc) ˆ n

Resting contact

A B

˙ pa(tc) − ˙ pb(tc) ˆ n

Colliding contact

Collision process

no force no force

∆t

Impulse:

  • fdt = J = M∆v

A soft collision

Force Velocity

∆t

A harder collision

Force Velocity

∆t

slide-6
SLIDE 6

∆t = 0

An infinitely hard collision

Force Velocity

fimp = ∞ fimp∆t = J

Impulse and impulsive tor que

In the rigid body world, we want velocity to chance instantaneously

use impulse to change velocity instead of force J = P = M v

If the impulse acts on a point p, then just as a force produces a torque, J produces an impulsive torque

imp = (p - x(t)) J impulsive torque gives rise to a change in angular momentum: imp = L = I(tc) (tc)

Colliding contact

A B

ˆ n jˆ n

When two bodies collide, we apply an impulse between them to change their velocity For frictionless bodies, the direction of the impulse will be in the normal direction ˆ n(tc)

J = jˆ n(tc)

Body A is subject to this impulse J, while body B is subject to an equal but

  • pposite impulse -J

Colliding contact

A B

ˆ n

A B

ˆ n ˙ p+

a (tc) − ˙

p+

b (tc)

˙ p−

a (tc) − ˙

p−

b (tc)

jˆ n

Relative velocity before and after the application of the impulse To solve for j, we need one more piece of information If we can solve for j, we then can compute the linear velocity of the rigid body after the collision

before collision after collision

v−

r = ˆ

n(tc) · ( ˙ p−

a (t0) − ˙

p−

b (t0))

v+

r = ˆ

n(tc) · ( ˙ p+

a (t0) − ˙

p+

b (t0))

slide-7
SLIDE 7

The empirical law

Coefficient of restitution: A B

ˆ n V −

r

= 0 = 1 = 0.5

= 0 = 1

Perfect bounce Resting contact

v+

r = −v− r

compute the impulse

Now we are ready so solve for the impulse Let’s first define the displacements from center of mass of the body rb = pb(tc) − xb(tc) ra = pa(tc) − xa(tc) and The pre-impulse velocity of pa: The post-impulse velocity of pa: ˙ p+

a = v+ a (tc) + ω+ a (tc) × ra

˙ p−

a = v− a (tc) + ω− a (tc) × ra

Replace with in v+

a (tc)

v+

a (tc) = v− a (tc) + jˆ

n(tc) Ma ˙ p+

a (tc)

ω+

a (tc) = ω− a (tc) + I−1(tc)(ra × jˆ

n(tc)) ω+

a (tc)

Replace with in ˙ p+

a (tc)

compute the impulse

˙ p+

b (tc) = ˙

p−

b + j

ˆ n(tc) Mb + (I−1

b (tc)(rb × ˆ

n(tc))) × rb

  • ˙

p+

a (tc) = ˙

p−

a + j

ˆ n(tc) Ma + (I−1

a (tc)(ra × ˆ

n(tc))) × ra

  • v+

r = ˆ

n(tc) · ( ˙ p+

a (tc) − ˙

p+

b (tc))

ˆ n(tc) · (I−1

b (tc)(rb × ˆ

n(tc))) × rb) = ˆ n(tc) · ( ˙ p−

a (tc) − ˙

p−

b (tc)) + j( 1

Ma + 1 Mb + ˆ n(tc) · (I−1

a (tc)(ra × ˆ

n(tc))) × ra+ = v−

r +j( 1

Ma + 1 Mb +ˆ n(tc)·(I−1

a (tc)(ra׈

n(tc)))×ra+ˆ n(tc)·(I−1

b (tc)(rb׈

n(tc)))×rb) v−

r +j( 1

Ma + 1 Mb +ˆ n(tc)·(I−1

a (tc)(ra׈

n(tc)))×ra+ˆ n(tc)·(I−1

b (tc)(rb׈

n(tc)))×rb) = −v−

r

compute the impulse

j = −(1 + )v−

r 1 Ma + 1 Mb + ˆ

n(tc) · (I−1

a (tc)(ra × ˆ

n(tc))) × ra + ˆ n(tc) · (I−1

b (tc)(rb × ˆ

n(tc))) × rb)

Now we can compute the impulse and impulsive torque for body A and B Finally, apply the change in linear momentum and angular momentum to the current state L(tc + h) = L(tc) + τimp P(tc + h) = P(tc) + J J = jˆ n(tc) τimp = ra × J

A: B:

τimp = rb × J J = −jˆ n(tc)

slide-8
SLIDE 8

Resting contact

In this case, all n contact points have the zero relative velocity At each contact point there is some force , where fi is an unknown scalar Our goal is to determine what each fi is and all the fi’s must be determined at the same time

fiˆ n(tc)

Resting contact

In the case of colliding contact, we established the relation between the velocity of the contact points and j, subject to the empirical law For resting contact, we will establish the relation between acceleration of the contact points and fi’s subject to three conditions

Non-penetration

di(t) = ˆ ni(t) · (pa(t) − pa(t))

A B

ˆ n pa(t) pb(t)

di(t) = 0

B

ˆ n pb(t)

A

pa(t)

di(t) < 0

A B

ˆ n pa(t) pb(t)

di(t) > 0

This is what we want to avoid

Non-penetration

Since , we have to keep from decreasing; that is, we have to keep di(tc) = 0 di(tc) ˙ di(tc) ≥ 0 ˙ di(t) = ˙ ˆ ni(t) · (pa(t) − pb(t)) + ˆ ni · ( ˙ pa(t) − ˙ pb(t)) At time tc, pa(tc) = pb(tc) This means that The definition of two bodies in resting contact: di(tc) = ˙ di(tc) = 0 ˙ di(tc) = vr

slide-9
SLIDE 9

Non-penetration

Since describes the separation distance and describes the separation velocity, measures how two bodies are accelerating towards each other at the contact point ˙ di(tc) di(tc) ¨ di(tc) If ,the bodies have an acceleration towards each other and the penetration will occur ¨ di(tc) < 0 Therefore, the first condition is

¨ di(tc) ≥ 0

Repulsive force

The contact forces can push bodies apart, but can never act like “glue” and hold bodies together Therefore, each contact force must act outward fi ≥ 0

Workless force

The contact force at the a contact point becomes zero if the bodies begin to separate If contact is breaking , then fi should be zero ¨ di(tc) > 0 If fi is not zero, then the contact is not breaking ¨ di(tc) = 0 What is the equation that satisfies these two cases? fi ¨ di(tc) = 0

Resting contact conditions

A B

ˆ n f ˆ n

Condition 1: Non-penetration Condition 2: Repulsive force Condition 3: Workless force

di(t) = ˆ ni(t) · (pa(t) − pb(t))

¨ di(tc) ≥ 0 fi ≥ 0

where

fi ¨ di(tc) = 0

slide-10
SLIDE 10

Compute contact forces

¨ di(tc) = ai1f1 + ai2f2 + · · · + ainfn + bi

Step 1: compute A and b

   ¨ d1(tc) . . . ¨ dn(tc)    = A    f1 . . . fn    + b

Step 2: solve f using quadratic programming

Compute contact forces

¨ di(tc) = ˆ ni(tc) · (¨ pa(tc) − ¨ pb(tc)) + 2 ˙ ˆ ni(tc) · ( ˙ pa(tc) − ˙ pb(tc))

Factor out the terms that depend on fj and assign them to aij Assign the rest of terms to bi

Quadratic programming

Solve for Subject to f1, f2, · · · , fn fi ≥ 0

A    f1 . . . fn    + b ≥ 0 (ai1f1 + · · · + ainfn + bi)fi = 0 i = 1 · · · n i = 1 · · · n

Summary

What’s the physical meaning of the rotation matrix? How is the rotation matrix related to angular velocity? How do you compute inertia tensor efficiently? Why do we compute impulse instead of force in the case

  • f colliding contact?
slide-11
SLIDE 11

What’s next?

What are the equations of motion for articulated bodies? How do we generalize constraints to articulated bodies?