Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ahrs_madgwick.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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 
29 #ifndef AHRS_MADGWICK_H
30 #define AHRS_MADGWICK_H
31 
32 #include "subsystems/ahrs.h"
35 
38 struct AhrsMadgwick {
39  struct FloatQuat quat;
40  struct FloatRates rates;
41  struct FloatRates bias;
42  struct FloatVect3 accel;
44  bool reset;
45  bool is_aligned;
46 };
47 
48 extern struct AhrsMadgwick ahrs_madgwick;
49 
50 extern void ahrs_madgwick_init(void);
51 extern void ahrs_madgwick_set_body_to_imu_quat(struct FloatQuat *q_b2i);
52 extern void ahrs_madgwick_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel);
53 extern void ahrs_madgwick_propagate(struct FloatRates* gyro, float dt);
54 extern void ahrs_madgwick_update_accel(struct FloatVect3* accel);
55 
56 #endif /* AHRS_MADGWICK_H */
57 
struct AhrsMadgwick ahrs_madgwick
Definition: ahrs_madgwick.c:39
Dispatcher to register actual AHRS implementations.
struct FloatRates bias
Gyro bias (from alignment)
Definition: ahrs_madgwick.h:41
void ahrs_madgwick_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel)
Definition: ahrs_madgwick.c:59
bool is_aligned
aligned flag
Definition: ahrs_madgwick.h:45
struct FloatQuat quat
Estimated attitude (quaternion)
Definition: ahrs_madgwick.h:39
Roation quaternion.
Paparazzi floating point algebra.
void ahrs_madgwick_propagate(struct FloatRates *gyro, float dt)
Definition: ahrs_madgwick.c:69
struct FloatRates rates
Measured gyro rates.
Definition: ahrs_madgwick.h:40
bool reset
flag to request reset/reinit the filter
Definition: ahrs_madgwick.h:44
void ahrs_madgwick_set_body_to_imu_quat(struct FloatQuat *q_b2i)
void ahrs_madgwick_init(void)
Definition: ahrs_madgwick.c:50
struct FloatVect3 accel
Measured accelerometers.
Definition: ahrs_madgwick.h:42
void ahrs_madgwick_update_accel(struct FloatVect3 *accel)
Generic orientation representation and conversions.
angular rates
Madgwick filter structure.
Definition: ahrs_madgwick.h:38
struct OrientationReps body_to_imu
body_to_imu rotation
Definition: ahrs_madgwick.h:43