Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
imu.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2008-2010 The Paparazzi Team
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
28 #include "subsystems/imu.h"
29 
30 struct Imu imu;
31 
32 void imu_init(void) {
33 
34  /* initialises neutrals */
36 
38 
39 #if defined IMU_MAG_X_NEUTRAL && defined IMU_MAG_Y_NEUTRAL && defined IMU_MAG_Z_NEUTRAL
40  VECT3_ASSIGN(imu.mag_neutral, IMU_MAG_X_NEUTRAL, IMU_MAG_Y_NEUTRAL, IMU_MAG_Z_NEUTRAL);
41 #else
42 #if USE_MAGNETOMETER
43 #pragma message "Info: Magnetomter neutrals are set to zero!"
44 #endif
46 #endif
47 
48  /*
49  Compute quaternion and rotation matrix
50  for conversions between body and imu frame
51  */
52  struct Int32Eulers body_to_imu_eulers =
56  INT32_QUAT_OF_EULERS(imu.body_to_imu_quat, body_to_imu_eulers);
58  INT32_RMAT_OF_EULERS(imu.body_to_imu_rmat, body_to_imu_eulers);
59 
60  imu_impl_init();
61 }
62 
63 
64 void imu_float_init(struct ImuFloat* imuf) {
65 
66  /*
67  Compute quaternion and rotation matrix
68  for conversions between body and imu frame
69  */
75 
76 }
#define IMU_ACCEL_Y_NEUTRAL
Definition: imu_umarim.h:90
#define IMU_BODY_TO_IMU_THETA
Definition: imu.h:82
#define EULERS_ASSIGN(_e, _phi, _theta, _psi)
Definition: pprz_algebra.h:242
struct FloatEulers body_to_imu_eulers
Definition: imu.h:61
#define IMU_ACCEL_Z_NEUTRAL
Definition: imu_umarim.h:91
void imu_float_init(struct ImuFloat *imuf)
Definition: imu.c:64
#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:30
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 INT32_QUAT_OF_EULERS(_q, _e)
struct Int32Vect3 mag_neutral
magnetometer neutral readings (bias)
Definition: imu.h:47
#define IMU_GYRO_P_NEUTRAL
Definition: imu_umarim.h:60
#define IMU_GYRO_Q_NEUTRAL
Definition: imu_umarim.h:61
#define INT_VECT3_ZERO(_v)
Inertial Measurement Unit interface.
#define FLOAT_QUAT_NORMALIZE(_q)
#define VECT3_ASSIGN(_a, _x, _y, _z)
Definition: pprz_algebra.h:99
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:296
void imu_impl_init(void)
Definition: imu_navgo.c:59
#define FLOAT_RMAT_OF_EULERS(_rm, _e)
#define IMU_ACCEL_X_NEUTRAL
Definition: imu_umarim.h:89
#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:32
abstract IMU interface providing floating point interface
Definition: imu.h:56
#define INT32_RMAT_OF_EULERS(_rm, _e)
#define IMU_GYRO_R_NEUTRAL
Definition: imu_umarim.h:62
#define IMU_BODY_TO_IMU_PHI
Definition: imu.h:81
euler angles