Search
🏰

Ch.19 Hierarchiecal Animation

course
last review
mastery
rookie
progress
not started
date
4 more properties
Previous chapter

Today’s MAIN QUEST

FK의 시점에서 바라보자.
2차원 공간에서 관절의 엔드포인트는 다음과 같이 나타낼 수 있을 것이다.
x=f(q)\bold{x}=\bold{f(q)}
[xy]=[l1cos(q1)+l2cos(q1+q2)l1sin(q1)+l2sin(q1+q2)]\begin{bmatrix}x\\y\end{bmatrix}=\begin{bmatrix}l_1cos(q_1)+l_2cos(q_1+q_2)\\l_1sin(q_1)+l_2sin(q_1+q_2)\end{bmatrix}
Inverse Kinematics가 뭔가? 바로 이걸 역연산 하자는 거다!
즉, 우리는 이 문제를 풀어야 한다.
q=f1(x)\bold{q}=\bold{f^{-1}(x)}
[q1q2]=f1(x)?\begin{bmatrix}q_1\\q_2\end{bmatrix} = \bold{f^{-1}(x)}?
이 친구를 풀어보자.
피타고라스의 정리
d2=x2+y2d^2=x^2+y^2
코사인 법칙
d2=l12+l222l1l2cos(a)cos(a)=l12+l22d22l1l2d^2 = l_1^2 + l_2^2 - 2l_1l_2cos(a)\\ cos(a) = \frac{l_1^2 + l_2^2 - d^2}{2l_1l_2}
을 통해서 다음과 같은 식을 만들 수 있다.
하지만 동시에?!
q2=πaq_2 = \pi -a
이기도 하다!
cos(q2)=cos(πa)=cos(π)cos(a)+sin(π)sin(a)=cos(a)=d2l12l222l1l2\begin{align} cos(q_2) &= cos(\pi -a) \\&=cos(\pi)cos(a)+sin(\pi)sin(a)\\ &=-cos(a)\\ &= \frac{d^2 - l_1^2 - l_2^2}{2l_1l_2} \end{align}
즉, q2는 두가지 식이 될 수 있다.
q2={πcos1(l12+l22x2y22l1l2)cos1(x2+y2l12l222l1l2)q2 = \begin{cases} \pi -\cos ^{-1}(\frac{l_1^2 + l_2^2 - x^2 - y^2}{2l_1l_2} )\\ \cos ^{-1}(\frac{x^2 + y^2 -l_1^2 - l_2^2}{2l_1l_2} ) \end{cases}
이제 q1을 구해보자.
tan(q1+β)=yxq1=tan1(yx)β\tan(q_1+\beta) = \frac{y}{x}\\ q1 = \tan^{-1}(\frac{y}{x})-\beta
이때 코사인 법칙에 의해 다음이 성립한다.
β=tan1(l2sin(q2)l1+l2cos(q2))\beta = \tan^{-1}(\frac{l_2\sin(q_2)}{l_1+l_2\cos(q_2)})
따라서 이렇게 쓸 수 있다.
q1=tan1(yx)tan1(l2sin(q2)l1+l2cos(q2))q1 = \tan^{-1}(\frac{y}{x})-\tan^{-1}(\frac{l_2\sin(q_2)}{l_1+l_2\cos(q_2)})
2차원 공간에서 2개의 링크의 경우에는 두가지 이산적인 해가 나올 수 있다.
q=[tan1(yx)tan1(l2sin(q2)l1+l2cos(q2))πcos1(l12+l22x2y22l1l2)]q=[tan1(yx)tan1(l2sin(q2)l1+l2cos(q2))cos1(x2+y2l12l222l1l2))]q = \begin{bmatrix}\tan^{-1}(\frac{y}{x})-\tan^{-1}(\frac{l_2\sin(q_2)}{l_1+l_2\cos(q_2)})\\ \pi -\cos ^{-1}(\frac{l_1^2 + l_2^2 - x^2 - y^2}{2l_1l_2} )\end{bmatrix}\\ q = \begin{bmatrix}\tan^{-1}(\frac{y}{x})-\tan^{-1}(\frac{l_2\sin(q_2)}{l_1+l_2\cos(q_2)})\\ \cos ^{-1}(\frac{x^2 + y^2 -l_1^2 - l_2^2}{2l_1l_2} ) )\end{bmatrix}
3개의 경우는 어떨까?
결과값은x,y
인풋은 q1,q2,q3로 3가지다! 여기에서 우리가 궁금한 값은 결과로부터 인풋을 구해야하므로
m = 2 < n=3, 즉, 무한한 해를 가질 수 있다.

