30 #include "generated/airframe.h"
36 #ifndef STABILIZATION_ATTITUDE_REF_QUAT_INFINITESIMAL_STEP
37 #define STABILIZATION_ATTITUDE_REF_QUAT_INFINITESIMAL_STEP TRUE
42 static const float omega_p[] = STABILIZATION_ATTITUDE_REF_OMEGA_P;
43 static const float zeta_p[] = STABILIZATION_ATTITUDE_REF_ZETA_P;
44 static const float omega_q[] = STABILIZATION_ATTITUDE_REF_OMEGA_Q;
45 static const float zeta_q[] = STABILIZATION_ATTITUDE_REF_ZETA_Q;
46 static const float omega_r[] = STABILIZATION_ATTITUDE_REF_OMEGA_R;
47 static const float zeta_r[] = STABILIZATION_ATTITUDE_REF_ZETA_R;
92 #if STABILIZATION_ATTITUDE_REF_QUAT_INFINITESIMAL_STEP
120 ref->accel.p = -2.*
ref->model[
ref->cur_idx].zeta.p *
ref->model[
ref->cur_idx].omega.p *
ref->rate.p -
121 ref->model[
ref->cur_idx].two_omega2.p * err.
qx;
122 ref->accel.q = -2.*
ref->model[
ref->cur_idx].zeta.q *
ref->model[
ref->cur_idx].omega.q *
ref->rate.q -
123 ref->model[
ref->cur_idx].two_omega2.q * err.
qy;
124 ref->accel.r = -2.*
ref->model[
ref->cur_idx].zeta.r *
ref->model[
ref->cur_idx].omega.r *
ref->rate.r -
125 ref->model[
ref->cur_idx].two_omega2.r * err.
qz;
142 ref->model[
idx].omega.p = omega;
143 ref->model[
idx].two_omega2.p = 2 * omega * omega;
148 ref->model[
idx].omega.q = omega;
149 ref->model[
idx].two_omega2.q = 2 * omega * omega;
154 ref->model[
idx].omega.r = omega;
155 ref->model[
idx].two_omega2.r = 2 * omega * omega;
static void attitude_ref_float_saturate_naive(struct FloatRates *rate, struct FloatRates *accel, struct FloatRefSat *sat)
static void float_quat_normalize(struct FloatQuat *q)
static void float_quat_identity(struct FloatQuat *q)
initialises a quaternion to identity
void float_quat_inv_comp(struct FloatQuat *b2c, struct FloatQuat *a2b, struct FloatQuat *a2c)
Composition (multiplication) of two quaternions.
#define FLOAT_EULERS_ZERO(_e)
static void float_quat_wrap_shortest(struct FloatQuat *q)
void float_eulers_of_quat(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'ZYX'
#define FLOAT_RATES_ZERO(_r)
void float_quat_comp(struct FloatQuat *a2c, struct FloatQuat *a2b, struct FloatQuat *b2c)
Composition (multiplication) of two quaternions.
void float_quat_differential(struct FloatQuat *q_out, struct FloatRates *w, float dt)
Delta rotation quaternion with constant angular rates.
void float_quat_derivative(struct FloatQuat *qd, struct FloatRates *r, struct FloatQuat *q)
Quaternion derivative from rotational velocity.
#define RATES_ASSIGN(_ra, _p, _q, _r)
#define RATES_SMUL(_ro, _ri, _s)
#define QUAT_COPY(_qo, _qi)
#define RATES_ADD(_a, _b)
#define QUAT_SMUL(_qo, _qi, _s)
#define QUAT_ADD(_qo, _qi)
#define STABILIZATION_ATTITUDE_GAIN_NB
Default values for attitude reference saturation.
#define STABILIZATION_ATTITUDE_REF_MAX_P
#define STABILIZATION_ATTITUDE_REF_MAX_PDOT
#define STABILIZATION_ATTITUDE_REF_MAX_QDOT
#define STABILIZATION_ATTITUDE_REF_MAX_Q
#define STABILIZATION_ATTITUDE_REF_MAX_RDOT
#define STABILIZATION_ATTITUDE_REF_MAX_R
static const float omega_r[]
void attitude_ref_quat_float_set_omega_q(struct AttRefQuatFloat *ref, float omega)
static const float zeta_r[]
void attitude_ref_quat_float_update(struct AttRefQuatFloat *ref, struct FloatQuat *sp_quat, float dt)
void attitude_ref_quat_float_idx_set_omega_p(struct AttRefQuatFloat *ref, uint8_t idx, float omega)
void attitude_ref_quat_float_enter(struct AttRefQuatFloat *ref, struct FloatQuat *state_quat)
static const float omega_q[]
static const float omega_p[]
void attitude_ref_quat_float_set_omega_r(struct AttRefQuatFloat *ref, float omega)
void attitude_ref_quat_float_idx_set_omega_q(struct AttRefQuatFloat *ref, uint8_t idx, float omega)
static const float zeta_q[]
void attitude_ref_quat_float_idx_set_omega_r(struct AttRefQuatFloat *ref, uint8_t idx, float omega)
void attitude_ref_quat_float_set_omega_p(struct AttRefQuatFloat *ref, float omega)
void attitude_ref_quat_float_init(struct AttRefQuatFloat *ref)
static const float zeta_p[]
void attitude_ref_quat_float_schedule(struct AttRefQuatFloat *ref, uint8_t idx)
Rotorcraft attitude reference generation.
Attitude reference models and state/output (float)
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.