Simple example to show how to get an estimation of the attitude with a 9DOF IMU and the Kalman filter
Dependencies: L3GD20 LSM303DLHC mbed-dsp mbed
Fork of minimu-9v2 by
sensfusion9.h@1:ba2d31e3112d, 2017-03-25 (annotated)
- Committer:
- capriele
- Date:
- Sat Mar 25 16:48:32 2017 +0000
- Revision:
- 1:ba2d31e3112d
Simple example to get an estimation of the attitude thought a 9DOF IMU and the Kalman filter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
capriele | 1:ba2d31e3112d | 1 | /** |
capriele | 1:ba2d31e3112d | 2 | * || ____ _ __ ______ |
capriele | 1:ba2d31e3112d | 3 | * +------+ / __ )(_) /_/ ____/_________ _____ ___ |
capriele | 1:ba2d31e3112d | 4 | * | 0xBC | / __ / / __/ / / ___/ __ `/_ / / _ \ |
capriele | 1:ba2d31e3112d | 5 | * +------+ / /_/ / / /_/ /___ / / / /_/ / / /_/ __/ |
capriele | 1:ba2d31e3112d | 6 | * || || /_____/_/\__/\____//_/ \__,_/ /___/\___/ |
capriele | 1:ba2d31e3112d | 7 | * |
capriele | 1:ba2d31e3112d | 8 | * Crazyflie control firmware |
capriele | 1:ba2d31e3112d | 9 | * |
capriele | 1:ba2d31e3112d | 10 | * Copyright (C) 2011-2012 Bitcraze AB |
capriele | 1:ba2d31e3112d | 11 | * |
capriele | 1:ba2d31e3112d | 12 | * This program is free software: you can redistribute it and/or modify |
capriele | 1:ba2d31e3112d | 13 | * it under the terms of the GNU General Public License as published by |
capriele | 1:ba2d31e3112d | 14 | * the Free Software Foundation, in version 3. |
capriele | 1:ba2d31e3112d | 15 | * |
capriele | 1:ba2d31e3112d | 16 | * This program is distributed in the hope that it will be useful, |
capriele | 1:ba2d31e3112d | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
capriele | 1:ba2d31e3112d | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
capriele | 1:ba2d31e3112d | 19 | * GNU General Public License for more details. |
capriele | 1:ba2d31e3112d | 20 | * |
capriele | 1:ba2d31e3112d | 21 | * You should have received a copy of the GNU General Public License |
capriele | 1:ba2d31e3112d | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
capriele | 1:ba2d31e3112d | 23 | * |
capriele | 1:ba2d31e3112d | 24 | */ |
capriele | 1:ba2d31e3112d | 25 | |
capriele | 1:ba2d31e3112d | 26 | #ifndef SENSORFUSION9_H_ |
capriele | 1:ba2d31e3112d | 27 | #define SENSORFUSION9_H_ |
capriele | 1:ba2d31e3112d | 28 | #include <stdbool.h> |
capriele | 1:ba2d31e3112d | 29 | |
capriele | 1:ba2d31e3112d | 30 | |
capriele | 1:ba2d31e3112d | 31 | #ifdef __cplusplus |
capriele | 1:ba2d31e3112d | 32 | extern "C" { |
capriele | 1:ba2d31e3112d | 33 | #endif |
capriele | 1:ba2d31e3112d | 34 | |
capriele | 1:ba2d31e3112d | 35 | void sensfusion9Init(void); |
capriele | 1:ba2d31e3112d | 36 | bool sensfusion9Test(void); |
capriele | 1:ba2d31e3112d | 37 | |
capriele | 1:ba2d31e3112d | 38 | void sensfusion9UpdateQ(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz, float dt); |
capriele | 1:ba2d31e3112d | 39 | void sensfusion9GetEulerRPY(float* roll, float* pitch, float* yaw); |
capriele | 1:ba2d31e3112d | 40 | void sensfusion9GetQuaternion(float* Q0, float* Q1, float* Q2, float* Q3); |
capriele | 1:ba2d31e3112d | 41 | float sensfusion9GetAccZWithoutGravity(const float ax, const float ay, const float az); |
capriele | 1:ba2d31e3112d | 42 | float sensfusion9GetInvThrustCompensationForTilt(); |
capriele | 1:ba2d31e3112d | 43 | |
capriele | 1:ba2d31e3112d | 44 | #ifdef __cplusplus |
capriele | 1:ba2d31e3112d | 45 | } |
capriele | 1:ba2d31e3112d | 46 | #endif |
capriele | 1:ba2d31e3112d | 47 | |
capriele | 1:ba2d31e3112d | 48 | #endif /* SENSORFUSION9_H_ */ |