Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "generated/airframe.h"
#include "subsystems/imu.h"
#include "subsystems/ins.h"
#include "subsystems/gps.h"
#include "mcu_periph/uart.h"
#include "state.h"
#include "led.h"
Go to the source code of this file.
Data Structures | |
struct | GX3Packet |
struct | AhrsGX3 |
Macros | |
#define | GX3_MAX_PAYLOAD 128 |
#define | GX3_MSG_LEN 67 |
#define | GX3_HEADER 0xC8 |
#define | GX3_MIN_FREQ 300 |
#define | IMU_GX3_LONG_DELAY 4000000 |
#define | PRIMARY_AHRS ahrs_gx3 |
Enumerations | |
enum | GX3PacketStatus { GX3PacketWaiting, GX3PacketReading } |
Functions | |
void | gx3_packet_read_message (void) |
void | gx3_packet_parse (uint8_t c) |
void | ahrs_gx3_init (void) |
void | ahrs_gx3_align (void) |
void | ahrs_gx3_register (void) |
void | ahrs_gx3_publish_imu (void) |
void | imu_gx3_init (void) |
void | imu_gx3_periodic (void) |
void | imu_gx3_event (void) |
Variables | |
struct AhrsGX3 | ahrs_gx3 |
Axis definition: X axis pointing forward, Y axis pointing to the right and Z axis pointing down. More... | |
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.
Definition in file ahrs_gx3.h.
struct GX3Packet |
Definition at line 54 of file ahrs_gx3.h.
Data Fields | ||
---|---|---|
uint32_t | chksm_error | |
uint32_t | hdr_error | |
bool | msg_available | |
uint8_t | msg_buf[GX3_MAX_PAYLOAD] | |
uint8_t | msg_idx | |
uint8_t | status |
struct AhrsGX3 |
Definition at line 70 of file ahrs_gx3.h.
Data Fields | ||
---|---|---|
struct FloatVect3 | accel | measured acceleration in IMU frame |
uint16_t | chksm | aux variable for checksum |
float | freq | data frequency |
bool | is_aligned | |
uint32_t | ltime | aux time stamp |
struct FloatQuat | ltp_to_imu_quat | Rotation from LocalTangentPlane to IMU frame as quaternions. |
float | mag_offset | Difference between true and magnetic north. |
struct GX3Packet | packet | Packet struct. |
struct FloatRates | rate | measured angular rates in IMU frame |
struct FloatRMat | rmat | measured attitude in IMU frame (rotational matrix) |
uint32_t | time | GX3 time stamp. |
#define GX3_HEADER 0xC8 |
Definition at line 46 of file ahrs_gx3.h.
#define GX3_MAX_PAYLOAD 128 |
Definition at line 44 of file ahrs_gx3.h.
#define GX3_MIN_FREQ 300 |
Definition at line 47 of file ahrs_gx3.h.
#define GX3_MSG_LEN 67 |
Definition at line 45 of file ahrs_gx3.h.
#define IMU_GX3_LONG_DELAY 4000000 |
Definition at line 49 of file ahrs_gx3.h.
#define PRIMARY_AHRS ahrs_gx3 |
Definition at line 88 of file ahrs_gx3.h.
enum GX3PacketStatus |
Enumerator | |
---|---|
GX3PacketWaiting | |
GX3PacketReading |
Definition at line 63 of file ahrs_gx3.h.
void ahrs_gx3_align | ( | void | ) |
Definition at line 76 of file ahrs_gx3.c.
References ahrs_gx3, AhrsGX3::is_aligned, and uart_put_byte().
Referenced by imu_gx3_init().
void ahrs_gx3_init | ( | void | ) |
Definition at line 328 of file ahrs_gx3.c.
References ahrs_gx3, Imu::body_to_imu, imu, AhrsGX3::is_aligned, AhrsGX3::ltp_to_imu_quat, AhrsGX3::mag_offset, orientationGetQuat_f(), and QUAT_COPY.
Referenced by ahrs_gx3_register().
void ahrs_gx3_publish_imu | ( | void | ) |
Definition at line 354 of file ahrs_gx3.c.
References Imu::accel, get_sys_time_usec(), Imu::gyro, imu, IMU_GX3_ID, and Imu::mag.
Referenced by imu_gx3_event().
void ahrs_gx3_register | ( | void | ) |
Definition at line 341 of file ahrs_gx3.c.
References ahrs_gx3_init(), and ahrs_register_impl().
void gx3_packet_parse | ( | uint8_t | c | ) |
Definition at line 295 of file ahrs_gx3.c.
References ahrs_gx3, c(), GX3Packet::chksm_error, GX3_HEADER, GX3_MSG_LEN, gx3_verify_chk(), GX3PacketReading, GX3PacketWaiting, GX3Packet::hdr_error, GX3Packet::msg_available, GX3Packet::msg_buf, GX3Packet::msg_idx, AhrsGX3::packet, and GX3Packet::status.
Referenced by ReadGX3Buffer().
void gx3_packet_read_message | ( | void | ) |
Definition at line 227 of file ahrs_gx3.c.
References Imu::accel, AhrsGX3::accel, ACCELS_BFP_OF_REAL, ahrs_gx3, bef(), Imu::body_to_imu, AhrsGX3::chksm, GpsState::course, float_eulers_of_rmat(), float_rmat_comp(), float_rmat_ratemult(), AhrsGX3::freq, gps, GX3_CHKSM, Imu::gyro, imu, AhrsGX3::ltime, FloatRMat::m, AhrsGX3::mag_offset, GX3Packet::msg_buf, orientationGetRMat_f(), FloatRates::p, AhrsGX3::packet, FloatEulers::psi, FloatRates::q, FloatRates::r, AhrsGX3::rate, RATES_BFP_OF_REAL, AhrsGX3::rmat, stateSetBodyRates_f(), stateSetNedToBodyEulers_f(), stateSetNedToBodyRMat_f(), AhrsGX3::time, VECT3_SMUL, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by imu_gx3_event().
void imu_gx3_event | ( | void | ) |
Definition at line 369 of file ahrs_gx3.c.
References ahrs_gx3, ahrs_gx3_publish_imu(), gx3_packet_read_message(), GX3Packet::msg_available, AhrsGX3::packet, ReadGX3Buffer(), and uart_char_available().
void imu_gx3_init | ( | void | ) |
Definition at line 107 of file ahrs_gx3.c.
References ahrs_gx3, ahrs_gx3_align(), GX3Packet::chksm_error, DefaultPeriodic, GX3PacketWaiting, GX3Packet::hdr_error, IMU_GX3_LONG_DELAY, AhrsGX3::is_aligned, GX3Packet::msg_available, GX3Packet::msg_idx, AhrsGX3::packet, register_periodic_telemetry(), send_gx3(), GX3Packet::status, and uart_put_byte().
void imu_gx3_periodic | ( | void | ) |
Definition at line 219 of file ahrs_gx3.c.
struct AhrsGX3 ahrs_gx3 |
Axis definition: X axis pointing forward, Y axis pointing to the right and Z axis pointing down.
Positive pitch : nose up Positive roll : right wing down Positive yaw : clockwise
Definition at line 48 of file ahrs_gx3.c.
Referenced by ahrs_gx3_align(), ahrs_gx3_init(), gx3_packet_parse(), gx3_packet_read_message(), imu_gx3_event(), imu_gx3_init(), ReadGX3Buffer(), and send_gx3().