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
ahrs_gx3.c File Reference

Driver for Microstrain GX3 IMU/AHRS subsystem. More...

+ Include dependency graph for ahrs_gx3.c:

Go to the source code of this file.

Macros

#define GX3_TIME(_ubx_payload)   (uint32_t)((uint32_t)(*((uint8_t*)_ubx_payload+62+3))|(uint32_t)(*((uint8_t*)_ubx_payload+62+2))<<8|(uint32_t)(*((uint8_t*)_ubx_payload+62+1))<<16|(uint32_t)(*((uint8_t*)_ubx_payload+62+0))<<24)
 
#define GX3_CHKSM(_ubx_payload)   (uint16_t)((uint16_t)(*((uint8_t*)_ubx_payload+66+1))|(uint16_t)(*((uint8_t*)_ubx_payload+66+0))<<8)
 
#define IMU_DIV1   0
 
#define IMU_DIV2   2
 
#define ACC_FILT_DIV   2
 
#define MAG_FILT_DIV   30
 

Functions

static bool_t GX3_verify_chk (volatile uint8_t *buff_add)
 
static float bef (volatile uint8_t *c)
 
void ahrs_align (void)
 Aligns the AHRS. More...
 
void imu_impl_init (void)
 
void imu_periodic (void)
 
void GX3_packet_read_message (void)
 
void GX3_packet_parse (uint8_t c)
 
void ahrs_init (void)
 AHRS initialization. More...
 
void ahrs_aligner_run (void)
 
void ahrs_aligner_init (void)
 
void ahrs_propagate (void)
 Propagation. More...
 
void ahrs_update_accel (void)
 Update AHRS state with accerleration measurements. More...
 
void ahrs_update_mag (void)
 Update AHRS state with magnetometer measurements. More...
 
void ahrs_update_gps (void)
 Update AHRS state with GPS measurements. More...
 

Variables

struct GX3_packet GX3_packet
 
enum GX3Status GX3_status
 
uint32_t GX3_time
 
uint32_t GX3_ltime
 
uint16_t GX3_chksm
 
uint16_t GX3_calcsm
 
float GX3_freq
 
struct FloatVect3 GX3_accel
 
struct FloatRates GX3_rate
 
struct FloatRMat GX3_rmat
 
struct FloatQuat GX3_quat
 
struct FloatEulers GX3_euler
 
struct AhrsFloatQuat ahrs_impl
 
struct AhrsAligner ahrs_aligner
 

Detailed Description

Driver for Microstrain GX3 IMU/AHRS subsystem.

Takes care of configuration of the IMU, communication and parsing the received packets. See GX3 datasheet for configuration options.

Author
Michal Podhradsky micha.nosp@m.l.po.nosp@m.dhrad.nosp@m.sky@.nosp@m.aggie.nosp@m.mail.nosp@m..usu..nosp@m.edu

Definition in file ahrs_gx3.c.

Macro Definition Documentation

#define ACC_FILT_DIV   2

Referenced by imu_impl_init().

#define GX3_CHKSM (   _ubx_payload)    (uint16_t)((uint16_t)(*((uint8_t*)_ubx_payload+66+1))|(uint16_t)(*((uint8_t*)_ubx_payload+66+0))<<8)

Definition at line 36 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

#define GX3_TIME (   _ubx_payload)    (uint32_t)((uint32_t)(*((uint8_t*)_ubx_payload+62+3))|(uint32_t)(*((uint8_t*)_ubx_payload+62+2))<<8|(uint32_t)(*((uint8_t*)_ubx_payload+62+1))<<16|(uint32_t)(*((uint8_t*)_ubx_payload+62+0))<<24)

Definition at line 35 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

#define IMU_DIV1   0

Referenced by imu_impl_init().

#define IMU_DIV2   2

Referenced by imu_impl_init().

#define MAG_FILT_DIV   30

Referenced by imu_impl_init().

Function Documentation

void ahrs_align ( void  )

Aligns the AHRS.

Called after ahrs_aligner has run to set initial attitude and biases. Must set the ahrs status to AHRS_RUNNING. Needs to be implemented by each AHRS algorithm.

