3  Sample Exercises

  1. Calculate the rotation matrix \(\boldsymbol{R}\) for a vehicle with Euler angles \(\phi = 30^{\circ}\), \(\theta = 45^{\circ}\), and \(\psi = 60^{\circ}\) (ZYX order).

  2. A vehicle has linear velocity components in its body frame of \(u = 2\) m/s, \(v = 1\) m/s, and \(w = -0.5\) m/s. Using the rotation matrix from Problem 1, calculate the velocity components in the global frame.

  3. Calculate the Euler rates (\(\dot{\phi}\), \(\dot{\theta}\), \(\dot{\psi}\)) for a vehicle with \(\phi = 15^{\circ}\), \(\theta = 30^{\circ}\) and angular velocity components in body frame of \(p = 0.1\) rad/s, \(q = 0.2\) rad/s, and \(r = -0.15\) rad/s.

  4. For a vehicle at orientation \(\phi = 45^{\circ}\), \(\theta = 60^{\circ}\), \(\psi = 30^{\circ}\), determine if this configuration is close to gimbal lock. Explain your reasoning.

  5. A vector in the body frame is given by \(\vec{r} = [1, 2, -1]^T\). If the vehicle has Euler angles \(\phi = 20^{\circ}\), \(\theta = 10^{\circ}\), \(\psi = 45^{\circ}\), express this vector in the global frame.

  6. Two different sequences of rotations are applied to a vehicle:

    • Sequence 1: \(\phi = 30^{\circ}\), \(\theta = 45^{\circ}\), \(\psi = 60^{\circ}\) (ZYX order - \(\psi\) about Z, \(\theta\) about Y, \(\phi\) about X)
    • Sequence 2: \(\phi = 30^{\circ}\), \(\theta = 45^{\circ}\), \(\psi = 60^{\circ}\) (XYZ order - \(\phi\) about X, \(\theta\) about Y, \(\psi\) about Z)

    Compare the final orientations by computing the rotation matrices for both sequences and checking if they are equal.

  7. A vehicle has angular velocity components \(p = 0.5\) rad/s, \(q = 0.3\) rad/s, \(r = -0.2\) rad/s in its body frame. If the current orientation is \(\phi = 10^{\circ}\), \(\theta = 20^{\circ}\) and \(\psi = 45^{\circ}\), calculate the rate of change of heading angle \(\dot{\psi}\).

  8. For a vehicle at \(\theta = 85^{\circ}\), discuss the numerical stability of calculating the Euler rates. What problems might arise in a computer implementation?

  9. A vector \(\vec{v}_0 = [3, 0, 0]^T\) in the global frame needs to be expressed in the body frame of a vehicle with Euler angles \(\phi = 30^{\circ}\), \(\theta = 45^{\circ}\), \(\psi = 30^{\circ}\). Calculate \(\vec{v}\).

  10. A vehicle moves from orientation 1 (\(\phi_1 = 10^{\circ}\), \(\theta_1 = 15^{\circ}\), \(\psi_1 = 5^{\circ}\)) to orientation 2 (\(\phi_2 = 45^{\circ}\), \(\theta_2 = 30^{\circ}\), \(\psi_2 = 60^{\circ}\)) in \(2\) seconds. Assuming constant angular velocity during this motion, calculate the unit vector in the direction of the body-frame angular velocity vector.

    Hint: The eigen vector of the rotation matrix corresponding to eigen value 1 is the direction of the axis of rotation. The other two eigen values are complex numbers and represent \(e^{\pm i\beta}\) where \(\beta\) is the angle of rotation.

    Challenge Question: Compute the body-frame angular velocity vector.

  11. Given two orientations of a vehicle:

    • Initial: \(\phi_1 = 30^{\circ}\), \(\theta_1 = 20^{\circ}\), \(\psi_1 = 45^{\circ}\)
    • Final: \(\phi_2 = 45^{\circ}\), \(\theta_2 = 30^{\circ}\), \(\psi_2 = 60^{\circ}\)

    Calculate the relative rotation (in Euler angles) required to move from the initial to the final orientation.

  12. A ship is equipped with three rate gyros mounted at angles relative to the body frame. The gyros are mounted as follows:

    • Gyro 1: \(30^{\circ}\) rotation about \(z\)-axis from \(x\)-axis
    • Gyro 2: \(45^{\circ}\) rotation about \(x\)-axis from \(y\)-axis
    • Gyro 3: \(60^{\circ}\) rotation about \(y\)-axis from \(z\)-axis

    If the gyros measure angular rates of \([0.5, 0.3, 0.4]\) rad/s respectively, determine the angular velocity components \([p, q, r]\) in the body frame.

  13. Two orthogonal unit vectors fixed in the body frame, initially aligned with the body x and y axes, are measured in the global frame as:

    • \(v_1 = [0.3536, -0.3536, -0.8660]^T\)
    • \(v_2 = [0.9186, 0.3062, 0.2500]^T\)

    Determine the vehicle’s orientation (Euler angles).

  14. Programming Problem: A vehicle starts at position \([10, 0, 0]\) meters with velocity \([1, 2, 3]\) m/s in the global frame. If it maintains a constant angular velocity of \(0.1\) rad/s about the global z-axis, calculate its position and velocity after \(5\) seconds.

  15. Programming Problem: A vehicle starts at orientation \(\phi_0 = 20^{\circ}\), \(\theta_0 = 30^{\circ}\), \(\psi_0 = 45^{\circ}\) and experiences a time-varying angular velocity for \(1\) second:

    • \(p(t) = 0.1\cos(t)\) rad/s
    • \(q(t) = 0.2\sin(t)\) rad/s
    • \(r(t) = 0.15\) rad/s

    Calculate the final orientation using numerical integration.

