四元數 旋轉矩陣 基礎運算

四元數相關運算

四元數 q=[qxqyqzqw]T=[qvqw]Tq=\begin{bmatrix}q_x & q_y & q_z & q_w\end{bmatrix}^T = \begin{bmatrix}q_v & q_w\end{bmatrix}^T
pq=[pwpzpypxpzpwpxpypypxpwpzpxpypzpw][qxqyqzqw]=[pwqxpzqy+pyqz+pxqwpzqx+pwqypxqz+pyqwpyqx+pxqy+pwqz+pzqwpxqxpyqypzqz+pwqw]=[pwqwpvTqvpwqv+qwpv+pv×qv]p \otimes q = \begin{bmatrix} p_w & -p_z & p_y & p_x \\ p_z & p_w & -p_x & p_y \\ -p_y & p_x & p_w & p_z \\ -p_x & -p_y & -p_z & p_w \end{bmatrix}\begin{bmatrix}q_x \\ q_y \\ q_z \\ q_w\end{bmatrix} = \begin{bmatrix} p_wq_x - p_zq_y + p_yq_z + p_xq_w \\ p_zq_x + p_wq_y - p_xq_z + p_yq_w \\ -p_yq_x + p_xq_y + p_wq_z + p_zq_w \\ -p_xq_x - p_yq_y - p_zq_z + p_wq_w \end{bmatrix} = \begin{bmatrix} p_wq_w - p_v^Tq_v \\ p_wq_v + q_wp_v + p_v \times q_v \end{bmatrix}
pv×qv=[pxpypz]×[qxqyqz]=[0pxpypx0pzpypz0][qxqyqz]=[pxqy+pyqzpxqxpzqzpyqx+pzqy]p_v \times q_v = \begin{bmatrix}p_x \\ p_y \\ p_z\end{bmatrix} \times \begin{bmatrix} q_x \\ q_y \\ q_z \end{bmatrix} = \begin{bmatrix}0 & -p_x & p_y \\ p_x & 0 & -p_z \\ -p_y & p_z & 0\end{bmatrix}\begin{bmatrix}q_x \\ q_y \\ q_z\end{bmatrix} = \begin{bmatrix} -p_xq_y + p_yq_z \\ p_xq_x - p_zq_z \\ -p_yq_x + p_zq_y \end{bmatrix}
結合律:
(pq)r=p(qr)\left(p \otimes q\right) \otimes r = p \otimes \left(q \otimes r\right)
分配律:
p(q+r)=pq+prp \otimes \left(q + r\right) = p \otimes q + p \otimes r
(p+)r=pr+qr\left(p +q\right) \otimes r = p \otimes r + q \otimes r
左乘右乘:
q1q2=[q1]Lq2q_1 \otimes q_2 = \left[q_1\right]_Lq_2
q1q2=[q2]Rq1q_1 \otimes q_2 = \left[q_2\right]_Rq_1
[q]L=[qwqzqyqxqzqwqxqyqyqxqwqzqxqyqzqw]=qwI+[[qv]×qvqvT0]\left[q\right]_L = \begin{bmatrix} q_w & -q_z & q_y & q_x \\ q_z & q_w & -q_x & q_y \\ -q_y & q_x & q_w & q_z \\ -q_x & -q_y & -q_z & q_w \end{bmatrix} = q_wI + \begin{bmatrix} \left[q_v\right]_{\times} & q_v \\ \\ -q_v^{T} & 0 \end{bmatrix}
[q]R=[qwqzqyqxqzqwqxqyqyqxqwqzqxqyqzqw]=qwI+[[qv]×qvqvT0]\left[q\right]_R = \begin{bmatrix} q_w & q_z & -q_y & q_x \\ -q_z & q_w & q_x & q_y \\ q_y & -q_x & q_w & q_z \\ -q_x & -q_y & -q_z & q_w \end{bmatrix} = q_wI + \begin{bmatrix}-\left[q_v\right]_{\times} & q_v \\ \\ -q_v^T & 0\end{bmatrix}
[a]×[0azayaz0axayax0]\left[a\right]_{\times} \triangleq \begin{bmatrix} 0 & -a_z & a_y \\ a_z & 0 & -a_x \\ -a_y & a_x & 0 \end{bmatrix}
[a]×T=[a]×\left[a\right]_{\times}^T = -\left[a\right]_{\times}
[a]×b=a×b,    a,bR\left[a\right]_{\times}b = a \times b, \ \ \ \ \forall a, b \in \mathbb{R}
Finally, since
(qx)p=[p]R[q]Lx\left(q \otimes x\right) \otimes p = \left[p\right]_R\left[q\right]_L x
q(xp)=[q]L[p]Rxq\otimes\left(x\otimes p\right) = \left[q\right]_L\left[p\right]_Rx
[p]R[q]L=[q]L[p]R\left[p\right]_R\left[q\right]_L = \left[q\right]_L\left[p\right]_R
四元數的逆:
q1=q       qq=1q^{-1} = q^{*} \ \ \ \ \ \ \ q \otimes q^* = 1
四元數的導數:
q˙=12qω\dot{q} = \frac{1}{2}q \otimes \omega
指數映射:
q=exp(uϕ/2)q = \exp\left(u \phi / 2\right)
對數映射:
log(q)=uϕ/2\log\left(q\right) = u \phi / 2
兩個四元數運算:
q1q2q_1 \otimes q_2
旋轉操作:
q=cos(ϕ/2)+usin(ϕ/2)q = \cos \left(\phi / 2\right) + u \sin \left(\phi / 2\right)
旋轉作用:
qxqq \otimes x \otimes q^*

旋轉矩陣相關運算

Rx=[1000cos(θx)sin(θx)0sin(θx)cos(θx)]R_x = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\left(\theta_x\right) & -\sin\left(\theta_x\right) \\ 0 & \sin\left(\theta_x\right) & \cos\left(\theta_x\right) \end{bmatrix}
Ry=[cos(θx)0sin(θx)010sin(θx)0cos(θx)]R_y = \begin{bmatrix} \cos\left(\theta_x\right) & 0 & \sin\left(\theta_x\right) \\ 0 & 1 & 0 \\ -\sin\left(\theta_x\right) & 0 & \cos\left(\theta_x\right) \end{bmatrix}
Rz=[cos(θx)sin(θx)0sin(θx)cos(θx)0001]R_z = \begin{bmatrix} \cos\left(\theta_x\right) & -\sin\left(\theta_x\right) & 0 \\ \sin\left(\theta_x\right) & \cos\left(\theta_x\right) & 0 \\ 0 & 0 & 1 \end{bmatrix}
旋轉矩陣的逆:
R1=RT     RR1=RRT=I    det(R)=1R^{-1} = R^T \ \ \ \ \ RR^{-1} = RR^T = I \ \ \ \ det\left(R\right) = 1
旋轉矩陣的導數:
R˙=R[ω]×\dot{R} = R\left[\omega\right]_{\times}
指數映射:
R=exp([uϕ]×)R = \exp\left(\left[u \phi\right]_{\times}\right)
對數映射:
log(R)=[uϕ]×\log\left(R\right) = \left[u \phi\right]_{\times}
兩個旋轉矩陣運算:
R1R2R_1 R_2
旋轉操作:
R=I+sin(ϕ[u]×)+(1cos(ϕ))[u]×2R = I + \sin\left(\phi \left[u\right]_{\times}\right) + \left(1 - \cos\left(\phi\right)\right)\left[u\right]_{\times}^2
旋轉作用:
RxRx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章