30 #include "generated/airframe.h"
35 #define TWO_ZETA_OMEGA_RES 10
36 #define TWO_OMEGA_2_RES 7
65 struct FloatRates omega0 = {STABILIZATION_ATTITUDE_REF_OMEGA_P,
66 STABILIZATION_ATTITUDE_REF_OMEGA_Q,
67 STABILIZATION_ATTITUDE_REF_OMEGA_R};
68 struct FloatRates zeta0 = {STABILIZATION_ATTITUDE_REF_ZETA_P,
69 STABILIZATION_ATTITUDE_REF_ZETA_Q,
70 STABILIZATION_ATTITUDE_REF_ZETA_R};
92 #define F_UPDATE_RES 9
94 #define OFFSET_AND_ROUND(_a, _b) (((_a)+(1<<((_b)-1)))>>(_b))
101 float dt __attribute__((unused)))
int32_t psi
in rad with INT32_ANGLE_FRAC
static void attitude_ref_int_saturate_naive(struct Int32Rates *rate, struct Int32Rates *accel, struct Int32RefSat *sat)
void attitude_ref_quat_int_init(struct AttRefQuatInt *ref)
struct Int32Rates rate
with REF_RATE_FRAC
static void int32_quat_normalize(struct Int32Quat *q)
normalize a quaternion inplace
void attitude_ref_quat_int_set_omega_r(struct AttRefQuatInt *ref, float omega_r)
void int32_quat_inv_comp(struct Int32Quat *b2c, struct Int32Quat *a2b, struct Int32Quat *a2c)
Composition (multiplication) of two quaternions.
static const float zeta_p[]
void attitude_ref_quat_int_set_max_p(struct AttRefQuatInt *ref, float max_p)
#define RATES_ADD(_a, _b)
void attitude_ref_quat_int_set_zeta_p(struct AttRefQuatInt *ref, float zeta_p)
void int32_quat_of_eulers(struct Int32Quat *q, struct Int32Eulers *e)
Quaternion from Euler angles.
#define INT_RATES_ZERO(_e)
void int32_quat_derivative(struct Int32Quat *qd, const struct Int32Rates *r, struct Int32Quat *q)
Quaternion derivative from rotational velocity.
#define STABILIZATION_ATTITUDE_REF_MAX_QDOT
static void update_ref_model_r(struct AttRefQuatInt *ref)
void attitude_ref_quat_int_enter(struct AttRefQuatInt *ref, int32_t psi)
static const float omega_r[]
void attitude_ref_quat_int_set_omega_p(struct AttRefQuatInt *ref, float omega_p)
struct Int32Rates two_zeta_omega
#define STABILIZATION_ATTITUDE_REF_MAX_RDOT
void attitude_ref_quat_int_set_max_qdot(struct AttRefQuatInt *ref, float max_qdot)
static const float zeta_r[]
#define BFP_OF_REAL(_vr, _frac)
int32_t r
in rad/s with INT32_RATE_FRAC
static const float zeta_q[]
void attitude_ref_quat_int_set_zeta_r(struct AttRefQuatInt *ref, float zeta_r)
static const float omega_q[]
void attitude_ref_quat_int_set_max_rdot(struct AttRefQuatInt *ref, float max_rdot)
static void reset_psi_ref(struct AttRefQuatInt *ref, int32_t psi)
#define TWO_ZETA_OMEGA_RES
static void update_ref_model_p(struct AttRefQuatInt *ref)
void attitude_ref_quat_int_set_max_q(struct AttRefQuatInt *ref, float max_q)
#define RATES_SUM(_c, _a, _b)
void attitude_ref_quat_int_update(struct AttRefQuatInt *ref, struct Int32Quat *sp_quat, float dt)
Propagate reference.
static void int32_quat_identity(struct Int32Quat *q)
initialises a quaternion to identity
static void update_ref_model_q(struct AttRefQuatInt *ref)
void attitude_ref_quat_int_set_omega_q(struct AttRefQuatInt *ref, float omega_q)
struct Int32RefSat saturation
struct Int32Eulers euler
with INT32_ANGLE_FRAC
struct Int32Rates two_omega2
void int32_eulers_of_quat(struct Int32Eulers *e, struct Int32Quat *q)
void attitude_ref_quat_int_set_omega(struct AttRefQuatInt *ref, struct FloatRates *omega)
static void update_ref_model(struct AttRefQuatInt *ref)
Default values for attitude reference saturation.
#define INT_EULERS_ZERO(_e)
Attitude reference models and state/output (quat int)
#define OFFSET_AND_ROUND(_a, _b)
void attitude_ref_quat_int_set_zeta(struct AttRefQuatInt *ref, struct FloatRates *zeta)
static void int32_quat_wrap_shortest(struct Int32Quat *q)
struct Int32Rates accel
with REF_ACCEL_FRAC
static const float omega_p[]
int32_t p
in rad/s with INT32_RATE_FRAC
#define STABILIZATION_ATTITUDE_REF_MAX_R
struct Int32Rates max_rate
void attitude_ref_quat_int_set_max_pdot(struct AttRefQuatInt *ref, float max_pdot)
struct Int32Rates max_accel
#define STABILIZATION_ATTITUDE_REF_MAX_Q
#define STABILIZATION_ATTITUDE_REF_MAX_PDOT
#define QUAT_ADD(_qo, _qi)
#define STABILIZATION_ATTITUDE_REF_MAX_P
void attitude_ref_quat_int_set_max_r(struct AttRefQuatInt *ref, float max_r)
int32_t q
in rad/s with INT32_RATE_FRAC
Rotorcraft attitude reference generation.
void attitude_ref_quat_int_set_zeta_q(struct AttRefQuatInt *ref, float zeta_q)