Orientation, Rotation, Euler Angles & Quaternions
Orientation, Rotation, Euler Angles & Quaternions
What is Orientation ?
● A vector has a direction, but not an orientation: the vector can rotate on itself longitudinally,
the vector does not undergo a real change. Why? The vector has no thickness and its only
dimension is its length.
● A direction can be defined in space with two parameters (θ,φ)
● An object that has a thickness and that is rotated along an axis undergoes a change in
orientation.
● An orientation is defined with 3 angular parameters, the Euler angles: heading, pitch, roll.
(next slide)
● Like position, an orientation cannot be defined in absolute terms, but always in relation to a
given reference frame. The 3 angles define in fact the rotation "from the null orientation to
the considered orientation".
● The amount of rotation is called angular displacement.
● The orientation defines a state (static), the rotation a difference of states (dynamic).
● (analogy with position/translation... position is static, while translation is dynamic)
Euler Angles
● We will use the "Heading-Pitch-Bank" convention for the Euler angles. From a reference
orientation, we apply the 3 angular displacements in this order:
○ Step 1: Heading, rotation around the local axis (Oy)
○ Step 2 : Pitch, rotation around the local axis (Ox)
○ Step 3: Bank, rotation around the local axis (Oz)
● Note the similarity of steps 1 & 2 with the spherical coordinate system
○ Heading & Pitch define the direction
● Sometimes other terminology is used:
○ Roll = Tilt = Twist = Bank
○ Yaw ≃ Heading, Azimuth = Heading
○ Attitude = Elevation = Pitch
Euler Angles …. In the computer
● In computer science, the calculations performed by the computer actually use the inverse convention "Roll-Pitch-Yaw"
(Bank-Pitch-Heading).
● The three rotations are applied in reverse order, and according to the axes of the parent frame of reference, and no longer local:
○ Step 1: Bank/Roll, rotation around the parent frame axis (Oz)
○ Step 2: Pitch, rotation around the parent frame axis (Ox)
○ Step 3: Heading/Yaw, rotation around the axis of the parent frame (Oy)
● We speak of the extrinsic convention (Roll-Pitch-Yaw), opposed to the intrinsic convention (Heading-Pitch-Bank).
● The extrinsic convention has the advantage of being based on fixed reference axes, which greatly facilitates the calculations.
● The difference between Yaw & Heading ... because there is one often swept away...
○ Yaw: rotation around the local axis (Oy)
○ Heading: rotation around the parent referential axis (Oy)
● Euler & Tait-Bryan angles: Euler uses only 2 axes to carry out 3 rotations, Tait-Bryan introduced the third axis
Euler Angles … pros & cons
● Advantages:
○ Euler angles are intuitive, they stick quite well to our natural perception of orientation.
○ Memory footprint minimum: three numerical values easily compressible and evenly distributed over the interval [0;2π]
(Fixed-point numbers possible).
○ All angle values are mathematically valid.
● Disadvantages:
○ 1st Aliasing problem → there is not a unique triplet of angles for a given orientation (non-bijectivity)
■ example: (pitching down 135°) = (heading 180°, pitching down 45°, banking 180°)
■ the solution: to ensure the bijection between Euler angles & orientation, we will limit the angles to the canonical
Euler angles:
-180° ≤ heading < 180° -180° ≤ bank < 180° -90° ≤ pitch ≤ 90°
if pitch = +90° or -90°, then bank = 0 (Gimbal Lock situation, see below)
● 2nd aliasing problem: "Gimbal Lock". when pitch is +90° or -90°, we are restricted to turn around the vertical axis according
to (Oy) and (Oz), we lose one degree of rotation.
By convention, we will set bank to 0, and the rotation around the vertical axis (Oy) will be assured by heading
Gimbal Lock! is an unsolvable problem
https://www.youtube.com/watch?v=zc8b2Jo7mno
Gimbal Lock remains a major problem ... which definitely disqualifies Euler angles to ensure rotations
Quaternions to represent an orientation
● A quaternion, noted q, is a mathematical object which contains 4 values:
○ A vector (x,y,z)
○ A scalar value w
● Disadvantages:
○ Takes up more memory space than Euler angles
○ Difficult to compress into fixed-point numbers
○ Not all quaternion values are valid rotations (because of successive rounding for example) ... just normalize the
quaternion but this comes with a loss of precision
○ Not very intuitive