Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/ahrs/ahrs_float_invariant.h"
#include "modules/ahrs/ahrs_int_utils.h"
#include "generated/airframe.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_algebra_int.h"
#include "math/pprz_rk_float.h"
Go to the source code of this file.
Macros | |
#define | AHRS_INV_LX 2. * (0.06 + 0.1) |
#define | AHRS_INV_LY 2. * (0.06 + 0.06) |
#define | AHRS_INV_LZ 2. * (0.1 + 0.06) |
#define | AHRS_INV_MX 2. * 0.05 * (0.06 + 0.1) |
#define | AHRS_INV_MY 2. * 0.05 * (0.06 + 0.06) |
#define | AHRS_INV_MZ 2. * 0.05 * (0.1 + 0.06) |
#define | AHRS_INV_N 0.25 |
#define | AHRS_INV_O 0.5 |
#define | B ahrs_float_inv.mag_h |
#define | MAG_FROZEN_COUNT 30 |
Functions | |
static void | error_output (struct AhrsFloatInv *_ahrs) |
Compute correction vectors E = ( ŷ - y ) LE, ME, NE, OE : ( gain matrix * error ) More... | |
static void | invariant_model (float *o, const float *x, const int n, const float *u, const int m) |
Compute dynamic mode. More... | |
void | float_quat_vmul_right (struct FloatQuat *mright, const struct FloatQuat *q, struct FloatVect3 *vi) |
Right multiplication by a quaternion. More... | |
static void | init_invariant_state (void) |
void | ahrs_float_invariant_init (void) |
void | ahrs_float_invariant_align (struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag) |
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) |
Variables | |
struct AhrsFloatInv | ahrs_float_inv |
static const struct FloatVect3 | A = { 0.f, 0.f, -9.81f } |
AHRS using invariant filter.
Definition in file ahrs_float_invariant.c.
#define AHRS_INV_LX 2. * (0.06 + 0.1) |
Definition at line 64 of file ahrs_float_invariant.c.
#define AHRS_INV_LY 2. * (0.06 + 0.06) |
Definition at line 68 of file ahrs_float_invariant.c.
#define AHRS_INV_LZ 2. * (0.1 + 0.06) |
Definition at line 72 of file ahrs_float_invariant.c.
#define AHRS_INV_MX 2. * 0.05 * (0.06 + 0.1) |
Definition at line 76 of file ahrs_float_invariant.c.
#define AHRS_INV_MY 2. * 0.05 * (0.06 + 0.06) |
Definition at line 80 of file ahrs_float_invariant.c.
#define AHRS_INV_MZ 2. * 0.05 * (0.1 + 0.06) |
Definition at line 84 of file ahrs_float_invariant.c.
#define AHRS_INV_N 0.25 |
Definition at line 88 of file ahrs_float_invariant.c.
#define AHRS_INV_O 0.5 |
Definition at line 92 of file ahrs_float_invariant.c.
#define B ahrs_float_inv.mag_h |
Definition at line 101 of file ahrs_float_invariant.c.
#define MAG_FROZEN_COUNT 30 |
Definition at line 234 of file ahrs_float_invariant.c.
void ahrs_float_invariant_align | ( | struct FloatRates * | lp_gyro, |
struct FloatVect3 * | lp_accel, | ||
struct FloatVect3 * | lp_mag | ||
) |
Definition at line 156 of file ahrs_float_invariant.c.
References ahrs_float_get_quat_from_accel_mag(), ahrs_float_inv, inv_state::bias, AhrsFloatInv::is_aligned, inv_state::quat, and AhrsFloatInv::state.
Referenced by aligner_cb().
void ahrs_float_invariant_init | ( | void | ) |
Definition at line 131 of file ahrs_float_invariant.c.
References ahrs_float_inv, AHRS_INV_LX, AHRS_INV_LY, AHRS_INV_LZ, AHRS_INV_MX, AHRS_INV_MY, AHRS_INV_MZ, AHRS_INV_N, AHRS_INV_O, AhrsFloatInv::gains, init_invariant_state(), AhrsFloatInv::is_aligned, inv_gains::lx, inv_gains::ly, inv_gains::lz, AhrsFloatInv::mag_h, inv_gains::mx, inv_gains::my, inv_gains::mz, inv_gains::n, inv_gains::o, AhrsFloatInv::reset, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by ahrs_finv_wrapper_init().
void ahrs_float_invariant_propagate | ( | struct FloatRates * | gyro, |
float | dt | ||
) |
Definition at line 170 of file ahrs_float_invariant.c.
References ahrs_float_inv, inv_state::as, inv_state::bias, AhrsFloatInv::cmd, inv_state::cs, DefaultChannel, DefaultDevice, error_output(), float_eulers_of_quat(), float_quat_normalize(), foo, init_invariant_state(), INV_COMMAND_DIM, INV_STATE_DIM, invariant_model(), AhrsFloatInv::is_aligned, FloatRates::p, FloatEulers::phi, FloatEulers::psi, FloatRates::q, FloatQuat::qi, inv_state::quat, FloatRates::r, inv_command::rates, RATES_COPY, AhrsFloatInv::reset, runge_kutta_4_float(), AhrsFloatInv::state, and FloatEulers::theta.
Referenced by gyro_cb().
void ahrs_float_invariant_update_accel | ( | struct FloatVect3 * | accel | ) |
Definition at line 228 of file ahrs_float_invariant.c.
References inv_measures::accel, ahrs_float_inv, and AhrsFloatInv::meas.
Referenced by accel_cb().
void ahrs_float_invariant_update_mag | ( | struct FloatVect3 * | mag | ) |
Definition at line 236 of file ahrs_float_invariant.c.
References ahrs_float_inv, FLOAT_VECT3_ZERO, inv_measures::mag, MAG_FROZEN_COUNT, AhrsFloatInv::meas, VECT3_COPY, and FloatVect3::x.
Referenced by mag_cb().
|
inlinestatic |
Compute correction vectors E = ( ŷ - y ) LE, ME, NE, OE : ( gain matrix * error )
Definition at line 313 of file ahrs_float_invariant.c.
References A, inv_measures::accel, inv_state::as, B, AhrsFloatInv::corr, inv_state::cs, float_quat_invert(), float_quat_vmult(), AhrsFloatInv::gains, inv_correction_gains::LE, inv_gains::lx, inv_gains::ly, inv_gains::lz, inv_measures::mag, inv_correction_gains::ME, AhrsFloatInv::meas, inv_gains::mx, inv_gains::my, inv_gains::mz, inv_gains::n, inv_correction_gains::NE, inv_gains::o, inv_correction_gains::OE, inv_state::quat, AhrsFloatInv::state, VECT3_CROSS_PRODUCT, VECT3_DIFF, VECT3_SMUL, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by ahrs_float_invariant_propagate().
void float_quat_vmul_right | ( | struct FloatQuat * | mright, |
const struct FloatQuat * | q, | ||
struct FloatVect3 * | vi | ||
) |
Right multiplication by a quaternion.
vi * q
Definition at line 365 of file ahrs_float_invariant.c.
References FLOAT_QUAT_EXTRACT, FloatQuat::qi, QUAT_ASSIGN, v1, v2, VECT3_ADD, VECT3_CROSS_PRODUCT, VECT3_DOT_PRODUCT, and VECT3_SMUL.
Referenced by invariant_model().
|
inlinestatic |
Definition at line 117 of file ahrs_float_invariant.c.
References inv_measures::accel, ahrs_float_inv, inv_state::as, inv_state::bias, inv_state::cs, float_quat_identity(), FLOAT_RATES_ZERO, FLOAT_VECT3_ZERO, inv_measures::mag, AhrsFloatInv::meas, inv_state::quat, and AhrsFloatInv::state.
Referenced by ahrs_float_invariant_init(), and ahrs_float_invariant_propagate().
|
inlinestatic |
Compute dynamic mode.
x_dot = evolution_model + (gain_matrix * error)
Definition at line 261 of file ahrs_float_invariant.c.
References ahrs_float_inv, inv_state::as, inv_state::bias, AhrsFloatInv::corr, inv_state::cs, float_quat_derivative(), FLOAT_QUAT_NORM2, float_quat_vmul_right(), float_quat_vmult(), float_vect_zero(), inv_correction_gains::LE, inv_correction_gains::ME, inv_correction_gains::NE, inv_correction_gains::OE, inv_state::quat, QUAT_ADD, QUAT_SMUL, inv_command::rates, RATES_ASSIGN, RATES_DIFF, s, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by ahrs_float_invariant_propagate().
|
static |
Definition at line 1 of file ahrs_float_invariant.c.
Referenced by error_output().
struct AhrsFloatInv ahrs_float_inv |
Definition at line 1 of file ahrs_float_invariant.c.
Referenced by accel_cb(), ahrs_float_invariant_align(), ahrs_float_invariant_init(), ahrs_float_invariant_propagate(), ahrs_float_invariant_update_accel(), ahrs_float_invariant_update_mag(), aligner_cb(), compute_body_orientation_and_rates(), geo_mag_cb(), gyro_cb(), init_invariant_state(), invariant_model(), mag_cb(), send_att(), send_filter_status(), and send_geo_mag().