Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ahrs_int_cmpl_quat.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2013 The Paparazzi Team
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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
31 #ifndef AHRS_INT_CMPL_QUAT_H
32 #define AHRS_INT_CMPL_QUAT_H
33 
34 #include "modules/ahrs/ahrs.h"
35 #include "modules/gps/gps.h"
36 #include "std.h"
37 #include "math/pprz_algebra_int.h"
39 
43 };
44 
49  struct Int32Rates gyro_bias;
50  struct Int32Rates body_rate;
52  struct Int64Quat high_rez_quat;
55  struct Int32Vect3 mag_h;
56 
60  float weight;
61  float accel_inv_kp;
62  float accel_inv_ki;
63  float mag_kp;
64  float mag_ki;
65 
66  /* parameters/options that can be changed */
69 
74 
79  float accel_omega;
80 
85  float accel_zeta;
86 
90  float mag_omega;
91 
95  float mag_zeta;
96 
97  /* internal counters for the gains */
100 
101  enum AhrsICQStatus status;
103 };
104 
105 extern struct AhrsIntCmplQuat ahrs_icq;
106 
107 extern void ahrs_icq_init(void);
108 extern bool ahrs_icq_align(struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel,
109  struct Int32Vect3 *lp_mag);
110 extern void ahrs_icq_propagate(struct Int32Rates *gyro, float dt);
111 extern void ahrs_icq_update_accel(struct Int32Vect3 *accel, float dt);
112 extern void ahrs_icq_update_mag(struct Int32Vect3 *mag, float dt);
113 extern void ahrs_icq_update_gps(struct GpsState *gps_s);
114 
120 
127 
128 
130 extern void ahrs_icq_set_accel_gains(void);
131 
132 static inline void ahrs_int_cmpl_quat_SetAccelOmega(float omega)
133 {
134  ahrs_icq.accel_omega = omega;
136 }
137 
138 static inline void ahrs_int_cmpl_quat_SetAccelZeta(float zeta)
139 {
140  ahrs_icq.accel_zeta = zeta;
142 }
143 
145 extern void ahrs_icq_set_mag_gains(void);
146 
147 static inline void ahrs_int_cmpl_quat_SetMagOmega(float omega)
148 {
149  ahrs_icq.mag_omega = omega;
151 }
152 
153 static inline void ahrs_int_cmpl_quat_SetMagZeta(float zeta)
154 {
155  ahrs_icq.mag_zeta = zeta;
157 }
158 
159 
160 #endif /* AHRS_INT_CMPL_QUAT_H */
bool ahrs_icq_align(struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, struct Int32Vect3 *lp_mag)
uint16_t accel_cnt
number of propagations since last accel update
struct Int32Rates gyro_bias
AhrsICQStatus
@ AHRS_ICQ_UNINIT
@ AHRS_ICQ_RUNNING
void ahrs_icq_update_accel(struct Int32Vect3 *accel, float dt)
uint16_t mag_cnt
number of propagations since last mag update
struct Int32Vect3 mag_h
float mag_omega
filter cut-off frequency for correcting the attitude (heading) from magnetometer.
uint8_t gravity_heuristic_factor
sets how strongly the gravity heuristic reduces accel correction.
struct AhrsIntCmplQuat ahrs_icq
Default Rate filter Low pass.
struct Int32Rates rate_correction
float mag_zeta
filter damping for correcting the gyro bias from magnetometer.
static void ahrs_int_cmpl_quat_SetAccelOmega(float omega)
void ahrs_icq_init(void)
void ahrs_icq_update_gps(struct GpsState *gps_s)
struct Int64Rates high_rez_bias
void ahrs_icq_update_heading(int32_t heading)
Update yaw based on a heading measurement.
float accel_omega
filter cut-off frequency for correcting the attitude from accels.
void ahrs_icq_realign_heading(int32_t heading)
Hard reset yaw to a heading.
struct Int32Rates body_rate
void ahrs_icq_update_mag(struct Int32Vect3 *mag, float dt)
static void ahrs_int_cmpl_quat_SetAccelZeta(float zeta)
struct Int32Quat ltp_to_body_quat
static void ahrs_int_cmpl_quat_SetMagZeta(float zeta)
void ahrs_icq_set_accel_gains(void)
update pre-computed inv_kp and inv_ki gains from acc_omega and acc_zeta
struct Int64Quat high_rez_quat
void ahrs_icq_set_mag_gains(void)
update pre-computed kp and ki gains from mag_omega and mag_zeta
enum AhrsICQStatus status
status of the AHRS, AHRS_ICQ_UNINIT or AHRS_ICQ_RUNNING
static void ahrs_int_cmpl_quat_SetMagOmega(float omega)
void ahrs_icq_propagate(struct Int32Rates *gyro, float dt)
bool correct_gravity
enable gravity vector correction by removing centrifugal acceleration
float accel_zeta
filter damping for correcting the gyro-bias from accels.
Ahrs implementation specifc values.
Device independent GPS code (interface)
data structure for GPS information
Definition: gps.h:87
Rotation quaternion.
angular rates
Paparazzi fixed point algebra.
Generic orientation representation and conversions.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
float heading
Definition: wedgebug.c:258