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
ins_xsens.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 ENAC
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 
27 #ifndef INS_XSENS_H
28 #define INS_XSENS_H
29 
30 #include "std.h"
31 
32 #include "ins_module.h"
33 
34 struct XsensTime {
42 };
43 
44 extern struct XsensTime xsens_time;
45 
48 
49 
50 /* To use Xsens to just provide IMU measurements
51  * for use with an external AHRS algorithm
52  */
53 #if USE_IMU
54 #include "subsystems/imu.h"
55 
56 struct ImuXsens {
59  bool_t mag_available;
60 };
61 extern struct ImuXsens imu_xsens;
62 
63 #define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) { \
64  if (imu_xsens.accel_available) { \
65  imu_xsens.accel_available = FALSE; \
66  _accel_handler(); \
67  } \
68  if (imu_xsens.gyro_available) { \
69  imu_xsens.gyro_available = FALSE; \
70  _gyro_handler(); \
71  } \
72  if (imu_xsens.mag_available) { \
73  imu_xsens.mag_available = FALSE; \
74  _mag_handler(); \
75  } \
76  }
77 #endif /* USE_IMU */
78 
79 
80 /* use Xsens as a full INS solution */
81 #if USE_INS_MODULE
82 #define InsEvent(_ins_handler) { \
83  InsEventCheckAndHandle(handle_ins_msg()) \
84 }
85 #endif
86 
87 
88 #if USE_GPS_XSENS
89 extern bool_t gps_xsens_msg_available;
90 #define GpsEvent(_sol_available_callback) { \
91  if (gps_xsens_msg_available) { \
92  gps.last_msg_ticks = sys_time.nb_sec_rem; \
93  gps.last_msg_time = sys_time.nb_sec; \
94  if (gps.fix == GPS_FIX_3D) { \
95  gps.last_3dfix_ticks = sys_time.nb_sec_rem; \
96  gps.last_3dfix_time = sys_time.nb_sec; \
97  } \
98  _sol_available_callback(); \
99  gps_xsens_msg_available = FALSE; \
100  } \
101  }
102 #endif
103 
104 #endif
unsigned short uint16_t
Definition: types.h:16
Library for the XSENS AHRS.
Definition: ins_xsens.h:34
uint8_t xsens_msg_status
Definition: ins_xsens.c:185
int8_t min
Definition: ins_xsens.h:36
struct ImuXsens imu_xsens
Definition: ins_xsens.c:232
int32_t nanosec
Definition: ins_xsens.h:38
struct XsensTime xsens_time
Definition: ins_xsens.c:201
uint16_t xsens_time_stamp
Definition: ins_xsens.c:186
bool_t mag_available
Definition: ins_xsens.h:59
bool_t gyro_available
Definition: ins_xsens.h:57
int8_t day
Definition: ins_xsens.h:41
signed short int16_t
Definition: types.h:17
bool_t accel_available
Definition: ins_xsens.h:58
int8_t hour
Definition: ins_xsens.h:35
Inertial Measurement Unit interface.
signed long int32_t
Definition: types.h:19
int8_t sec
Definition: ins_xsens.h:37
int8_t month
Definition: ins_xsens.h:40
unsigned char uint8_t
Definition: types.h:14
signed char int8_t
Definition: types.h:15
int16_t year
Definition: ins_xsens.h:39
Device independent INS code.