A library for three-dimensional, reference-frame conversions
Project description
Rotation of 3-dimensional Frames
Functions
This library includes four sets of functions: general array checks, attitude-representation conversions, reference-frame conversions, and rotation matrix (direction cosine matrix) utilities. The following table shows all the attitude-representation conversions provided, where 'Vector' is short for 'rotation vector,' 'RPY is short for 'roll, pitch, and yaw,' and 'DCM' is short for 'direction cosine matrix':
To \ From | Vector | Axis-angle | RPY | DCM | Quaternion |
---|---|---|---|---|---|
Vector | - | x | |||
Axis-angle | x | - | x | x | x |
RPY | x | - | x | x | |
DCM | x | x | - | x | |
Quaternion | x | x | x | - |
Because the conversion from rotation vector to axis-angle is so trivial, none of the other attitude representations have conversions to rotation vectors.
In addition to the conversion from the z, y, x sequence of Euler angles to a
DCM, the function rot
is also provided for creating a DCM from a generic set
of Euler angles in any desired sequence of axes. Although this rot
function
could be used, two additional functions are provided for generating rotation
matrices: dcm_inertial_to_ecef
and dcm_ecef_to_navigation
. By default, all
angles are treated as being in radians, but if the degs
parameter is set to
True, then they are treated as being in degrees.
This library includes all twelve possible conversions among the following four
frames: ECEF (Earth-centered, Earth-fixed), geodetic (latitude, longitude, and
height above ellipsoid), local-level tangent, and local-level curvilinear. By
default, all local-level coordinates are interpreted as having a North, East,
Down (NED) orientation, but if the ned
parameter is set to False, the
coordinates are interpreted as having an East, North, Up (ENU) orientation.
The rotation matrix utility functions are an orthonormalize_dcm
function, a
rodrigues_rotation
function, and an inverse_rodrigues_rotation
function. The
orthonormalize_dcm
function will work to make a rotation matrix normalized and
orthogonal, a proper rotation matrix. The two Rodrigues's rotation functions are
meant for converting a vector to the matrix exponential of the skew-symmetric
matrix of that vector and back again.
Passive Rotations
Unless specifically otherwise stated, all rotations are interpreted as passive. This means they represent rotations of reference frames, not of vectors.
Vectorization
When possible, the functions are vectorized in order to handle processing
batches of values. A set of scalars is a 1D array. A set of vectors is a 2D
array, with each vector in a column. So, a (3, 7) array is a set of seven
vectors, each with 3 elements. If the axis
parameter is set to 0, the
transpose is true. A set of matrices is a 3D array with each matrix in a stack.
The first index is the stack number. So, a (5, 3, 3) array is a stack of five
3x3 matrices. Roll, pitch, and yaw are not treated as a vector but as three
separate quantities. The same is true for latitude, longitude, and height above
ellipsoid. A quaternion is passed around as an array.
Robustness
In general, the functions in this library check that the inputs are of the correct type and shape. They do not generally handle converting inputs which do not conform to the ideal type and shape. Generally, the allowed types are int, float, list, and np.ndarray.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.