LP-66 Add some channel checking - Fix second rudder for FixedWing
[librepilot.git] / flight / libraries / inc / insgps.h
blobc77d44510f89d12fb01c8929cabda8900972b4b2
1 /**
2 ******************************************************************************
3 * @addtogroup AHRS
4 * @{
5 * @addtogroup INSGPS
6 * @{
7 * @brief INSGPS is a joint attitude and position estimation EKF
9 * @file insgps.h
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
11 * @brief Include file of the INSGPS exposed functionality.
13 * @see The GNU Public License (GPL) Version 3
15 *****************************************************************************/
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 * for more details.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #ifndef INSGPS_H_
33 #define INSGPS_H_
35 #include "stdint.h"
37 /**
38 * @addtogroup Constants
39 * @{
41 #define POS_SENSORS 0x007
42 #define HORIZ_POS_SENSORS 0x003
43 #define VER_POS_SENSORS 0x004
44 #define HORIZ_SENSORS 0x018
45 #define VERT_SENSORS 0x020
46 #define MAG_SENSORS 0x1C0
47 #define BARO_SENSOR 0x200
49 #define FULL_SENSORS 0x3FF
51 /**
52 * @}
55 // Exposed Function Prototypes
56 void INSGPSInit();
57 void INSStatePrediction(float gyro_data[3], float accel_data[3], float dT);
58 void INSCovariancePrediction(float dT);
59 void INSCorrection(float mag_data[3], float Pos[3], float Vel[3], float BaroAlt, uint16_t SensorsUsed);
61 void INSResetP(float PDiag[13]);
62 void INSGetP(float PDiag[13]);
63 void INSSetState(float pos[3], float vel[3], float q[4], float gyro_bias[3], float accel_bias[3]);
64 void INSSetPosVelVar(float PosVar[3], float VelVar[3]);
65 void INSSetGyroBias(float gyro_bias[3]);
66 void INSSetAccelVar(float accel_var[3]);
67 void INSSetGyroVar(float gyro_var[3]);
68 void INSSetGyroBiasVar(float gyro_bias_var[3]);
69 void INSSetMagNorth(float B[3]);
70 void INSSetMagVar(float scaled_mag_var[3]);
71 void INSSetBaroVar(float baro_var);
72 void INSPosVelReset(float pos[3], float vel[3]);
74 void MagCorrection(float mag_data[3]);
75 void MagVelBaroCorrection(float mag_data[3], float Vel[3], float BaroAlt);
76 void FullCorrection(float mag_data[3], float Pos[3], float Vel[3],
77 float BaroAlt);
78 void GpsBaroCorrection(float Pos[3], float Vel[3], float BaroAlt);
79 void GpsMagCorrection(float mag_data[3], float Pos[3], float Vel[2]);
80 void VelBaroCorrection(float Vel[3], float BaroAlt);
82 uint16_t ins_get_num_states();
84 // Nav structure containing current solution
85 extern struct NavStruct {
86 float Pos[3]; // Position in meters and relative to a local NED frame
87 float Vel[3]; // Velocity in meters and in NED
88 float q[4]; // unit quaternion rotation relative to NED
89 float gyro_bias[3];
90 float accel_bias[3];
91 } Nav;
93 /**
94 * @}
95 * @}
98 #endif /* EKF_H_ */