Answer Key

  1. Rotation matrix \(\boldsymbol{R} = \begin{bmatrix} 0.3536 & -0.5732 & 0.7392 \\ 0.6124 & 0.7392 & 0.2803 \\ -0.7071 & 0.3536 & 0.6124 \end{bmatrix}\)

  2. Global frame velocity is \(\vec{v} = [-0.2357, 1.8238, -1.3668]^T\) m/s

  3. Euler rates are \(\dot{\phi} = 0.0462\) rad/s, \(\dot{\theta} = 0.2320\) rad/s, \(\dot{\psi} = -0.1075\) rad/s

  4. The vehicle is NOT close to gimbal lock because \(\theta = 60.0^\circ\) is NOT close to \(90^\circ\)

  5. Vector in global frame is \(\vec{r} = [-0.9058, 2.2357, -0.4254]^T\)

  6. ZYX rotation matrix is \(\boldsymbol{R} = \begin{bmatrix} 0.3536 & -0.5732 & 0.7392 \\ 0.6124 & 0.7392 & 0.2803 \\ -0.7071 & 0.3536 & 0.6124 \end{bmatrix}\)

    XYZ rotation matrix is \(\boldsymbol{R} = \begin{bmatrix} 0.3536 & -0.6124 & 0.7071 \\ 0.9268 & 0.1268 & -0.3536 \\ 0.1268 & 0.7803 & 0.6124 \end{bmatrix}\)

  7. Heading rate is \(\dot{\psi} = -0.1542\) rad/s

  8. The Euler rates are numerically unstable because \(\theta = 85.0^\circ\) is close to \(90^\circ\)

  9. Vector in body frame is \(\vec{v} = [1.8371, -0.3805, 2.3410]^T\)

  10. Unit vector in the direction of the body-frame angular velocity vector is \(\vec{\omega} = [0.3701, 0.5621, 0.7396]^T\)

  11. Relative Euler angles are \(\phi = 9.4500^\circ\), \(\theta = 15.7355^\circ\), \(\psi = 6.0977^\circ\)

  12. Body angular rates are \(\vec{\omega} = [0.3971, 0.3121, 0.1121]^T\) rad/s

  13. Euler angles are \(\phi = 30^\circ\), \(\theta = 60^\circ\), \(\psi = -45^\circ\)

  14. Final position is \(\vec{r} = [12.2937, 10.8384, 15.0000]^T\) and final velocity is \(\vec{v} = [-0.0814, 2.2402, 3.0000]^T\)

  15. Final Euler angles are \(\phi = 30.7720^\circ\), \(\theta = 31.0238^\circ\), \(\psi = 56.8286^\circ\)