当前位置:   article > 正文

欧拉角和四元数的相互转换_四元数转欧拉角

四元数转欧拉角

四元数为:
q = ( w , x , y , z ) q = (w, x, y, z) q=(w,x,y,z)

对应欧拉角为:

  • 俯仰角(pitch): θ \theta θ
  • 滚转角(roll): ϕ \phi ϕ
  • 偏航角(yaw): ψ \psi ψ
    在这里插入图片描述

则四元数到欧拉角的转换公式为:

欧拉角到四元数

w = cos ⁡ ( θ 2 ) cos ⁡ ( ϕ 2 ) cos ⁡ ( ψ 2 ) + sin ⁡ ( θ 2 ) sin ⁡ ( ϕ 2 ) sin ⁡ ( ψ 2 ) x = sin ⁡ ( θ 2 ) cos ⁡ ( ϕ 2 ) cos ⁡ ( ψ 2 ) − cos ⁡ ( θ 2 ) sin ⁡ ( ϕ 2 ) sin ⁡ ( ψ 2 ) y = cos ⁡ ( θ 2 ) sin ⁡ ( ϕ 2 ) cos ⁡ ( ψ 2 ) + sin ⁡ ( θ 2 ) cos ⁡ ( ϕ 2 ) sin ⁡ ( ψ 2 ) z = cos ⁡ ( θ 2 ) cos ⁡ ( ϕ 2 ) sin ⁡ ( ψ 2 ) − sin ⁡ ( θ 2 ) sin ⁡ ( ϕ 2 ) cos ⁡ ( ψ 2 )

w=cos(θ2)cos(ϕ2)cos(ψ2)+sin(θ2)sin(ϕ2)sin(ψ2)x=sin(θ2)cos(ϕ2)cos(ψ2)cos(θ2)sin(ϕ2)sin(ψ2)y=cos(θ2)sin(ϕ2)cos(ψ2)+sin(θ2)cos(ϕ2)sin(ψ2)z=cos(θ2)cos(ϕ2)sin(ψ2)sin(θ2)sin(ϕ2)cos(ψ2)
wxyz=cos(2θ)cos(2ϕ)cos(2ψ)+sin(2θ)sin(2ϕ)sin(2ψ)=sin(2θ)cos(2ϕ)cos(2ψ)cos(2θ)sin(2ϕ)sin(2ψ)=cos(2θ)sin(2ϕ)cos(2ψ)+sin(2θ)cos(2ϕ)sin(2ψ)=cos(2θ)cos(2ϕ)sin(2ψ)sin(2θ)sin(2ϕ)cos(2ψ)

四元数到欧拉角

θ = arcsin ⁡ ( 2 ( w ⋅ y − z ⋅ x ) ) ϕ = arctan ⁡ 2 ( 2 ( w ⋅ x + y ⋅ z ) , 1 − 2 ( x 2 + y 2 ) ) ψ = arctan ⁡ 2 ( 2 ( w ⋅ z + x ⋅ y ) , 1 − 2 ( y 2 + z 2 ) )

θ=arcsin(2(wyzx))ϕ=arctan2(2(wx+yz),12(x2+y2))ψ=arctan2(2(wz+xy),12(y2+z2))
θϕψ=arcsin(2(wyzx))=arctan2(2(wx+yz),12(x2+y2))=arctan2(2(wz+xy),12(y2+z2))

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/422717
推荐阅读
相关标签
  

闽ICP备14008679号