Definition at line 85 of file ahrs_gx3.c.

References GX3_status, GX3Link, GX3Running, and GX3Uninit.

Referenced by imu_impl_init().

+ Here is the caller graph for this function:

void ahrs_init ( void  )

AHRS initialization.

Called at startup. Needs to be implemented by each AHRS algorithm.

Definition at line 274 of file ahrs_gx3.c.

References ahrs, ahrs_aligner, AHRS_ALIGNER_LOCKED, ahrs_impl, AHRS_UNINIT, FLOAT_RATES_ZERO, AhrsFloatQuat::imu_rate, AhrsFloatQuat::ltp_to_imu_quat, AhrsFloatQuat::mag_offset, QUAT_COPY, AhrsAligner::status, and Ahrs::status.

void ahrs_propagate ( void  )

Propagation.

Usually integrates the gyro rates to angles. Reads the global imu data struct. Needs to be implemented by each AHRS algorithm.

Definition at line 306 of file ahrs_gx3.c.

void ahrs_update_accel ( void  )

Update AHRS state with accerleration measurements.

Reads the global imu data struct. Needs to be implemented by each AHRS algorithm.

Definition at line 309 of file ahrs_gx3.c.

void ahrs_update_gps ( void  )

Update AHRS state with GPS measurements.

Reads the global gps data struct. Needs to be implemented by each AHRS algorithm.

Definition at line 315 of file ahrs_gx3.c.

void ahrs_update_mag ( void  )

Update AHRS state with magnetometer measurements.

Reads the global imu data struct. Needs to be implemented by each AHRS algorithm.

Definition at line 312 of file ahrs_gx3.c.

static float bef ( volatile uint8_t c)
inlinestatic

Definition at line 65 of file ahrs_gx3.c.

References c, and p.

Referenced by GX3_packet_read_message().

+ Here is the caller graph for this function:

void GX3_packet_parse ( uint8_t  c)

Definition at line 242 of file ahrs_gx3.c.

References c, GX3_packet::chksm_error, FALSE, GX3_HEADER, GX3_MSG_LEN, GX3_verify_chk(), GX3PacketReading, GX3PacketWaiting, GX3_packet::hdr_error, GX3_packet::msg_available, GX3_packet::msg_buf, GX3_packet::msg_idx, GX3_packet::status, and TRUE.

Referenced by ReadGX3Buffer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool_t GX3_verify_chk ( volatile uint8_t buff_add)
inlinestatic

Definition at line 76 of file ahrs_gx3.c.

References chk_calc, and GX3_MSG_LEN.

Referenced by GX3_packet_parse().

+ Here is the caller graph for this function:

void imu_periodic ( void  )

Definition at line 185 of file ahrs_gx3.c.

Variable Documentation

struct AhrsAligner ahrs_aligner

Definition at line 59 of file ahrs_gx3.c.

Referenced by ahrs_init().

struct AhrsFloatQuat ahrs_impl

Definition at line 58 of file ahrs_gx3.c.

Referenced by ahrs_init(), and GX3_packet_read_message().

struct FloatVect3 GX3_accel

Definition at line 52 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

uint16_t GX3_calcsm

Definition at line 49 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

uint16_t GX3_chksm

Definition at line 48 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

struct FloatEulers GX3_euler

Definition at line 56 of file ahrs_gx3.c.

float GX3_freq

Definition at line 50 of file ahrs_gx3.c.

Referenced by ahrs_aligner_run(), and GX3_packet_read_message().

uint32_t GX3_ltime

Definition at line 47 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

Definition at line 44 of file ahrs_gx3.c.

struct FloatQuat GX3_quat

Definition at line 55 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

struct FloatRates GX3_rate

Definition at line 53 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

struct FloatRMat GX3_rmat

Definition at line 54 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

enum GX3Status GX3_status

Definition at line 45 of file ahrs_gx3.c.

Referenced by ahrs_align(), and imu_impl_init().

uint32_t GX3_time

Definition at line 46 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().