Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2010 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 
27 #include "subsystems/imu.h"
28 
29 struct Imu imu;
30 
31 void imu_init(void) {
32 
33  /* initialises neutrals */
35 
37 
38 #if defined IMU_MAG_X_NEUTRAL && defined IMU_MAG_Y_NEUTRAL && defined IMU_MAG_Z_NEUTRAL
39  VECT3_ASSIGN(imu.mag_neutral, IMU_MAG_X_NEUTRAL, IMU_MAG_Y_NEUTRAL, IMU_MAG_Z_NEUTRAL);
40 #else
41 #if USE_MAGNETOMETER
42 INFO("Magnetometer neutrals are set to zero, you should calibrate!")
43 #endif
45 #endif
46 
47  /*
48  Compute quaternion and rotation matrix
49  for conversions between body and imu frame
50  */
51  struct Int32Eulers body_to_imu_eulers =
55  INT32_QUAT_OF_EULERS(imu.body_to_imu_quat, body_to_imu_eulers);
57  INT32_RMAT_OF_EULERS(imu.body_to_imu_rmat, body_to_imu_eulers);
58 
59  imu_impl_init();
60 }
61 
62 
63 void imu_float_init(struct ImuFloat* imuf) {
64 
65  /*
66  Compute quaternion and rotation matrix
67  for conversions between body and imu frame
68  */
74 
75 }
#define IMU_BODY_TO_IMU_THETA
Definition: imu.h:82
#define EULERS_ASSIGN(_e, _phi, _theta, _psi)
Definition: pprz_algebra.h:240
struct FloatEulers body_to_imu_eulers
Definition: imu.h:61
void imu_float_init(struct ImuFloat *imuf)
Definition: imu.c:63
#define ANGLE_BFP_OF_REAL(_af)
struct Int32RMat body_to_imu_rmat
rotation from body to imu frame as a rotation matrix
Definition: imu.h:52
#define INT32_QUAT_NORMALIZE(q)
abstract IMU interface providing fixed point interface
Definition: imu.h:39
struct Imu imu
global IMU state
Definition: imu.c:29
struct FloatRMat body_to_imu_rmat
Definition: imu.h:63
#define FLOAT_QUAT_OF_EULERS(_q, _e)
struct Int32Rates gyro_neutral
gyroscope bias
Definition: imu.h:45
#define IMU_GYRO_P_NEUTRAL
Definition: imu_apogee.h:69
void imu_impl_init(void)
Definition: imu_apogee.c:64
#define INT32_QUAT_OF_EULERS(_q, _e)
struct Int32Vect3 mag_neutral
magnetometer neutral readings (bias)
Definition: imu.h:47
#define INT_VECT3_ZERO(_v)
Inertial Measurement Unit interface.
#define IMU_ACCEL_Z_NEUTRAL
Definition: imu_apogee.h:94
#define FLOAT_QUAT_NORMALIZE(_q)
#define VECT3_ASSIGN(_a, _x, _y, _z)
Definition: pprz_algebra.h:97
struct Int32Quat body_to_imu_quat
rotation from body to imu frame as a unit quaternion
Definition: imu.h:51
struct Int32Vect3 accel_neutral
accelerometer bias
Definition: imu.h:46
#define RATES_ASSIGN(_ra, _p, _q, _r)
Definition: pprz_algebra.h:294
#define FLOAT_RMAT_OF_EULERS(_rm, _e)
#define IMU_ACCEL_Y_NEUTRAL
Definition: imu_apogee.h:93
#define IMU_BODY_TO_IMU_PSI
Definition: imu.h:83
struct FloatQuat body_to_imu_quat
Definition: imu.h:62
void imu_init(void)
Definition: imu.c:31
abstract IMU interface providing floating point interface
Definition: imu.h:56
#define IMU_GYRO_Q_NEUTRAL
Definition: imu_apogee.h:70
#define INT32_RMAT_OF_EULERS(_rm, _e)
#define IMU_GYRO_R_NEUTRAL
Definition: imu_apogee.h:71
#define IMU_BODY_TO_IMU_PHI
Definition: imu.h:81
#define IMU_ACCEL_X_NEUTRAL
Definition: imu_apogee.h:92
euler angles