Paparazzi UAS  v5.15_devel-111-g8fb4629
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 "subsystems/gps.h"
31 
35 };
36 
37 struct AhrsFloatDCM {
40 
43 
44  float gps_speed;
46  float gps_course;
49 
51 
53  bool is_aligned;
54 };
55 extern struct AhrsFloatDCM ahrs_dcm;
56 
57 // DCM Parameters
58 
59 //#define Kp_ROLLPITCH 0.2
60 #define Kp_ROLLPITCH 0.015
61 #define Ki_ROLLPITCH 0.000010
62 #define Kp_YAW 0.9 //High yaw drift correction gain - use with caution!
63 #define Ki_YAW 0.00005
64 
65 #define GRAVITY 9.81
66 
67 
68 #ifndef OUTPUTMODE
69 #define OUTPUTMODE 1
70 #endif
71 // Mode 0 = DCM integration without Ki gyro bias
72 // Mode 1 = DCM integration with Kp and Ki
73 // Mode 2 = direct accelerometer -> euler
74 
75 
76 #define PERFORMANCE_REPORTING 1
77 #if PERFORMANCE_REPORTING == 1
78 extern int renorm_sqrt_count;
79 extern int renorm_blowup_count;
80 extern float imu_health;
81 #endif
82 
83 extern void ahrs_dcm_init(void);
85 extern void ahrs_dcm_set_body_to_imu_quat(struct FloatQuat *q_b2i);
86 extern bool ahrs_dcm_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel,
87  struct FloatVect3 *lp_mag);
88 extern void ahrs_dcm_propagate(struct FloatRates *gyro, float dt);
89 extern void ahrs_dcm_update_accel(struct FloatVect3 *accel);
90 extern void ahrs_dcm_update_mag(struct FloatVect3 *mag);
91 extern void ahrs_dcm_update_gps(struct GpsState *gps_s);
92 
93 #endif // AHRS_FLOAT_DCM_H
void ahrs_dcm_init(void)
void ahrs_dcm_update_accel(struct FloatVect3 *accel)
struct FloatRates rate_correction
AhrsDCMStatus
euler angles
Roation quaternion.
float imu_health
int renorm_sqrt_count
struct FloatEulers ltp_to_imu_euler
struct AhrsFloatDCM ahrs_dcm
Paparazzi floating point algebra.
data structure for GPS information
Definition: gps.h:87
bool gps_course_valid
Device independent GPS code (interface)
int renorm_blowup_count
struct FloatRates gyro_bias
enum AhrsDCMStatus status
void ahrs_dcm_set_body_to_imu(struct OrientationReps *body_to_imu)
void ahrs_dcm_propagate(struct FloatRates *gyro, float dt)
struct OrientationReps body_to_imu
unsigned char uint8_t
Definition: types.h:14
uint8_t gps_age
static struct OrientationReps body_to_imu
Definition: ins_alt_float.c:93
Generic orientation representation and conversions.
void ahrs_dcm_set_body_to_imu_quat(struct FloatQuat *q_b2i)
float gps_acceleration
angular rates
struct FloatRates imu_rate
bool ahrs_dcm_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag)
void ahrs_dcm_update_mag(struct FloatVect3 *mag)
void ahrs_dcm_update_gps(struct GpsState *gps_s)