Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Rigid Body Dynamics
Kyoungju ParkKyoungju Park
Rigid body dynamicsRigid body dynamics
For objects with spatial extentParticle system is not enough
Rigid body dynamicsRigid body dynamics
Problems
• Unconstrained
Performance is important
simulation– No contact
• Constrained systemC lli i d t t– Collision and contact
C t l i thi !Control is everything!
Particle simulationParticle simulation
Rigid body conceptsRigid body concepts
• Position and orientation• Position and orientation
• Linear and angular velocity
• Mass and Inertia
F d t• Force and torques
• Simulation
Position and orientationPosition and orientation• Translation of the body ⎛ ⎞• Translation of the body
x( )x
t y⎛ ⎞⎜ ⎟= ⎜ ⎟⎜ ⎟
Rotation of the body
z⎜ ⎟⎜ ⎟⎝ ⎠
• Rotation of the body
xx yx zxr r r⎛ ⎞⎜ ⎟( )
xx yx zx
xy yy zyR t r r rr r r
⎜ ⎟= ⎜ ⎟⎜ ⎟⎝ ⎠
⇒Spacial variables of a rigid body
xz yz zzr r r⎜ ⎟⎝ ⎠
p g y
Body spaceBody space
Position and orientationPosition and orientation
Position and orientationPosition and orientation
• x(t) 와 R(t)를 사용해서body space 를 world space 로 transform
• Body 의 포인트 roi 의• Body 의 포인트 roi 의world coordinate 은?
Position and orientationPosition and orientation
• Rigid body 가 일정한 밀도라고 가정하면, x(t) 의 물리적 의미는?( ) 의 물리적 의미는– 질량의 중심 over time
• R(t) 의 물리적 의미는?– It’s a bit tricky
Position and orientationPosition and orientation
B d 의 축을 생각해 면 (1 0 0)• Body space 의 x축을 생각해보면, (1,0,0) 이라는 백터좌표를 가지고 있다. 시간 t 일때 ld di 에서의 이 벡터의 방때 world coordinate 에서의 이 벡터의 방향은?
1⎛ ⎞ ⎛ ⎞1( ) 0
xx
xy
rR t r
⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟=⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟
which is the first column of R(t)
축
0 xzr⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠
• 따라서, R(t) 는 body space 의 x, y, z 축을world space at time t 로 나타내게 된다.
Position and orientationPosition and orientation
• 그러므로 x(t) 와 R(t) 는 시간 t 일 때 rigid body 의 position과 orientation 을 정의한y 의 p 과 을 정의한다
• Next, position 과 orientation 은 시간이p흐름에 따라 어떻게 변화하는가에 관한 정의가 필요!의가 필요!
• Position and orientation• Position and orientation
• Linear and angular velocity
• Mass and Inertia
F d t• Force and torques
• Simulation
velocityvelocity
Linear velocityLinear velocity
Angular velocityCOM(center of mass) 의 위치를 고정한다면
어떤 움직임이든 COM 을 지나가는 축을 기준으로 b d i i 으어떤 움직임이든 COM 을 지나가는 축을 기준으로 body spinning 으로 야기됨
그렇지 않다면 COM 자체가 움직임그렇지 않다면, COM 자체가 움직임
Angular velocityAngular velocity
S i 을 t ( )t• Spin 을 vector– Direction?– Magnitude?
( )tω
Magnitude?
• Linear position 과 velocity 는
• Angular position(orientation) 과 angular velocity 는 어Angular position(orientation) 과 angular velocity 는 어떤 관계?
Angular velocityAngular velocity
H R( ) d 의 관계는?( )tω• How are R(t) and 의 관계는?( )tω
• Hint:Hint:– 시간 t, world space 에서의
벡터 r(t) 를 고려하면, r(t)의 순각적인 속도 값은
( ) ( ) ( )r t b t t bω ω= = ×( ) ( ) ( )r t b t t bω ω ×
( ) ( ) ( ) ( ) ( ) ( )r t t b t b t a t b aω ω ω ω= × = × + × = × +( ) ( ) ( )r t t r tω= ×
Angular velocityAngular velocity
의 리적 을 려할때 의 l 어떤 의( )R• R(t) 의 물리적 뜻을 고려할때, 의 column 은 어떤 의미?
( )Rt
• 시간 t 일 때, rigid body 의 x 축방향은(world space) 에R(t) 의 첫번째 column 임R(t) 의 첫번째 column 임
xxrr⎛ ⎞⎜ ⎟⎜ ⎟
시간 t 에서 R(t) 의 첫번째 l 의 d i ti 는?
xy
xz
rr⎜ ⎟⎜ ⎟⎝ ⎠
• 시간 t 에서, R(t) 의 첫번째 column 의 derivative는?
Angular velocityAngular velocity
Angular velocityAngular velocity
V t l ti ( ) ( ) ( )r t t r tω ×Vector relation:
Matrix relation:
( ) ( ) ( )r t t r tω= ×
Perspective of particlePerspective of particle
• Rigid body 가 수많은 수의 조그마한particle 로 이루어져있다고 상상p 이루어져있다 상상– Particle 은 1 부터 N 까지 인덱스 되어지고
각각의 particle 은 body space에서 위치 불– 각각의 particle 은 body space에서 위치 불변시간 t 에서 i 번째 ti l 의 ld 에– 시간 t 에서 i 번째 particle의 world space 에서의 위치는
Velocity of a particleVelocity of a particle
Angular component Linear componentAngular component Linear component
• Position and orientation• Position and orientation
• Linear and angular velocity
• Mass and Inertia
F d t• Force and torques
• Simulation
MassMass
• i-th 파티클의 질량은 mi
N
∑Total Mass 1
ii
M m=
=∑
Center of mass in world space ( )i im r tM
∑
What about center of mass in body space?
Center of MassCenter of Mass
f h h f ldProof that the center of mass at time t in world space is x(t)
( ) ( ( ) ( ))mr t m R t r x t+∑ ∑ 0( ) ( ( ) ( ))i i i imr t m R t r x tM M
+=∑ ∑
( ) ( )( ) ( )i oi i iR t mr mx t m
x t x t+
= = =∑ ∑ ∑( ) ( )x t x tM M
Inertia tensorInertia tensorInertia tensor 는 rigid bod 의 질량이 질량 중심으로부터Inertia tensor 는 rigid body의 질량이 질량 중심으로부터
분포되는 상태를 나타낸다.
2 2
2 2
( )( ) ( )
i iy iz i ix iy i ix izm r r m r r m r r′ ′ ′ ′ ′ ′⎛ ⎞+ − −⎜ ⎟′ ′ ′ ′ ′ ′∑ 2 2
2 2
( ) ( )( )
i iy ix i ix iz i iy iz
i iz ix i iz iy i ix iy
I t m r r m r r m r rm r r m r r m r r
⎜ ⎟′ ′ ′ ′ ′ ′= − + −⎜ ⎟⎜ ⎟′ ′ ′ ′ ′ ′− − +⎝ ⎠
∑i iz ix i iz iy i ix iy⎝ ⎠
I(t) 는 b d 의 i t ti 에 d d t 하고 t l ti 과는 무관I(t) 는 body 의 orientation 에 dependent 하고 translation 과는 무관
실제 구현을 위해서는, finite sum 을 rigid body 부피 전부의 적분으로 변경
Inertia tensorInertia tensor
• Inertia tensor 는 world space 에서 시간에따라서 달라진다따라서 달라진다
그러나 b d 에서는 일정하다• 그러나 body space 에서는 일정하다
• 시간을 줄이기 위하여 body space 의 적분을 미리 계산한다을 미리 계산한다
Inertia tensorInertia tensor
시간이 흘러도 변하지 않는 Ibody를 미리 계산
유도식은 course note 인 “notesg.pdf” 의 G14 참고
Approximate inertia tensorApproximate inertia tensor
• Bounding boxes
– Pros: simple
– Cons: inaccurate
Approximate inertia tensorApproximate inertia tensor
• Point sampling
– Pros: simple, f i l tfairly accurate
– Cons: expensive, requires volume testrequires volume test
Approximate inertia tensorApproximate inertia tensor
• Green’s theorem
평면모양 적분을 선 적분으로 변환평면모양 적분을 선 적분으로 변환
Pros: simple e act– Pros: simple, exact– Cons: require boundary
irepresentation
• Position and orientation• Position and orientation
• Linear and angular velocity
• Mass and Inertia
F d t• Force and torques
• Simulation
Force and torqueForce and torqueFi(t) 는 i번째 파티클에 타임 t 에 작용하는 외부 힘을 나타냄Fi(t) 는 i번째 파티클에 타임 t 에 작용하는 외부 힘을 나타냄
Total force 는 ( ) ( )iF t F t=∑
Total torque 는 ( ) ( ) ( ( ) ( )) ( )i i it t r t x t F tτ τ= = − ×∑ ∑
Force and torqueForce and torque
• F(t) 는 개개의 force 가 body 의 어느 곳에작용하는지에 관한 정보가 없음작용하는지에 관한 정 가 없음
는 b d 에 대한 f 의 분포에 관한( )• 는 body 에 대한 force의 분포에 관한정보가 있음
( )tτ
어떤 것이 t f 에 관한 파티클• 어떤 것이 center of mass 에 관한 파티클의위치에 관련되나?
Linear momentumLinear momentum
• 파티클의 linear momenump mv=
• Rigid body 의 linear momentum
p mv
( ) ( ) ( )i iP t m r t Mv t= =∑
• Rigid body의 전체 linear momentum 은body가 질량이 M 이고 속도가 v(t) 인 파티클인 것과 동일티클인 것과 동일
Angular momentumAngular momentum
• Linear momentum 과 비슷하게, angular momentum 은은
( ) ( ) ( )L t I t tω=
L(t) 가 x(t) 의 translational 효과에 dependent 한지?L(t) 가 R(t)의 rotational 효과에 dependent 한지?( ) 가 ( )의 과에 p 한지P(t) 는 어떤가?
Derivative of momentumDerivative of momentum
Li 의 변화는 i id b d 에• Linear momentum 의 변화는 rigid body에작용하는 전체 force 와 동일
( ) ( ) ( )P t Mv t F t= =
• Angular momentum 과 total torque 의 관계는 linear 경우와 유사는 linear 경우와 유사
( ) ( )L t tτ=증명은 course note 의 “notesg.pdf” 의
di A 참조
( ) ( )L t tτ
appendix A 참조
Equation of motionEquation of motion
⎛ ⎞ ( )⎛ ⎞( )( )
( )
x tR t
Y t
⎛ ⎞⎜ ⎟⎜ ⎟=
Position
Orientation
( )( )* ( )
( )
v tt R td Y t
ω⎛ ⎞⎜ ⎟⎜ ⎟=⎜ ⎟( )
( )( )
Y tP tL t
⎜ ⎟=⎜ ⎟⎜ ⎟⎝ ⎠
Linear momentum
Angular momentum
( )( )( )
Y tF tdt
tτ
⎜ ⎟=⎜ ⎟⎜ ⎟⎝ ⎠( )⎝ ⎠ g ( )⎝ ⎠
Constants: M 과 Ibody
( )( ) P tv t =( )
( ) ( ) ( )Tbody
v tM
I t R t I R t
=
=1( ) ( ) ( )t I t L tω −=
Momentum vs velocityMomentum vs. velocity
• Velocity 대신에 momentum 을 state 에서사용하는 이유는?사용하는 이유는
T 가 없을 때 l t 이 보– Torque 가 없을 때 angular momentum 이 보존하기 때문
– Angular 경우와 consistent 하기 위하여g 경우와 하기 위하여Linear momentum 인 P(t) 를 사용
Notes on implementationNotes on implementation
• Rotation 대신에 quaternion 사용– Compact 1( ) ( ) ( )q t t q tω=Co pact– Less numerical drift
( ) ( ) ( )2
( ) ( )* ( )
q t t q t
R t t R t
ω
ω
=
=( ) ( ) ( )R t t R tω
( )( )
x tq t⎛ ⎞⎜ ⎟⎜ ⎟
Position( )
1/ 2 ( ) ( )v t
t q td ω⎛ ⎞⎜ ⎟⎜ ⎟( )
( )( )( )
q tY t
P tL
⎜ ⎟=⎜ ⎟⎜ ⎟⎝ ⎠
Orientation
Linear momentum
1/ 2 ( ) ( )( )
( )( )
t q td Y tF tdtω⎜ ⎟=
⎜ ⎟⎜ ⎟⎝ ⎠( )L t⎜ ⎟
⎝ ⎠ Angular momentum ( )tτ⎜ ⎟⎝ ⎠
Code fragments in “notesg.pdf”
ExampleExample
1. Compute the Ibody2 20 0 0 0y z
M⎛ ⎞+⎜ ⎟0 0
2 20 0
2 20 0
0 012
0 0body
yMI x z
x y
⎜ ⎟= +⎜ ⎟
⎜ ⎟+⎝ ⎠0 00 0 x y+⎝ ⎠
ExampleExample
1. Compute the Ibody2 Rotation free movement2. Rotation free movement
ExampleExample
1. Compute the Ibody2 Rotation free movement2. Rotation free movement 3. Translation free movement
Project2 PartIProject2-PartI
• 1단계: due 12/4(unconstrained dynamics)y– 당구공, 당구대를 OpenGL 로 visualization– Rigid body simulator 만들기g y 만들기
• 2단계: due 12/112단계: due 12/11(constrained dynamics)
Collision detection(vertex/face)– Collision detection(vertex/face)– Colliding contact 계산