Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 "modules/ahrs/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 
OrientationReps
Definition: pprz_orientation_conversion.h:79
ahrs_madgwick_align
void ahrs_madgwick_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel)
Definition: ahrs_madgwick.c:59
ahrs_madgwick
struct AhrsMadgwick ahrs_madgwick
Definition: ahrs_madgwick.c:39
AhrsMadgwick::bias
struct FloatRates bias
Gyro bias (from alignment)
Definition: ahrs_madgwick.h:41
ahrs_madgwick_propagate
void ahrs_madgwick_propagate(struct FloatRates *gyro, float dt)
Definition: ahrs_madgwick.c:69
pprz_algebra_float.h
Paparazzi floating point algebra.
FloatVect3
Definition: pprz_algebra_float.h:54
FloatQuat
Roation quaternion.
Definition: pprz_algebra_float.h:63
AhrsMadgwick::quat
struct FloatQuat quat
Estimated attitude (quaternion)
Definition: ahrs_madgwick.h:39
AhrsMadgwick::is_aligned
bool is_aligned
aligned flag
Definition: ahrs_madgwick.h:45
ahrs.h
AhrsMadgwick::body_to_imu
struct OrientationReps body_to_imu
body_to_imu rotation
Definition: ahrs_madgwick.h:43
AhrsMadgwick::reset
bool reset
flag to request reset/reinit the filter
Definition: ahrs_madgwick.h:44
AhrsMadgwick::rates
struct FloatRates rates
Measured gyro rates.
Definition: ahrs_madgwick.h:40
pprz_orientation_conversion.h
AhrsMadgwick::accel
struct FloatVect3 accel
Measured accelerometers.
Definition: ahrs_madgwick.h:42
ahrs_madgwick_init
void ahrs_madgwick_init(void)
Definition: ahrs_madgwick.c:50
ahrs_madgwick_set_body_to_imu_quat
void ahrs_madgwick_set_body_to_imu_quat(struct FloatQuat *q_b2i)
Definition: ahrs_madgwick.c:147
AhrsMadgwick
Madgwick filter structure.
Definition: ahrs_madgwick.h:38
ahrs_madgwick_update_accel
void ahrs_madgwick_update_accel(struct FloatVect3 *accel)
Definition: ahrs_madgwick.c:142
FloatRates
angular rates
Definition: pprz_algebra_float.h:93