5static void set_nan_matrix(
double dcm[3][3]) {
9 for (
int row = 0; row < 3; ++row) {
10 for (
int column = 0; column < 3; ++column) {
11 dcm[row][column] = NAN;
18 !isfinite(e->
roll) || !isfinite(e->
pitch) || !isfinite(e->
yaw)) {
22 double cr = cos(e->
roll);
23 double sr = sin(e->
roll);
24 double cp = cos(e->
pitch);
25 double sp = sin(e->
pitch);
26 double cy = cos(e->
yaw);
27 double sy = sin(e->
yaw);
30 dcm[0][1] = cy*sp*sr - sy*cr;
31 dcm[0][2] = cy*sp*cr + sy*sr;
33 dcm[1][1] = sy*sp*sr + cy*cr;
34 dcm[1][2] = sy*sp*cr - cy*sr;
49 !isfinite(e->
roll) || !isfinite(e->
pitch) || !isfinite(e->
yaw)) {
53 double cr = cos(e->
roll/2.0);
54 double sr = sin(e->
roll/2.0);
55 double cp = cos(e->
pitch/2.0);
56 double sp = sin(e->
pitch/2.0);
57 double cy = cos(e->
yaw/2.0);
58 double sy = sin(e->
yaw/2.0);
60 q[0] = cr*cp*cy + sr*sp*sy;
61 q[1] = sr*cp*cy - cr*sp*sy;
62 q[2] = cr*sp*cy + sr*cp*sy;
63 q[3] = cr*cp*sy - sr*sp*cy;
69 for (
int index = 0; index < 4; ++index) {
int euler_to_quaternion_checked(const EulerAngles *e, double q[4])
Checked Euler-to-quaternion conversion.
void euler_to_dcm(const EulerAngles *e, double dcm[3][3])
Convert Euler angles to a direction cosine matrix.
void euler_to_quaternion(const EulerAngles *e, double q[4])
Convert Euler angles to a quaternion.
int euler_to_dcm_checked(const EulerAngles *e, double dcm[3][3])
Checked Euler-to-DCM conversion.
@ EULER_ZYX
Standard aerospace yaw → pitch → roll sequence.
Storage for Euler angles with an associated rotation order.
double pitch
Rotation about y-axis.
double yaw
Rotation about z-axis.
EulerOrder order
Intrinsic rotation order.
double roll
Rotation about x-axis.