32 #include "message_pragmas.h"
44 #if PERIODIC_TELEMETRY
47 static void send_att(
struct transport_tx *trans,
struct link_device *
dev)
55 pprz_msg_send_AHRS_EULER_INT(trans,
dev, AC_ID,
67 pprz_msg_send_GEO_MAG(trans,
dev, AC_ID,
80 if (t_diff > 50000) { mde = 5; }
90 #ifndef AHRS_FINV_IMU_ID
91 #define AHRS_FINV_IMU_ID ABI_BROADCAST
96 #ifndef AHRS_FINV_MAG_ID
97 #define AHRS_FINV_MAG_ID AHRS_FINV_IMU_ID
118 #if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY)
124 float dt = (float)(stamp - last_stamp) * 1e-6;
130 PRINT_CONFIG_MSG(
"Using fixed AHRS_PROPAGATE_FREQUENCY for AHRS float_invariant propagation.")
143 uint32_t stamp __attribute__((unused)),
154 uint32_t stamp __attribute__((unused)),
165 uint32_t stamp __attribute__((unused)),
220 #if PERIODIC_TELEMETRY
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
Main include for ABI (AirBorneInterface).
#define ABI_BROADCAST
Broadcast address.
Event structure to store callbacks in a linked list.
#define AHRS_COMP_ID_FINV
struct AhrsFloatInv ahrs_float_inv
void ahrs_float_invariant_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag)
void ahrs_float_invariant_init(void)
void ahrs_float_invariant_propagate(struct FloatRates *gyro, float dt)
void ahrs_float_invariant_update_accel(struct FloatVect3 *accel)
void ahrs_float_invariant_update_mag(struct FloatVect3 *mag)
struct inv_command cmd
command vector
struct inv_state state
state vector
void ahrs_finv_wrapper_init(void)
static uint32_t ahrs_finv_last_stamp
last gyro msg timestamp
static void compute_body_orientation_and_rates(void)
Compute body orientation and rates from imu orientation and rates.
static abi_event accel_ev
static void gyro_cb(uint8_t sender_id, uint32_t stamp, struct Int32Rates *gyro)
Call ahrs_float_invariant_propagate on new gyro measurements.
static void mag_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *mag)
void ahrs_float_invariant_wrapper_enable(uint8_t enable)
static void send_geo_mag(struct transport_tx *trans, struct link_device *dev)
static abi_event aligner_ev
static abi_event geo_mag_ev
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
#define AHRS_FINV_IMU_ID
IMU (gyro, accel)
static uint8_t ahrs_finv_id
static void accel_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *accel)
static void geo_mag_cb(uint8_t sender_id, struct FloatVect3 *h)
static void aligner_cb(uint8_t sender_id, uint32_t stamp, struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, struct Int32Vect3 *lp_mag)
#define AHRS_FINV_MAG_ID
magnetometer
static void send_att(struct transport_tx *trans, struct link_device *dev)
Paparazzi specific wrapper to run INVARIANT ahrs filter.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
void float_eulers_of_quat(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'ZYX'
#define MAGS_FLOAT_OF_BFP(_ef, _ei)
#define EULERS_BFP_OF_REAL(_ei, _ef)
#define RATES_DIFF(_c, _a, _b)
#define RATES_FLOAT_OF_BFP(_rf, _ri)
#define ACCELS_FLOAT_OF_BFP(_ef, _ei)
int32_t phi
in rad with INT32_ANGLE_FRAC
int32_t psi
in rad with INT32_ANGLE_FRAC
int32_t theta
in rad with INT32_ANGLE_FRAC
static void stateSetNedToBodyQuat_f(uint16_t id, struct FloatQuat *ned_to_body_quat)
Set vehicle body attitude from quaternion (float).
void stateSetInputFilter(uint8_t type, uint16_t flag)
set the input filter for a specified type of data.
static void stateSetBodyRates_f(uint16_t id, struct FloatRates *body_rate)
Set vehicle body angular rate (float).
#define AHRS_PROPAGATE_FREQUENCY
struct FloatRates bias
Estimated gyro biases.
struct FloatQuat quat
Estimated attitude (quaternion)
struct FloatRates rates
Input gyro rates.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
Architecture independent timing functions.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.