Cyclic Coordinate Descent(CCD)

1. Joint마다 순회하며 End Effector와 Target 사이의 거리와 방향 차이가 최소가 되도록 각도를 변환한다.
1-1. 타겟의 위치 T, 그리고 End Effector와 P4 Joint의 사이각을 θ4라고 할 때(<Fig 2>의 a),  θ4의 각도가 0이
되도록 End Effector를 이동시킨다(P4를 회전한다).
1-2. End Effector부터 Base까지 역순으로 1-1의 과정을 반복한다.(<Fig 2>의 b->c->d)
2. 모든 Joint에 대해 관절각과 위치가 업데이트 되었으나, 만족스럽지 못한 결과를 얻었다면, 1의 과정을 반복한다.
(<Fig 2>의 e->f)
많은 경우에 잘 풀리나, 자연스럽지는 않고 일반적인 해를 구하기 어렵다.

Closed Form Solution

Optimization

Generic Math Notation

xt=f1(x1,x2,x3,x4,x5,x6)yt=f2(x1,x2,x3,x4,x5,x6)zt=f3(x1,x2,x3,x4,x5,x6)xr=f4(x1,x2,x3,x4,x5,x6)yr=f5(x1,x2,x3,x4,x5,x6)zr=f6(x1,x2,x3,x4,x5,x6)Y=F(X)x_t=f_1(x_1,x_2,x_3,x_4,x_5,x_6)\\ y_t=f_2(x_1,x_2,x_3,x_4,x_5,x_6)\\ z_t=f_3(x_1,x_2,x_3,x_4,x_5,x_6)\\ x_r=f_4(x_1,x_2,x_3,x_4,x_5,x_6)\\ y_r=f_5(x_1,x_2,x_3,x_4,x_5,x_6)\\ z_r=f_6(x_1,x_2,x_3,x_4,x_5,x_6)\\ Y=F(X)
dyidt=fix1dx1dt+fix2dx2dt+fix3dx3dt+fix4dx4dt+fix5dx5dt+fix6dx6dt\frac{dy_i}{dt}=\frac{\partial f_i}{\partial x_1}\frac{dx_1}{dt}+ \frac{\partial f_i}{\partial x_2}\frac{dx_2}{dt}+ \frac{\partial f_i}{\partial x_3}\frac{dx_3}{dt}+ \frac{\partial f_i}{\partial x_4}\frac{dx_4}{dt}+ \frac{\partial f_i}{\partial x_5}\frac{dx_5}{dt}+ \frac{\partial f_i}{\partial x_6}\frac{dx_6}{dt}
dY=FXdXdY = \frac{\partial F}{\partial X}dX
Y=J(X)XY' = J(X) X'
dyidt=(f1x1f1x6f6x1f6x6)(dx1dtdx6dt)\frac{dy_i}{dt}= \begin{pmatrix}\frac{\partial f_1}{\partial x_1} & \dots & \frac{\partial f_1}{\partial x_6} \\ \vdots & \ddots \\ \frac{\partial f_6}{\partial x_1} & \dots & \frac{\partial f_6}{\partial x_6}\end{pmatrix} \begin{pmatrix} \frac{dx_1}{dt}\\ \vdots\\ \frac{dx_6}{dt}\\ \end{pmatrix}
Jacobian??

Motion Capture

무엇을 캡쳐해야하는가?
세그먼트들의 조인트가 있는 관절체의 위치와 각도
스킨에 대해서는?
관절마다 센서를 하나 붙인다.
그 관절의 움직임을 센서로부터 입력받는다.
마커나 트래커를 조인트에 붙인다.
전통적인 방법
Electro-Mechanical : 엑소스켈레톤형태의 디바이스
실외에서 캡쳐하기 편리하다.
이동에 제약이 크다.
Magnetic : 각 센서가 자기장을 발산시켜 박스가 자기장을 캡쳐하는 방식
메카니컬보다는 이동하기 편하다.
유선방식이며, 금속물체가 있을 경우 노이즈가 심해진다.
passiv Optical : 동그란 구형 마커를 붙여서 정반사가 쉽게 일어나도록 한 후, 빛을 쏴서 이미지 추적을 한다. 두 개 이상의 카메라가 거리를 구해 삼각측량을 진행한다.
지금도 가장 많이 쓰이는 방법
해상도, 프레임레이트, 카메라의 포지션 모두가 중요함.
Active Optical :
풀트래커??
Next chapter