2 ******************************************************************************
3 * @addtogroup OpenPilotModules OpenPilot Modules
5 * @addtogroup StateSetimation Module
8 * @file stateestimation.h
9 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
10 * @brief Acquires sensor data and fuses it into attitude estimate for CC
12 * @see The GNU Public License (GPL) Version 3
14 *****************************************************************************/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #ifndef STATEESTIMATION_H
31 #define STATEESTIMATION_H
33 #include <openpilot.h>
36 // Enumeration for filter result
38 FILTERRESULT_UNINITIALISED
= -1,
40 FILTERRESULT_WARNING
= 1,
41 FILTERRESULT_CRITICAL
= 2,
42 FILTERRESULT_ERROR
= 3,
47 SENSORUPDATES_gyro
= 1 << 0,
48 SENSORUPDATES_accel
= 1 << 1,
49 SENSORUPDATES_mag
= 1 << 2,
50 SENSORUPDATES_boardMag
= 1 << 10,
51 SENSORUPDATES_auxMag
= 1 << 9,
52 SENSORUPDATES_attitude
= 1 << 3,
53 SENSORUPDATES_pos
= 1 << 4,
54 SENSORUPDATES_vel
= 1 << 5,
55 SENSORUPDATES_airspeed
= 1 << 6,
56 SENSORUPDATES_baro
= 1 << 7,
57 SENSORUPDATES_lla
= 1 << 8,
60 #define MAGSTATUS_OK 1
61 #define MAGSTATUS_AUX 2
62 #define MAGSTATUS_INVALID 0
75 sensorUpdates updated
;
78 typedef struct stateFilterStruct
{
79 int32_t (*init
)(struct stateFilterStruct
*self
);
80 filterResult (*filter
)(struct stateFilterStruct
*self
, stateEstimation
*state
);
85 int32_t filterMagInitialize(stateFilter
*handle
);
86 int32_t filterBaroiInitialize(stateFilter
*handle
);
87 int32_t filterBaroInitialize(stateFilter
*handle
);
88 int32_t filterVelocityInitialize(stateFilter
*handle
);
89 int32_t filterAltitudeInitialize(stateFilter
*handle
);
90 int32_t filterAirInitialize(stateFilter
*handle
);
91 int32_t filterStationaryInitialize(stateFilter
*handle
);
92 int32_t filterLLAInitialize(stateFilter
*handle
);
93 int32_t filterCFInitialize(stateFilter
*handle
);
94 int32_t filterCFMInitialize(stateFilter
*handle
);
95 int32_t filterEKF13iInitialize(stateFilter
*handle
);
96 int32_t filterEKF13Initialize(stateFilter
*handle
);
97 int32_t filterEKF16iInitialize(stateFilter
*handle
);
98 int32_t filterEKF16Initialize(stateFilter
*handle
);
100 #endif // STATEESTIMATION_H