Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ahrs_float_invariant.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Jean-Philippe Condomines, Gautier Hattenberger
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
27 #ifndef AHRS_FLOAT_INVARIANT_H
28 #define AHRS_FLOAT_INVARIANT_H
29 
30 #include "modules/ahrs/ahrs.h"
33 
36 #define INV_STATE_DIM 9
37 
40 struct inv_state {
41  struct FloatQuat quat;
42  struct FloatRates bias;
43  float cs;
44  float as;
45 };
46 
49 #define INV_MEASURE_DIM 6
50 
53 struct inv_measures {
54  struct FloatVect3 accel;
55  struct FloatVect3 mag;
56 };
57 
60 #define INV_COMMAND_DIM 3
61 
64 struct inv_command {
65  struct FloatRates rates;
66 };
67 
71  struct FloatVect3 LE;
72  struct FloatVect3 ME;
73  float NE;
74  float OE;
75 };
76 
79 struct inv_gains {
80  float lx;
81  float ly;
82  float lz;
83  float mx;
84  float my;
85  float mz;
86  float n;
87  float o;
88 };
89 
92 struct AhrsFloatInv {
93  struct inv_state state;
94  struct inv_measures meas;
95  struct inv_command cmd;
96  struct inv_correction_gains corr;
97  struct inv_gains gains;
98 
99  bool reset;
100 
101  struct FloatVect3 mag_h;
103 };
104 
105 extern struct AhrsFloatInv ahrs_float_inv;
106 
107 extern void ahrs_float_invariant_init(void);
108 extern void ahrs_float_invariant_align(struct FloatRates *lp_gyro,
109  struct FloatVect3 *lp_accel,
110  struct FloatVect3 *lp_mag);
111 extern void ahrs_float_invariant_propagate(struct FloatRates* gyro, float dt);
112 extern void ahrs_float_invariant_update_accel(struct FloatVect3* accel);
114 
115 #endif /* AHRS_FLOAT_INVARIANT_H */
116 
Dispatcher to register actual AHRS implementations.
struct AhrsFloatInv ahrs_float_inv
struct inv_measures meas
measurement vector
void ahrs_float_invariant_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag)
struct inv_command cmd
command vector
bool reset
flag to request reset/reinit the filte
struct inv_correction_gains corr
correction gains
struct inv_gains gains
tuning gains
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)
struct inv_state state
state vector
void ahrs_float_invariant_update_mag(struct FloatVect3 *mag)
struct FloatVect3 mag_h
Invariant filter structure.
Roation quaternion.
angular rates
float lx
Tuning parameter of accel and mag on attitude (longitudinal subsystem)
float o
Tuning parameter of accel and mag on mag bias (scaling subsystem)
float n
Tuning parameter of accel and mag on accel bias (scaling subsystem)
float mz
Tuning parameter of accel and mag on gyro bias (heading subsystem)
struct FloatRates bias
Estimated gyro biases.
float OE
Correction gains on magnetometer sensitivity.
float ly
Tuning parameter of accel and mag on attitude (lateral subsystem)
struct FloatVect3 LE
Correction gains on attitude.
float lz
Tuning parameter of accel and mag on attitude (heading subsystem)
struct FloatVect3 ME
Correction gains on gyro biases.
float as
Estimated accelerometer sensitivity.
float cs
Estimates magnetometer sensitivity.
struct FloatVect3 mag
Measured magnetic field.
struct FloatQuat quat
Estimated attitude (quaternion)
float NE
Correction gains on accel bias.
struct FloatRates rates
Input gyro rates.
float mx
Tuning parameter of accel and mag on gyro bias (longitudinal subsystem)
struct FloatVect3 accel
Measured accelerometers.
float my
Tuning parameter of accel and mag on gyro bias (lateral subsystem)
Invariant filter command vector.
Invariant filter correction gains.
Invariant filter tuning gains.
Invariant filter measurement vector.
Invariant filter state.
Paparazzi floating point algebra.
Generic orientation representation and conversions.