Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ahrs_float_dcm.h
Go to the documentation of this file.
1 /*
2  * Released under Creative Commons License
3  *
4  * 2010 The Paparazzi Team
5  *
6  *
7  * Based on Code by Jordi Munoz and William Premerlani, Supported by Chris Anderson (Wired) and Nathan Sindle (SparkFun).
8  * Version 1.0 for flat board updated by Doug Weibel and Jose Julio
9  *
10  * Modified at Hochschule Bremen, Germany
11  * 2010 Heinrich Warmers, Christoph Niemann, Oliver Riesener
12  *
13  */
14 
24 #ifndef AHRS_FLOAT_DCM_H
25 #define AHRS_FLOAT_DCM_H
26 
27 #include <inttypes.h>
30 #include "modules/gps/gps.h"
31 
35 };
36 
37 struct AhrsFloatDCM {
38  struct FloatRates gyro_bias;
40 
42  struct FloatRates body_rate;
43 
44  float gps_speed;
46  float gps_course;
49 
50  enum AhrsDCMStatus status;
51  bool is_aligned;
52 };
53 extern struct AhrsFloatDCM ahrs_dcm;
54 
55 // DCM Parameters
56 
57 //#define Kp_ROLLPITCH 0.2
58 #define Kp_ROLLPITCH 0.015
59 #define Ki_ROLLPITCH 0.000010
60 #define Kp_YAW 0.9 //High yaw drift correction gain - use with caution!
61 #define Ki_YAW 0.00005
62 
63 #define GRAVITY 9.81
64 
65 
66 #ifndef OUTPUTMODE
67 #define OUTPUTMODE 1
68 #endif
69 // Mode 0 = DCM integration without Ki gyro bias
70 // Mode 1 = DCM integration with Kp and Ki
71 // Mode 2 = direct accelerometer -> euler
72 
73 #ifndef AHRS_FLOAT_MIN_SPEED_GPS_COURSE
74 #define AHRS_FLOAT_MIN_SPEED_GPS_COURSE 5 // m/s
75 #endif
76 
77 #define PERFORMANCE_REPORTING 1
78 #if PERFORMANCE_REPORTING == 1
79 extern int renorm_sqrt_count;
80 extern int renorm_blowup_count;
81 extern float imu_health;
82 #endif
83 
84 extern void ahrs_dcm_init(void);
85 extern bool ahrs_dcm_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel,
86  struct FloatVect3 *lp_mag);
87 extern void ahrs_dcm_propagate(struct FloatRates *gyro, float dt);
88 extern void ahrs_dcm_update_accel(struct FloatVect3 *accel);
89 extern void ahrs_dcm_update_mag(struct FloatVect3 *mag);
90 extern void ahrs_dcm_update_gps(struct GpsState *gps_s);
91 
92 #endif // AHRS_FLOAT_DCM_H
void ahrs_dcm_propagate(struct FloatRates *gyro, float dt)
float imu_health
bool gps_course_valid
int renorm_sqrt_count
void ahrs_dcm_update_mag(struct FloatVect3 *mag)
float gps_acceleration
void ahrs_dcm_init(void)
struct FloatRates rate_correction
uint8_t gps_age
struct FloatRates body_rate
struct FloatEulers ltp_to_body_euler
void ahrs_dcm_update_accel(struct FloatVect3 *accel)
struct FloatRates gyro_bias
int renorm_blowup_count
struct AhrsFloatDCM ahrs_dcm
bool ahrs_dcm_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag)
AhrsDCMStatus
@ AHRS_DCM_UNINIT
@ AHRS_DCM_RUNNING
enum AhrsDCMStatus status
void ahrs_dcm_update_gps(struct GpsState *gps_s)
Device independent GPS code (interface)
data structure for GPS information
Definition: gps.h:86
euler angles
angular rates
Paparazzi floating point algebra.
Generic orientation representation and conversions.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98