pfh.glidersim.orientation#

Utility functions for manipulating orientation encodings.

Functions

dcm_to_euler(dcm[, intrinsic])

Convert a DCM to a set of yaw-pitch-roll Tait-Bryan angles.

euler_to_dcm(euler[, intrinsic])

Convert a set of yaw-pitch-roll Tait-Bryan angles to a DCM.

euler_to_quaternion(euler)

Convert a set of intrinsic yaw-pitch-roll Tait-Bryan angles to a quaternion.

quaternion_to_dcm(q)

Convert a quaternion to a DCM.

quaternion_to_euler(q)

Convert a quaternion to a set of intrinsic yaw-pitch-roll Tait-Bryan angles.

pfh.glidersim.orientation.dcm_to_euler(dcm, intrinsic: bool = True)#

Convert a DCM to a set of yaw-pitch-roll Tait-Bryan angles.

Intrinsic rotation: z-y’-x’’ Extrinsic rotation: z-y-x

Parameters
dcmndarray of float, shape (…,3,3)

A direction cosine matrix.

intrinsicbool, optional

Whether the sequence encodes an intrinsic or extrinsic rotation.

Returns
array of float, shape (…,3) [radians]

The (roll, pitch, yaw) angles of a yaw-pitch-roll sequence.

pfh.glidersim.orientation.euler_to_dcm(euler, intrinsic: bool = True)#

Convert a set of yaw-pitch-roll Tait-Bryan angles to a DCM.

Intrinsic rotation: z-y’-x’’ Extrinsic rotation: z-y-x

Parameters
eulerarray of float, shape (…,3) [radians]

The (roll, pitch, yaw) angles of a yaw-pitch-roll sequence.

intrinsicbool, optional

Whether the sequence encodes an intrinsic or extrinsic rotation.

FIXME: explain how extrinsic rotations are useful for computing vectors in wind axes: C_w2b = euler_to_dcm([0, -alpha, beta])

Returns
ndarray of float, shape (…,3,3)

The direction cosine matrix that would apply the given rotation

pfh.glidersim.orientation.euler_to_quaternion(euler)#

Convert a set of intrinsic yaw-pitch-roll Tait-Bryan angles to a quaternion.

Parameters
eulerarray of float, shape (3,) [radians]

The (roll, pitch, yaw) angles of a yaw-pitch-roll sequence.

Returns
qarray of float, shape (4,)

The quaternion that encodes the given rotation

pfh.glidersim.orientation.quaternion_to_dcm(q)#

Convert a quaternion to a DCM.

pfh.glidersim.orientation.quaternion_to_euler(q)#

Convert a quaternion to a set of intrinsic yaw-pitch-roll Tait-Bryan angles.

Parameters
qarray_like of float, shape (K,4)

The components of the quaternion(s)

Returns
varray_like of float, shape (K,3)

The [roll, pitch, yaw] angles (phi, theta, gamma) of a Tait-Bryan yaw-pitch-roll sequence.