Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_ardrone2_raw.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2013 Dino Hensen, Vincent van Hoek
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 
27 #ifndef IMU_ARDRONE2_RAW_H_
28 #define IMU_ARDRONE2_RAW_H_
29 
30 #include "subsystems/imu.h"
31 #include "generated/airframe.h"
32 #include "navdata.h"
33 
34 #if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
35 #define IMU_MAG_X_SIGN 1
36 #define IMU_MAG_Y_SIGN 1
37 #define IMU_MAG_Z_SIGN 1
38 #endif
39 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
40 #define IMU_GYRO_P_SIGN 1
41 #define IMU_GYRO_Q_SIGN 1
42 #define IMU_GYRO_R_SIGN 1
43 #endif
44 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
45 #define IMU_ACCEL_X_SIGN 1
46 #define IMU_ACCEL_Y_SIGN 1
47 #define IMU_ACCEL_Z_SIGN 1
48 #endif
49 
53 #if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
54 #define IMU_GYRO_P_SENS 4.359
55 #define IMU_GYRO_P_SENS_NUM 4359
56 #define IMU_GYRO_P_SENS_DEN 1000
57 #define IMU_GYRO_Q_SENS 4.359
58 #define IMU_GYRO_Q_SENS_NUM 4359
59 #define IMU_GYRO_Q_SENS_DEN 1000
60 #define IMU_GYRO_R_SENS 4.359
61 #define IMU_GYRO_R_SENS_NUM 4359
62 #define IMU_GYRO_R_SENS_DEN 1000
63 #endif
64 #if !defined IMU_GYRO_P_NEUTRAL & !defined IMU_GYRO_Q_NEUTRAL & !defined IMU_GYRO_R_NEUTRAL
65 #define IMU_GYRO_P_NEUTRAL 0
66 #define IMU_GYRO_Q_NEUTRAL 0
67 #define IMU_GYRO_R_NEUTRAL 0
68 #endif
69 
73 #if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
74 #define IMU_ACCEL_X_SENS 19.5
75 #define IMU_ACCEL_X_SENS_NUM 195
76 #define IMU_ACCEL_X_SENS_DEN 10
77 #define IMU_ACCEL_Y_SENS 19.5
78 #define IMU_ACCEL_Y_SENS_NUM 195
79 #define IMU_ACCEL_Y_SENS_DEN 10
80 #define IMU_ACCEL_Z_SENS 19.5
81 #define IMU_ACCEL_Z_SENS_NUM 195
82 #define IMU_ACCEL_Z_SENS_DEN 10
83 #endif
84 
85 #if !defined IMU_ACCEL_X_NEUTRAL & !defined IMU_ACCEL_Y_NEUTRAL & !defined IMU_ACCEL_Z_NEUTRAL
86 #define IMU_ACCEL_X_NEUTRAL 2048
87 #define IMU_ACCEL_Y_NEUTRAL 2048
88 #define IMU_ACCEL_Z_NEUTRAL 2048
89 #endif
90 
91 #if !defined IMU_MAG_X_SENS & !defined IMU_MAG_Y_SENS & !defined IMU_MAG_Z_SENS
92 #define IMU_MAG_X_SENS 16.0
93 #define IMU_MAG_X_SENS_NUM 16
94 #define IMU_MAG_X_SENS_DEN 1
95 #define IMU_MAG_Y_SENS 16.0
96 #define IMU_MAG_Y_SENS_NUM 16
97 #define IMU_MAG_Y_SENS_DEN 1
98 #define IMU_MAG_Z_SENS 16.0
99 #define IMU_MAG_Z_SENS_NUM 16
100 #define IMU_MAG_Z_SENS_DEN 1
101 #endif
102 
103 #if !defined IMU_MAG_X_NEUTRAL & !defined IMU_MAG_Y_NEUTRAL & !defined IMU_MAG_Z_NEUTRAL
104 #define IMU_MAG_X_NEUTRAL 0
105 #define IMU_MAG_Y_NEUTRAL 0
106 #define IMU_MAG_Z_NEUTRAL 0
107 #endif
108 
109 
110 
111 void navdata_event(void);
112 
113 static inline void imu_ardrone2_event ( void (* _gyro_handler)(void), void (* _accel_handler)(void), void (* _mag_handler)(void))
114 {
115  navdata_update();
116  //checks if the navboard has a new dataset ready
117  if (navdata_imu_available == TRUE) {
122 
123  _gyro_handler();
124  _accel_handler();
125  _mag_handler();
126  }
127  navdata_event();
128 }
129 
130 #define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) { \
131  imu_ardrone2_event(_gyro_handler, _accel_handler, _mag_handler); \
132 }
133 
134 #endif /* IMU_ARDRONE2_RAW_H_ */
int16_t mz
Definition: navdata.h:74
static void imu_ardrone2_event(void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
struct Int32Rates gyro_unscaled
unscaled gyroscope measurements
Definition: imu.h:49
void navdata_event(void)
int16_t vx
Definition: navdata.h:45
uint16_t ay
Definition: navdata.h:42
#define FALSE
Definition: imu_chimu.h:141
int16_t vz
Definition: navdata.h:47
uint16_t az
Definition: navdata.h:43
struct Int32Vect3 accel_unscaled
unscaled accelerometer measurements
Definition: imu.h:50
int16_t my
Definition: navdata.h:72
struct Imu imu
global IMU state
Definition: imu_aspirin2.c:47
int16_t mx
Definition: navdata.h:73
Inertial Measurement Unit interface.
struct Int32Vect3 mag_unscaled
unscaled magnetometer measurements
Definition: imu.h:51
#define TRUE
Definition: imu_chimu.h:144
#define VECT3_ASSIGN(_a, _x, _y, _z)
Definition: pprz_algebra.h:107
#define RATES_ASSIGN(_ra, _p, _q, _r)
Definition: pprz_algebra.h:319
int16_t vy
Definition: navdata.h:46
uint16_t ax
Definition: navdata.h:41