Algorithm Search⌘K

Definitionintro

Roll-pitch-yaw angles

Also called Tait-Bryan angles, RPY angles, yaw-pitch-roll angles.

Roll, pitch and yaw are turns about the fixed x, then y, then z axes, so R = Rz(yaw) Ry(pitch) Rx(roll). The chart is singular at a pitch of plus or minus 90 degrees.

Roll-pitch-yaw angles describe an orientation by three turns about three different axes. In the convention used here, the body turns by the roll ϕ\phi about the fixed xx axis, then by the pitch θ\theta about the fixed yy axis, then by the yaw ψ\psi about the fixed zz axis, so the rotation matrix is R=Rz(ψ) Ry(θ) Rx(ϕ)R = R_z(\psi)\,R_y(\theta)\,R_x(\phi). The same matrix comes from turns about the moving axes in the reverse order: yaw about the body zz axis, then pitch about the new yy axis, then roll about the newest xx axis. The angles are unique for a pitch strictly between −90°-90° and 90°90°, and the chart is singular at a pitch of ±90°\pm 90°, where roll and yaw turn about the same line.

Notation on this page: rotations are active, and RxR_x, RyR_y, RzR_z are the rotations about the fixed axes of the base frame, as on the page on Euler angles.

Definition

Definition. The roll-pitch-yaw angles of a rotation RR in the special orthogonal group SO(3) are three angles (ϕ,θ,ψ)(\phi, \theta, \psi) with

R=Rz(ψ) Ry(θ) Rx(ϕ)=(cψcθcψsθsϕ−sψcϕcψsθcϕ+sψsϕsψcθsψsθsϕ+cψcϕsψsθcϕ−cψsϕ−sθcθsϕcθcϕ),R = R_z(\psi)\,R_y(\theta)\,R_x(\phi) = \begin{pmatrix} c_\psi c_\theta & c_\psi s_\theta s_\phi - s_\psi c_\phi & c_\psi s_\theta c_\phi + s_\psi s_\phi \\ s_\psi c_\theta & s_\psi s_\theta s_\phi + c_\psi c_\phi & s_\psi s_\theta c_\phi - c_\psi s_\phi \\ -s_\theta & c_\theta s_\phi & c_\theta c_\phi \end{pmatrix},

where cψ=cos⁡ψc_\psi = \cos\psi, sψ=sin⁡ψs_\psi = \sin\psi, and so on. The usual ranges are ϕ,ψ∈(−π,π]\phi, \psi \in (-\pi, \pi] and θ∈[−π/2,π/2]\theta \in [-\pi/2, \pi/2].

Fixed and moving axes. Read from right to left, the product turns a vector about the fixed axes xx, yy, zz in this order. Read from left to right, it turns the frame about its own axes zz, y′y', x′′x'' in this order, which is the ZYX Euler sequence. So "roll-pitch-yaw about fixed x,y,zx, y, z" and "ZYX Euler angles about moving z,y′,x′′z, y', x''" are one chart with two names. It is one of the six Tait-Bryan sequences, which use three different axes.

Inverse. Given R=(rij)R = (r_{ij}) with r31≠±1r_{31} \ne \pm 1, the angles with θ∈(−π/2,π/2)\theta \in (-\pi/2, \pi/2) are

θ=atan2⁡(−r31,  r112+r212),ψ=atan2⁡(r21,r11),ϕ=atan2⁡(r32,r33),\theta = \operatorname{atan2}\Big(-r_{31},\; \sqrt{r_{11}^2 + r_{21}^2}\Big), \qquad \psi = \operatorname{atan2}(r_{21}, r_{11}), \qquad \phi = \operatorname{atan2}(r_{32}, r_{33}),

and they are the only angles in the ranges above. The square root is cos⁡θ>0\cos\theta > 0, and the formulas divide it out of both arguments of each atan2.

The singular set. At θ=90°\theta = 90°, Ry(90°) Rx(ϕ)=Rz(−ϕ) Ry(90°)R_y(90°)\,R_x(\phi) = R_z(-\phi)\,R_y(90°), so R=Rz(ψ−ϕ) Ry(90°)R = R_z(\psi - \phi)\,R_y(90°), and only ψ−ϕ\psi - \phi is fixed. At θ=−90°\theta = -90°, R=Rz(ψ+ϕ) Ry(−90°)R = R_z(\psi + \phi)\,R_y(-90°), and only ψ+ϕ\psi + \phi is fixed. There the first column of RR is (0,0,∓1)(0, 0, \mp 1), the formulas for ψ\psi and ϕ\phi read atan2(0, 0), and the derivative of the chart has rank 2. Code must test ∣r31∣|r_{31}| against a tolerance and choose one angle, often ϕ=0\phi = 0. This is the gimbal lock of the chart.

