|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
29 #define INT32_SQRT_MAX_ITER 40
77 m_a2c->
m[0] = (m_b2c->
m[0] * m_a2b->
m[0] + m_b2c->
m[1] * m_a2b->
m[3] + m_b2c->
m[2] * m_a2b->
m[6]) >>
INT32_TRIG_FRAC;
78 m_a2c->
m[1] = (m_b2c->
m[0] * m_a2b->
m[1] + m_b2c->
m[1] * m_a2b->
m[4] + m_b2c->
m[2] * m_a2b->
m[7]) >>
INT32_TRIG_FRAC;
79 m_a2c->
m[2] = (m_b2c->
m[0] * m_a2b->
m[2] + m_b2c->
m[1] * m_a2b->
m[5] + m_b2c->
m[2] * m_a2b->
m[8]) >>
INT32_TRIG_FRAC;
80 m_a2c->
m[3] = (m_b2c->
m[3] * m_a2b->
m[0] + m_b2c->
m[4] * m_a2b->
m[3] + m_b2c->
m[5] * m_a2b->
m[6]) >>
INT32_TRIG_FRAC;
81 m_a2c->
m[4] = (m_b2c->
m[3] * m_a2b->
m[1] + m_b2c->
m[4] * m_a2b->
m[4] + m_b2c->
m[5] * m_a2b->
m[7]) >>
INT32_TRIG_FRAC;
82 m_a2c->
m[5] = (m_b2c->
m[3] * m_a2b->
m[2] + m_b2c->
m[4] * m_a2b->
m[5] + m_b2c->
m[5] * m_a2b->
m[8]) >>
INT32_TRIG_FRAC;
83 m_a2c->
m[6] = (m_b2c->
m[6] * m_a2b->
m[0] + m_b2c->
m[7] * m_a2b->
m[3] + m_b2c->
m[8] * m_a2b->
m[6]) >>
INT32_TRIG_FRAC;
84 m_a2c->
m[7] = (m_b2c->
m[6] * m_a2b->
m[1] + m_b2c->
m[7] * m_a2b->
m[4] + m_b2c->
m[8] * m_a2b->
m[7]) >>
INT32_TRIG_FRAC;
85 m_a2c->
m[8] = (m_b2c->
m[6] * m_a2b->
m[2] + m_b2c->
m[7] * m_a2b->
m[5] + m_b2c->
m[8] * m_a2b->
m[8]) >>
INT32_TRIG_FRAC;
93 m_a2b->
m[0] = (m_b2c->
m[0] * m_a2c->
m[0] + m_b2c->
m[3] * m_a2c->
m[3] + m_b2c->
m[6] * m_a2c->
m[6]) >>
INT32_TRIG_FRAC;
94 m_a2b->
m[1] = (m_b2c->
m[0] * m_a2c->
m[1] + m_b2c->
m[3] * m_a2c->
m[4] + m_b2c->
m[6] * m_a2c->
m[7]) >>
INT32_TRIG_FRAC;
95 m_a2b->
m[2] = (m_b2c->
m[0] * m_a2c->
m[2] + m_b2c->
m[3] * m_a2c->
m[5] + m_b2c->
m[6] * m_a2c->
m[8]) >>
INT32_TRIG_FRAC;
96 m_a2b->
m[3] = (m_b2c->
m[1] * m_a2c->
m[0] + m_b2c->
m[4] * m_a2c->
m[3] + m_b2c->
m[7] * m_a2c->
m[6]) >>
INT32_TRIG_FRAC;
97 m_a2b->
m[4] = (m_b2c->
m[1] * m_a2c->
m[1] + m_b2c->
m[4] * m_a2c->
m[4] + m_b2c->
m[7] * m_a2c->
m[7]) >>
INT32_TRIG_FRAC;
98 m_a2b->
m[5] = (m_b2c->
m[1] * m_a2c->
m[2] + m_b2c->
m[4] * m_a2c->
m[5] + m_b2c->
m[7] * m_a2c->
m[8]) >>
INT32_TRIG_FRAC;
99 m_a2b->
m[6] = (m_b2c->
m[2] * m_a2c->
m[0] + m_b2c->
m[5] * m_a2c->
m[3] + m_b2c->
m[8] * m_a2c->
m[6]) >>
INT32_TRIG_FRAC;
100 m_a2b->
m[7] = (m_b2c->
m[2] * m_a2c->
m[1] + m_b2c->
m[5] * m_a2c->
m[4] + m_b2c->
m[8] * m_a2c->
m[7]) >>
INT32_TRIG_FRAC;
101 m_a2b->
m[8] = (m_b2c->
m[2] * m_a2c->
m[2] + m_b2c->
m[5] * m_a2c->
m[5] + m_b2c->
m[8] * m_a2c->
m[8]) >>
INT32_TRIG_FRAC;
162 rm->
m[0] += _2qi2_m1;
163 rm->
m[3] = rm->
m[1] - _2qiqz;
164 rm->
m[6] = rm->
m[2] + _2qiqy;
165 rm->
m[7] = rm->
m[5] - _2qiqx;
166 rm->
m[4] += _2qi2_m1;
170 rm->
m[8] += _2qi2_m1;
211 RMAT_ELMT(*rm, 1, 0) = sphi_stheta_cpsi - cphi_spsi;
212 RMAT_ELMT(*rm, 1, 1) = sphi_stheta_spsi + cphi_cpsi;
214 RMAT_ELMT(*rm, 2, 0) = cphi_stheta_cpsi + sphi_spsi;
215 RMAT_ELMT(*rm, 2, 1) = cphi_stheta_spsi - sphi_cpsi;
251 RMAT_ELMT(*rm, 0, 0) = ctheta_cpsi - sphi_stheta_spsi;
252 RMAT_ELMT(*rm, 0, 1) = ctheta_spsi + sphi_stheta_cpsi;
257 RMAT_ELMT(*rm, 2, 0) = stheta_cpsi + sphi_ctheta_spsi;
258 RMAT_ELMT(*rm, 2, 1) = stheta_spsi - sphi_ctheta_cpsi;
365 v_out->
x = (_2qi2_m1 * v_in->
x + _2qx2 * v_in->
x + m01 * v_in->
y + m02 * v_in->
z) >>
INT32_QUAT_FRAC;
366 v_out->
y = (_2qi2_m1 * v_in->
y + m01 * v_in->
x - 2 * _2qiqz * v_in->
x + _2qy2 * v_in->
y + m12 * v_in->
z) >>
368 v_out->
z = (_2qi2_m1 * v_in->
z + m02 * v_in->
x + 2 * _2qiqy * v_in->
x + m12 * v_in->
y - 2 * _2qiqx * v_in->
y + _2qz2 *
513 BoundAbs(dcm02, 1.0);
515 const float phi = atan2f(dcm12, dcm22);
516 const float theta = -asinf(dcm02);
517 const float psi = atan2f(dcm01, dcm00);
559 BoundAbs(dcm02, 1.0);
561 const float phi = atan2f(dcm12, dcm22);
562 const float theta = -asinf(dcm02);
563 const float psi = atan2f(dcm01, dcm00);
void int32_quat_of_eulers(struct Int32Quat *q, struct Int32Eulers *e)
Quaternion from Euler angles.
int32_t theta
in rad with INT32_ANGLE_FRAC
void int32_rmat_of_eulers_321(struct Int32RMat *rm, struct Int32Eulers *e)
Rotation matrix from 321 Euler angles.
void int32_eulers_dot_321_of_rates(struct Int32Eulers *ed, struct Int32Eulers *e, struct Int32Rates *r)
void int32_eulers_of_rmat(struct Int32Eulers *e, struct Int32RMat *rm)
int32_t q
in rad/s with INT32_RATE_FRAC
void int32_quat_comp(struct Int32Quat *a2c, struct Int32Quat *a2b, struct Int32Quat *b2c)
Composition (multiplication) of two quaternions.
#define PPRZ_ITRIG_COS(_c, _a)
#define INT_EULERS_ZERO(_e)
void int32_quat_derivative(struct Int32Quat *qd, const struct Int32Rates *r, struct Int32Quat *q)
Quaternion derivative from rotational velocity.
static void int32_quat_normalize(struct Int32Quat *q)
normalize a quaternion inplace
void int32_eulers_of_quat(struct Int32Eulers *e, struct Int32Quat *q)
void int32_quat_inv_comp_norm_shortest(struct Int32Quat *b2c, struct Int32Quat *a2b, struct Int32Quat *a2c)
Composition (multiplication) of two quaternions with normalization.
void int32_quat_inv_comp(struct Int32Quat *b2c, struct Int32Quat *a2b, struct Int32Quat *a2c)
Composition (multiplication) of two quaternions.
void int32_quat_of_rmat(struct Int32Quat *q, struct Int32RMat *r)
Quaternion from rotation matrix.
Paparazzi fixed point algebra.
static void int32_quat_wrap_shortest(struct Int32Quat *q)
void int32_quat_comp_inv(struct Int32Quat *a2b, struct Int32Quat *a2c, struct Int32Quat *b2c)
Composition (multiplication) of two quaternions.
int32_t p
in rad/s with INT32_RATE_FRAC
#define TRIG_FLOAT_OF_BFP(_ti)
void int32_rmat_of_eulers_312(struct Int32RMat *rm, struct Int32Eulers *e)
Rotation matrix from 312 Euler angles.
int32_t psi
in rad with INT32_ANGLE_FRAC
int32_t phi
in rad with INT32_ANGLE_FRAC
void int32_quat_vmult(struct Int32Vect3 *v_out, struct Int32Quat *q, struct Int32Vect3 *v_in)
rotate 3D vector by quaternion.
void int32_rmat_transp_vmult(struct Int32Vect3 *vb, struct Int32RMat *m_b2a, struct Int32Vect3 *va)
rotate 3D vector by transposed rotation matrix.
void int32_quat_of_axis_angle(struct Int32Quat *q, struct Int32Vect3 *uv, int32_t angle)
Quaternion from unit vector and angle.
void int32_rmat_comp(struct Int32RMat *m_a2c, struct Int32RMat *m_a2b, struct Int32RMat *m_b2c)
Composition (multiplication) of two rotation matrices.
#define ANGLE_BFP_OF_REAL(_af)
void int32_rmat_ratemult(struct Int32Rates *rb, struct Int32RMat *m_a2b, struct Int32Rates *ra)
rotate anglular rates by rotation matrix.
#define INT_MULT_RSHIFT(_a, _b, _r)
#define RMAT_ELMT(_rm, _row, _col)
uint32_t int32_sqrt(uint32_t in)
#define INT32_SQRT_MAX_ITER
void int32_rmat_comp_inv(struct Int32RMat *m_a2b, struct Int32RMat *m_a2c, struct Int32RMat *m_b2c)
Composition (multiplication) of two rotation matrices.
void int32_rmat_vmult(struct Int32Vect3 *vb, struct Int32RMat *m_a2b, struct Int32Vect3 *va)
rotate 3D vector by rotation matrix.
void int32_rmat_transp_ratemult(struct Int32Rates *rb, struct Int32RMat *m_b2a, struct Int32Rates *ra)
rotate anglular rates by transposed rotation matrix.
void int32_quat_comp_norm_shortest(struct Int32Quat *a2c, struct Int32Quat *a2b, struct Int32Quat *b2c)
Composition (multiplication) of two quaternions with normalization.
uint32_t int32_gcd(uint32_t a, uint32_t b)
void int32_rates_of_eulers_dot_321(struct Int32Rates *r, struct Int32Eulers *e, struct Int32Eulers *ed)
void int32_rmat_of_quat(struct Int32RMat *rm, struct Int32Quat *q)
Convert unit quaternion to rotation matrix.
void int32_quat_integrate_fi(struct Int32Quat *q, struct Int64Quat *hr, struct Int32Rates *omega, int freq)
in place quaternion first order integration with constant rotational velocity.
void int32_quat_comp_inv_norm_shortest(struct Int32Quat *a2b, struct Int32Quat *a2c, struct Int32Quat *b2c)
Composition (multiplication) of two quaternions with normalization.
#define QUAT1_BFP_OF_REAL(_qf)
#define TRIG_BFP_OF_REAL(_tf)
int32_t r
in rad/s with INT32_RATE_FRAC
#define PPRZ_ITRIG_SIN(_s, _a)