Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_xsens.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 Pascal Brisset, Antoine Drouin
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  */
22 
28 #include "imu_xsens.h"
29 #include "xsens.h"
30 
31 #include "generated/airframe.h"
32 
33 #include "mcu_periph/sys_time.h"
34 #include "subsystems/abi.h"
35 
36 static void handle_ins_msg(void);
37 
38 void imu_xsens_init(void)
39 {
40  xsens_init();
41 }
42 
43 void imu_xsens_event(void)
44 {
50  }
51 }
52 
53 static void handle_ins_msg(void)
54 {
55  uint32_t now_ts = get_sys_time_usec();
56 #ifdef XSENS_BACKWARDS
57  if (xsens.gyro_available) {
61  AbiSendMsgIMU_GYRO_INT32(IMU_XSENS_ID, now_ts, &imu.gyro);
62  }
63  if (xsens.accel_available) {
67  AbiSendMsgIMU_ACCEL_INT32(IMU_XSENS_ID, now_ts, &imu.accel);
68  }
69  if (xsens.mag_available) {
73  AbiSendMsgIMU_MAG_INT32(IMU_XSENS_ID, now_ts, &imu.mag);
74  }
75 #else
76  if (xsens.gyro_available) {
80  AbiSendMsgIMU_GYRO_INT32(IMU_XSENS_ID, now_ts, &imu.gyro);
81  }
82  if (xsens.accel_available) {
86  AbiSendMsgIMU_ACCEL_INT32(IMU_XSENS_ID, now_ts, &imu.accel);
87  }
88  if (xsens.mag_available) {
92  AbiSendMsgIMU_MAG_INT32(IMU_XSENS_ID, now_ts, &imu.mag);
93  }
94 #endif /* XSENS_BACKWARDS */
95 }
void xsens_init(void)
Definition: xsens.c:113
#define RATES_BFP_OF_REAL(_ri, _rf)
Definition: pprz_algebra.h:765
void imu_xsens_init(void)
Definition: imu_xsens.c:38
bool accel_available
Definition: xsens.h:70
float r
in rad/s
#define VECT3_ASSIGN(_a, _x, _y, _z)
Definition: pprz_algebra.h:125
#define RATES_ASSIGN(_ra, _p, _q, _r)
Definition: pprz_algebra.h:330
void parse_xsens_msg(void)
Definition: xsens.c:184
Main include for ABI (AirBorneInterface).
#define IMU_XSENS_ID
void imu_xsens_event(void)
Definition: imu_xsens.c:43
struct Imu imu
global IMU state
Definition: imu.c:108
float q
in rad/s
float p
in rad/s
static void handle_ins_msg(void)
Definition: imu_xsens.c:53
#define FALSE
Definition: std.h:5
struct FloatVect3 accel
Definition: xsens.h:57
#define ACCELS_BFP_OF_REAL(_ef, _ei)
Definition: pprz_algebra.h:801
struct Int32Vect3 mag_unscaled
unscaled magnetometer measurements
Definition: imu.h:48
struct Xsens xsens
Definition: xsens.c:109
volatile uint8_t msg_received
Definition: xsens_parser.h:47
#define MAGS_BFP_OF_REAL(_ef, _ei)
Definition: pprz_algebra.h:813
struct Int32Rates gyro_unscaled
unscaled gyroscope measurements
Definition: imu.h:46
struct Int32Vect3 accel
accelerometer measurements in m/s^2 in BFP with INT32_ACCEL_FRAC
Definition: imu.h:39
#define MAG_BFP_OF_REAL(_af)
Architecture independent timing functions.
unsigned long uint32_t
Definition: types.h:18
bool mag_available
Definition: xsens.h:71
struct Int32Vect3 mag
magnetometer measurements scaled to 1 in BFP with INT32_MAG_FRAC
Definition: imu.h:40
void imu_scale_gyro(struct Imu *_imu)
Definition: imu_vectornav.c:43
struct XsensParser parser
Definition: xsens.h:66
Parser for the Xsens protocol.
struct FloatVect3 mag
Definition: xsens.h:58
void imu_scale_mag(struct Imu *_imu)
Definition: ahrs_gx3.c:351
struct Int32Vect3 accel_unscaled
unscaled accelerometer measurements
Definition: imu.h:47
void imu_scale_accel(struct Imu *_imu)
Definition: imu_vectornav.c:44
XSENS to just provide IMU measurements.
struct FloatRates gyro
Definition: xsens.h:56
#define ACCEL_BFP_OF_REAL(_af)
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Definition: sys_time_arch.c:68
bool gyro_available
Definition: xsens.h:69
void xsens_parser_event(struct XsensParser *xsensparser)
Definition: xsens_parser.c:35
struct Int32Rates gyro
gyroscope measurements in rad/s in BFP with INT32_RATE_FRAC
Definition: imu.h:38
#define RATE_BFP_OF_REAL(_af)