giant.rotationsΒΆ

This module defines a number of useful routines for converting between various attitude and rotation representations as well as a class which acts as the primary way to express attitude and rotation data in GIANT.

There are a few different rotation representations that are used in this module and their format is described as follows:

Representation

Description

quaternion

A 4 element rotation quaternion of the form \(\mathbf{q}=\left[\begin{array}{c} q_x \\ q_y \\ q_z \\ q_s\end{array}\right]= \left[\begin{array}{c}\text{sin}(\frac{\theta}{2})\hat{\mathbf{x}}\\ \text{cos}(\frac{\theta}{2})\end{array}\right]\) where \(\hat{\mathbf{x}}\) is a 3 element unit vector representing the axis of rotation and \(\theta\) is the total angle to rotate about that vector. Note that quaternions are not unique in that the rotation represented by \(\mathbf{q}\) is the same rotation represented by \(-\mathbf{q}\).

rotation vector

A 3 element rotation vector of the form \(\mathbf{v}=\theta\hat{\mathbf{x}}\) where \(\theta\) is the total angle to rotate by in radians and \(\hat{\mathbf{x}}\) is the rotation axis. Note that rotation vectors are not unique as there is a long and a short vector that both represent the same rotation.

rotation matrix

A \(3\times 3\) orthonormal matrix representing a rotation such that \(\mathbf{T}_B^A\mathbf{y}_A\) rotates the 3 element position/direction vector \(\mathbf{y}_A\) from frame \(A\) to \(B\) where \(\mathbf{T}_B^A\) is the rotation matrix from \(A\) to \(B\). Rotation matrices uniquely represent a single rotation.

euler angles

A sequence of 3 angles corresponding to a rotation about 3 unit axes. There are 12 different axis combinations for euler angles. Mathematically they relate to the rotation matrix as \(\mathbf{T}=\mathbf{R}_3(c)\mathbf{R}_2(b)\mathbf{R}_1(a)\) where \(\mathbf{R}_i(\theta)\) represents a rotation about axis \(i\) (either x, y, or z) by angle \(\theta\), \(a\) is the angle to rotate about the first axis, \(b\) is angle to rotate about the second axis, and \(c\) is the angle to rotate about the third axis.

The Rotation object is the primary tool that will be used by users. It offers a convenient constructor which accepts 3 common rotation representations to initialize the object. It also offers operator overloading to allow a sequence of rotations to be performed using the standard multiplication operator *. Finally, it offers properties of the three most common rotation representations (quaternion, matrix, rotation vector).

In addition, there are also a number of utilities provided in this module for converting between different representations of attitudes and rotations, as well as for working with this data.

Classes

Rotation

A class to represent and manipulate rotations in GIANT.

Functions

quaternion_inverse

This function provides the inverse of a rotation quaternion of the form discussed in Rotation Representations.

quaternion_multiplication

This function performs the hamiltonian quaternion multiplication operation.

quaternion_to_rotvec

This function converts a rotation quaternion into a rotation vector of the form discussed in Rotation Representations.

quaternion_to_rotmat

This function converts an attitude quaternion into its equivalent rotation matrix of the form discussed in Rotation Representations.

quaternion_to_euler

This function converts a rotation quaternion to 3 euler angles to be applied to the axes specified in order.

rotvec_to_rotmat

This function converts a rotation vector to a rotation matrix according to the form specified in Rotation Representations.

rotvec_to_quaternion

This function converts a rotation vector given as a 3 element Sequence into a rotation quaternion of the form discussed in Rotation Representations.

rotmat_to_quaternion

This function converts a rotation matrix into a rotation quaternion of the form discussed in Rotation Representations.

rotmat_to_euler

This function converts a rotation matrix to 3 euler angles to be applied to the axes specified in order.

euler_to_rotmat

This function converts a sequence of 3 euler angles into a rotation matrix.

rot_x

This function performs a right handed rotation about the x axis by angle theta.

rot_y

This function performs a right handed rotation about the y axis by angle theta.

rot_z

This function performs a right handed rotation about the z axis by angle theta.

skew

This function returns a numpy array with the skew symmetric cross product matrix for vector.

nlerp

This function performs normalized linear interpolation of rotation quaternions.

slerp

This function performs spherical linear interpolation of rotation quaternions.