40 #if PERIODIC_TELEMETRY
45 static void send_quat(
struct transport_tx *trans,
struct link_device *
dev)
48 pprz_msg_send_AHRS_QUAT_INT(trans,
dev, AC_ID,
61 static void send_euler(
struct transport_tx *trans,
struct link_device *
dev)
66 pprz_msg_send_AHRS_EULER_INT(trans,
dev, AC_ID,
67 <p_to_body_euler.
phi,
68 <p_to_body_euler.
theta,
69 <p_to_body_euler.
psi,
76 static void send_bias(
struct transport_tx *trans,
struct link_device *
dev)
78 pprz_msg_send_AHRS_GYRO_BIAS_INT(trans,
dev, AC_ID,
89 pprz_msg_send_GEO_MAG(trans,
dev, AC_ID,
100 if (t_diff > 50000) { mde = 5; }
109 #ifndef AHRS_ICQ_IMU_ID
110 #define AHRS_ICQ_IMU_ID ABI_BROADCAST
116 #ifndef AHRS_ICQ_MAG_ID
117 #define AHRS_ICQ_MAG_ID AHRS_ICQ_IMU_ID
123 #ifndef AHRS_ICQ_GPS_ID
124 #define AHRS_ICQ_GPS_ID GPS_MULTI_ID
139 #if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY)
145 float dt = (float)(stamp - last_stamp) * 1e-6;
151 PRINT_CONFIG_MSG(
"Using fixed AHRS_PROPAGATE_FREQUENCY for AHRS_ICQ propagation.")
162 uint32_t __attribute__((unused)) stamp,
165 #if USE_AUTO_AHRS_FREQ || !defined(AHRS_CORRECT_FREQUENCY)
169 float dt = (float)(stamp - last_stamp) * 1e-6;
175 PRINT_CONFIG_MSG(
"Using fixed AHRS_CORRECT_FREQUENCY for AHRS int_cmpl_quat accel update.")
178 const float dt = 1. / (AHRS_CORRECT_FREQUENCY);
186 uint32_t __attribute__((unused)) stamp,
189 #if USE_AUTO_AHRS_FREQ || !defined(AHRS_MAG_CORRECT_FREQUENCY)
193 float dt = (float)(stamp - last_stamp) * 1e-6;
199 PRINT_CONFIG_MSG(
"Using fixed AHRS_MAG_CORRECT_FREQUENCY for AHRS int_cmpl_quat mag update.")
202 const float dt = 1. / (AHRS_MAG_CORRECT_FREQUENCY);
210 uint32_t stamp __attribute__((unused)),
228 uint32_t stamp __attribute__((unused)),
261 #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.
bool ahrs_icq_align(struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, struct Int32Vect3 *lp_mag)
void ahrs_icq_update_accel(struct Int32Vect3 *accel, float dt)
struct AhrsIntCmplQuat ahrs_icq
Default Rate filter Low pass.
void ahrs_icq_update_gps(struct GpsState *gps_s)
void ahrs_icq_update_mag(struct Int32Vect3 *mag, float dt)
void ahrs_icq_propagate(struct Int32Rates *gyro, float dt)
struct Int32Rates gyro_bias
struct Int32Rates body_rate
struct Int32Quat ltp_to_body_quat
enum AhrsICQStatus status
status of the AHRS, AHRS_ICQ_UNINIT or AHRS_ICQ_RUNNING
static void gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
void ahrs_icq_wrapper_init(void)
static abi_event accel_ev
static void gyro_cb(uint8_t sender_id, uint32_t stamp, struct Int32Rates *gyro)
static void mag_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *mag)
static uint8_t ahrs_icq_id
static void send_geo_mag(struct transport_tx *trans, struct link_device *dev)
#define AHRS_ICQ_IMU_ID
ABI binding for IMU data.
static abi_event aligner_ev
void ahrs_int_cmpl_quat_wrapper_enable(uint8_t enable)
static abi_event geo_mag_ev
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
static void send_quat(struct transport_tx *trans, struct link_device *dev)
#define AHRS_ICQ_GPS_ID
ABI binding for gps data.
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 uint32_t ahrs_icq_last_stamp
static void aligner_cb(uint8_t sender_id, uint32_t stamp, struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, struct Int32Vect3 *lp_mag)
static void send_euler(struct transport_tx *trans, struct link_device *dev)
static void set_body_state_from_quat(void)
Rotate angles and rates from imu to body frame and set state.
static void send_bias(struct transport_tx *trans, struct link_device *dev)
#define AHRS_ICQ_MAG_ID
ABI binding for magnetometer data.
Paparazzi specific wrapper to run floating point complementary filter.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
data structure for GPS information
#define VECT3_ASSIGN(_a, _x, _y, _z)
int32_t p
in rad/s with INT32_RATE_FRAC
int32_t r
in rad/s with INT32_RATE_FRAC
int32_t phi
in rad with INT32_ANGLE_FRAC
int32_t q
in rad/s with INT32_RATE_FRAC
int32_t psi
in rad with INT32_ANGLE_FRAC
int32_t theta
in rad with INT32_ANGLE_FRAC
void int32_eulers_of_quat(struct Int32Eulers *e, struct Int32Quat *q)
#define MAG_BFP_OF_REAL(_af)
#define MAG_FLOAT_OF_BFP(_ai)
static struct Int32Quat * stateGetNedToBodyQuat_i(void)
Get vehicle body attitude quaternion (int).
static void stateSetNedToBodyQuat_i(uint16_t id, struct Int32Quat *ned_to_body_quat)
Set vehicle body attitude from quaternion (int).
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
void stateSetInputFilter(uint8_t type, uint16_t flag)
set the input filter for a specified type of data.
static void stateSetBodyRates_i(uint16_t id, struct Int32Rates *body_rate)
Set vehicle body angular rate (int).
#define AHRS_PROPAGATE_FREQUENCY
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.