Vehicles. For aircraft, ships and ground robots, the body xx axis points forward, so roll is the bank about the forward axis, pitch is the nose up or down, and yaw is the heading. Many aerospace texts use a body zz axis that points down and write the passive matrix from the world frame to the body frame, which is RTR^{\mathsf T}. The angles are the same numbers, but the matrix is transposed and the signs in formulas for rates change.

Examples and non-examples

  • A full example. Roll 10°10°, pitch 20°20° and yaw 30°30° give
    R=(0.81380−0.440970.378520.469850.882560.01803−0.342020.163180.92542).R = \begin{pmatrix} 0.81380 & -0.44097 & 0.37852 \\ 0.46985 & 0.88256 & 0.01803 \\ -0.34202 & 0.16318 & 0.92542 \end{pmatrix}.
    The inverse formulas give θ=atan2⁡(0.34202,0.93969)=20°\theta = \operatorname{atan2}(0.34202, 0.93969) = 20°, ψ=atan2⁡(0.46985,0.81380)=30°\psi = \operatorname{atan2}(0.46985, 0.81380) = 30° and ϕ=atan2⁡(0.16318,0.92542)=10°\phi = \operatorname{atan2}(0.16318, 0.92542) = 10°. The unit quaternion of the same rotation is the product qz(30°) qy(20°) qx(10°)=(0.95155,0.03813,0.18931,0.23930)q_z(30°)\,q_y(20°)\,q_x(10°) = (0.95155, 0.03813, 0.18931, 0.23930).
  • Close to the singular set. Take the pitch 89.9°89.9° with zero roll and yaw, and turn it by a further 0.1°0.1° about the fixed xx axis. The new angles are a yaw of 45°45°, a pitch of 89.859°89.859° and a roll of 45°45°. A change of 0.1°0.1° in the orientation moved two angles by 45°45°. A filter or a controller that works on the angles sees this as a jump.
  • The singular set. (ϕ,θ,ψ)=(0.2,90°,0.5)(\phi, \theta, \psi) = (0.2, 90°, 0.5) and (0,90°,0.3)(0, 90°, 0.3) give the same matrix, because the difference ψ−ϕ\psi - \phi is 0.30.3 in both.
  • Non-example: the order x, then y, then z about moving axes. Rx(ϕ) Ry(θ) Rz(ψ)R_x(\phi)\,R_y(\theta)\,R_z(\psi) is a different chart, with different angles for the same orientation. The phrase "x then y then z" is not complete until it says whether the axes are fixed or moving.
  • Non-example: the rates as body rates. (ϕ˙,θ˙,ψ˙)(\dot\phi, \dot\theta, \dot\psi) is not the angular velocity of the body. The body rates (p,q,r)(p, q, r) give ϕ˙=p+(qsin⁡ϕ+rcos⁡ϕ)tan⁡θ\dot\phi = p + (q\sin\phi + r\cos\phi)\tan\theta, which grows without bound near the singular set. Integrating these rates in dead reckoning fails there; integrate a quaternion with the quaternion kinematic equation.
  • Euler angles. The family of three-angle charts, with ZYZ as the proper Euler sequence of robot wrists.
  • Gimbal lock. The singular set at a pitch of ±90°\pm 90°, in the chart and in a mechanical gimbal.
  • Stuelpnagel's theorem. No three-parameter chart of SO(3) is free of singular points, so a change of the axis order only moves the singular set.
  • Analytic Jacobian. The velocity Jacobian written with the rates of the angles, singular at the gimbal lock of the chart even where the robot itself is not singular.
  • Attitude estimation. Filters keep the attitude as a quaternion or a matrix and report roll, pitch and yaw only for display.

References

  1. Kevin M. Lynch and Frank C. Park, Modern Robotics, Mechanics, Planning, and Control, Cambridge University Press, 2017, Appendix B, Section B.1 (the ZYX Euler angles, equation B.2, and the algorithm of Section B.1.1) and Section B.2 (roll-pitch-yaw angles, equation B.8)
  2. Bruno Siciliano, Lorenzo Sciavicco, Luigi Villani and Giuseppe Oriolo, Robotics, Modelling, Planning and Control, Springer, 2009, Chapter 2, Section 2.4.2 (RPY angles)
  3. John Stuelpnagel, On the parametrization of the three-dimensional rotation group, SIAM Review 6(4), 422-430, 1964, Section 6 (three-dimensional parametrizations, the singularity of roll, pitch and yaw at plus or minus 90 degrees)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/SBDNF0/text.yaml