Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
ahrs_gx3.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Michal Podhradsky
3  * Utah State University, http://aggieair.usu.edu/
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
32 #ifndef AHRS_GX3_H
33 #define AHRS_GX3_H
34 
35 #include "generated/airframe.h"
36 #include "subsystems/imu.h"
37 #include "subsystems/ins.h"
38 #include "subsystems/gps.h"
39 #include "mcu_periph/uart.h"
40 
41 #include "state.h"
42 #include "led.h"
43 
44 #define GX3_MAX_PAYLOAD 128
45 #define GX3_MSG_LEN 67
46 #define GX3_HEADER 0xC8
47 #define GX3_MIN_FREQ 300
48 
49 #define IMU_GX3_LONG_DELAY 4000000
50 
51 extern void gx3_packet_read_message(void);
52 extern void gx3_packet_parse(uint8_t c);
53 
54 struct GX3Packet {
61 };
62 
66 };
67 
68 
69 //AHRS
70 struct AhrsGX3 {
72  float mag_offset;
73 
74  struct GX3Packet packet;
75  float freq;
79  struct FloatVect3 accel;
80  struct FloatRates rate;
81  struct FloatRMat rmat;
82  bool is_aligned;
83 };
84 
85 extern struct AhrsGX3 ahrs_gx3;
86 
87 #ifndef PRIMARY_AHRS
88 #define PRIMARY_AHRS ahrs_gx3
89 #endif
90 
91 extern void ahrs_gx3_init(void);
92 extern void ahrs_gx3_align(void);
93 extern void ahrs_gx3_register(void);
94 extern void ahrs_gx3_publish_imu(void);
95 
96 extern void imu_gx3_init(void);
97 extern void imu_gx3_periodic(void);
98 extern void imu_gx3_event(void);
99 
100 #endif /* AHRS_GX3_H*/
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
imu_gx3_event
void imu_gx3_event(void)
Definition: ahrs_gx3.c:369
ins.h
uint16_t
unsigned short uint16_t
Definition: types.h:16
ahrs_gx3_init
void ahrs_gx3_init(void)
Definition: ahrs_gx3.c:328
AhrsGX3::freq
float freq
data frequency
Definition: ahrs_gx3.h:75
uint32_t
unsigned long uint32_t
Definition: types.h:18
AhrsGX3::is_aligned
bool is_aligned
Definition: ahrs_gx3.h:82
AhrsGX3::ltp_to_imu_quat
struct FloatQuat ltp_to_imu_quat
Rotation from LocalTangentPlane to IMU frame as quaternions.
Definition: ahrs_gx3.h:71
GX3PacketWaiting
@ GX3PacketWaiting
Definition: ahrs_gx3.h:64
AhrsGX3::packet
struct GX3Packet packet
Packet struct.
Definition: ahrs_gx3.h:74
AhrsGX3::mag_offset
float mag_offset
Difference between true and magnetic north.
Definition: ahrs_gx3.h:72
ahrs_gx3_register
void ahrs_gx3_register(void)
Definition: ahrs_gx3.c:341
imu_gx3_periodic
void imu_gx3_periodic(void)
Definition: ahrs_gx3.c:219
AhrsGX3::accel
struct FloatVect3 accel
measured acceleration in IMU frame
Definition: ahrs_gx3.h:79
GX3Packet::hdr_error
uint32_t hdr_error
Definition: ahrs_gx3.h:57
FloatVect3
Definition: pprz_algebra_float.h:54
ahrs_gx3
struct AhrsGX3 ahrs_gx3
Axis definition: X axis pointing forward, Y axis pointing to the right and Z axis pointing down.
Definition: ahrs_gx3.c:48
imu.h
FloatQuat
Roation quaternion.
Definition: pprz_algebra_float.h:63
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
AhrsGX3::chksm
uint16_t chksm
aux variable for checksum
Definition: ahrs_gx3.h:76
GX3Packet::msg_idx
uint8_t msg_idx
Definition: ahrs_gx3.h:60
GX3PacketStatus
GX3PacketStatus
Definition: ahrs_gx3.h:63
gps.h
Device independent GPS code (interface)
GX3Packet::chksm_error
uint32_t chksm_error
Definition: ahrs_gx3.h:56
AhrsGX3::ltime
uint32_t ltime
aux time stamp
Definition: ahrs_gx3.h:78
GX3Packet::status
uint8_t status
Definition: ahrs_gx3.h:59
uint8_t
unsigned char uint8_t
Definition: types.h:14
GX3Packet
Definition: ahrs_gx3.h:54
gx3_packet_read_message
void gx3_packet_read_message(void)
Definition: ahrs_gx3.c:227
led.h
arch independent LED (Light Emitting Diodes) API
ahrs_gx3_align
void ahrs_gx3_align(void)
Definition: ahrs_gx3.c:76
GX3PacketReading
@ GX3PacketReading
Definition: ahrs_gx3.h:65
imu_gx3_init
void imu_gx3_init(void)
Definition: ahrs_gx3.c:107
AhrsGX3::time
uint32_t time
GX3 time stamp.
Definition: ahrs_gx3.h:77
AhrsGX3::rmat
struct FloatRMat rmat
measured attitude in IMU frame (rotational matrix)
Definition: ahrs_gx3.h:81
gx3_packet_parse
void gx3_packet_parse(uint8_t c)
Definition: ahrs_gx3.c:295
FloatRMat
rotation matrix
Definition: pprz_algebra_float.h:77
GX3_MAX_PAYLOAD
#define GX3_MAX_PAYLOAD
Definition: ahrs_gx3.h:44
GX3Packet::msg_available
bool msg_available
Definition: ahrs_gx3.h:55
ahrs_gx3_publish_imu
void ahrs_gx3_publish_imu(void)
Definition: ahrs_gx3.c:354
state.h
AhrsGX3
Definition: ahrs_gx3.h:70
GX3Packet::msg_buf
uint8_t msg_buf[GX3_MAX_PAYLOAD]
Definition: ahrs_gx3.h:58
AhrsGX3::rate
struct FloatRates rate
measured angular rates in IMU frame
Definition: ahrs_gx3.h:80
FloatRates
angular rates
Definition: pprz_algebra_float.h:93