Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
Attitude estimation for fixedwings based on the DCM. More...
#include "std.h"
#include "subsystems/ahrs/ahrs_float_dcm.h"
#include "subsystems/ahrs/ahrs_float_utils.h"
#include "firmwares/fixedwing/autopilot.h"
#include "subsystems/ahrs/ahrs_float_dcm_algebra.h"
#include "math/pprz_algebra_float.h"
#include "subsystems/gps.h"
#include <string.h>
#include "led.h"
Go to the source code of this file.
Functions | |
static void | compute_ahrs_representations (void) |
static void | set_dcm_matrix_from_rmat (struct FloatRMat *rmat) |
void | Normalize (void) |
void | Drift_correction (void) |
void | Matrix_update (float dt) |
void | ahrs_dcm_init (void) |
bool | ahrs_dcm_align (struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag) |
void | ahrs_dcm_propagate (struct FloatRates *gyro, float dt) |
void | ahrs_dcm_update_gps (struct GpsState *gps_s) |
void | ahrs_dcm_update_accel (struct FloatVect3 *accel) |
void | ahrs_dcm_update_mag (struct FloatVect3 *mag) |
void | ahrs_dcm_set_body_to_imu (struct OrientationReps *body_to_imu) |
void | ahrs_dcm_set_body_to_imu_quat (struct FloatQuat *q_b2i) |
Variables | |
struct AhrsFloatDCM | ahrs_dcm |
struct FloatVect3 | accel_float = {0, 0, 0} |
struct FloatVect3 | mag_float = {0, 0, 0} |
float | Omega_Vector [3] = {0, 0, 0} |
float | Omega_P [3] = {0, 0, 0} |
float | Omega_I [3] = {0, 0, 0} |
float | Omega [3] = {0, 0, 0} |
float | DCM_Matrix [3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} |
float | Update_Matrix [3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}} |
float | Temporary_Matrix [3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} |
float | MAG_Heading_X = 1 |
float | MAG_Heading_Y = 0 |
Attitude estimation for fixedwings based on the DCM.
Theory: http://code.google.com/p/gentlenav/downloads/list file DCMDraft2.pdf
Options:
Definition in file ahrs_float_dcm.c.
bool ahrs_dcm_align | ( | struct FloatRates * | lp_gyro, |
struct FloatVect3 * | lp_accel, | ||
struct FloatVect3 * | lp_mag | ||
) |
Definition at line 119 of file ahrs_float_dcm.c.
References ahrs_dcm, AHRS_DCM_RUNNING, ahrs_float_get_euler_from_accel_mag(), float_rmat_of_eulers, AhrsFloatDCM::gyro_bias, AhrsFloatDCM::is_aligned, AhrsFloatDCM::ltp_to_imu_euler, set_dcm_matrix_from_rmat(), and AhrsFloatDCM::status.
Referenced by aligner_cb().
void ahrs_dcm_init | ( | void | ) |
Definition at line 99 of file ahrs_float_dcm.c.
References ahrs_dcm, AHRS_DCM_UNINIT, AhrsFloatDCM::body_to_imu, FLOAT_EULERS_ZERO, FLOAT_RATES_ZERO, AhrsFloatDCM::gps_acceleration, AhrsFloatDCM::gps_age, AhrsFloatDCM::gps_course, AhrsFloatDCM::gps_course_valid, AhrsFloatDCM::gps_speed, AhrsFloatDCM::imu_rate, AhrsFloatDCM::is_aligned, AhrsFloatDCM::ltp_to_imu_euler, orientationGetRMat_f(), set_dcm_matrix_from_rmat(), and AhrsFloatDCM::status.
Referenced by ahrs_dcm_register().
void ahrs_dcm_propagate | ( | struct FloatRates * | gyro, |
float | dt | ||
) |
Definition at line 142 of file ahrs_float_dcm.c.
References ahrs_dcm, compute_ahrs_representations(), AhrsFloatDCM::gyro_bias, AhrsFloatDCM::imu_rate, Matrix_update(), Normalize(), FloatRates::p, FloatRates::q, FloatRates::r, and RATES_DIFF.
Referenced by gyro_cb().
void ahrs_dcm_set_body_to_imu | ( | struct OrientationReps * | body_to_imu | ) |
Definition at line 512 of file ahrs_float_dcm.c.
References ahrs_dcm_set_body_to_imu_quat(), and orientationGetQuat_f().
void ahrs_dcm_set_body_to_imu_quat | ( | struct FloatQuat * | q_b2i | ) |
Definition at line 517 of file ahrs_float_dcm.c.
References ahrs_dcm, AhrsFloatDCM::body_to_imu, AhrsFloatDCM::is_aligned, AhrsFloatDCM::ltp_to_imu_euler, orientationGetEulers_f(), and orientationSetQuat_f().
Referenced by ahrs_dcm_set_body_to_imu(), and body_to_imu_cb().
void ahrs_dcm_update_accel | ( | struct FloatVect3 * | accel | ) |
Definition at line 194 of file ahrs_float_dcm.c.
References ahrs_dcm, Drift_correction(), AhrsFloatDCM::gps_acceleration, AhrsFloatDCM::gps_age, AhrsFloatDCM::gps_speed, Omega, PRINT_CONFIG_MSG(), FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by accel_cb().
void ahrs_dcm_update_gps | ( | struct GpsState * | gps_s | ) |
Definition at line 169 of file ahrs_float_dcm.c.
References ahrs_dcm, GpsState::course, GpsState::fix, AhrsFloatDCM::gps_acceleration, AhrsFloatDCM::gps_age, AhrsFloatDCM::gps_course, AhrsFloatDCM::gps_course_valid, GPS_FIX_3D, AhrsFloatDCM::gps_speed, GpsState::gspeed, and GpsState::speed_3d.
Referenced by gps_cb().
void ahrs_dcm_update_mag | ( | struct FloatVect3 * | mag | ) |
Definition at line 221 of file ahrs_float_dcm.c.
References ahrs_dcm, DefaultChannel, DefaultDevice, AhrsFloatDCM::ltp_to_imu_euler, MAG_Heading_X, MAG_Heading_Y, FloatEulers::phi, FloatEulers::theta, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by mag_cb().
|
static |
Definition at line 498 of file ahrs_float_dcm.c.
References ahrs_dcm, DCM_Matrix, GRAVITY, AhrsFloatDCM::ltp_to_imu_euler, FloatEulers::phi, FloatEulers::psi, FloatEulers::theta, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by ahrs_dcm_propagate().
void Drift_correction | ( | void | ) |
Definition at line 361 of file ahrs_float_dcm.c.
References ahrs_dcm, course, DCM_Matrix, FALSE, AhrsFloatDCM::gps_course, AhrsFloatDCM::gps_course_valid, GRAVITY, imu_health, Ki_ROLLPITCH, Ki_YAW, Kp_ROLLPITCH, Kp_YAW, launch, MAG_Heading_X, MAG_Heading_Y, Omega_I, Omega_P, PRINT_CONFIG_MSG(), Vector_Add(), Vector_Cross_Product(), Vector_Dot_Product(), Vector_Scale(), FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by ahrs_dcm_update_accel().
void Matrix_update | ( | float | dt | ) |
Definition at line 462 of file ahrs_float_dcm.c.
References ahrs_dcm, DCM_Matrix, AhrsFloatDCM::imu_rate, Matrix_Multiply(), Omega, Omega_I, Omega_P, Omega_Vector, FloatRates::p, FloatRates::q, FloatRates::r, Temporary_Matrix, Update_Matrix, Vector_Add(), FloatVect3::x, and FloatVect3::y.
Referenced by ahrs_dcm_propagate().
void Normalize | ( | void | ) |
Definition at line 280 of file ahrs_float_dcm.c.
References ahrs_dcm, AhrsFloatDCM::body_to_imu, DCM_Matrix, orientationGetRMat_f(), renorm_blowup_count, renorm_sqrt_count, set_dcm_matrix_from_rmat(), Vector_Add(), Vector_Cross_Product(), Vector_Dot_Product(), and Vector_Scale().
Referenced by ahrs_dcm_propagate().
|
inlinestatic |
Definition at line 90 of file ahrs_float_dcm.c.
References DCM_Matrix, and RMAT_ELMT.
Referenced by ahrs_dcm_align(), ahrs_dcm_init(), and Normalize().
struct FloatVect3 accel_float = {0, 0, 0} |
Definition at line 59 of file ahrs_float_dcm.c.
struct AhrsFloatDCM ahrs_dcm |
Definition at line 52 of file ahrs_float_dcm.c.
Referenced by accel_cb(), ahrs_dcm_align(), ahrs_dcm_init(), ahrs_dcm_propagate(), ahrs_dcm_set_body_to_imu_quat(), ahrs_dcm_update_accel(), ahrs_dcm_update_gps(), ahrs_dcm_update_mag(), aligner_cb(), compute_ahrs_representations(), Drift_correction(), gyro_cb(), mag_cb(), Matrix_update(), Normalize(), send_filter_status(), and set_body_orientation_and_rates().
float DCM_Matrix[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} |
Definition at line 67 of file ahrs_float_dcm.c.
Referenced by compute_ahrs_representations(), Drift_correction(), Matrix_update(), Normalize(), and set_dcm_matrix_from_rmat().
struct FloatVect3 mag_float = {0, 0, 0} |
Definition at line 60 of file ahrs_float_dcm.c.
float MAG_Heading_X = 1 |
Definition at line 72 of file ahrs_float_dcm.c.
Referenced by ahrs_dcm_update_mag(), and Drift_correction().
float MAG_Heading_Y = 0 |
Definition at line 73 of file ahrs_float_dcm.c.
Referenced by ahrs_dcm_update_mag(), and Drift_correction().
float Omega[3] = {0, 0, 0} |
Definition at line 65 of file ahrs_float_dcm.c.
Referenced by ahrs_dcm_update_accel(), and Matrix_update().
float Omega_I[3] = {0, 0, 0} |
Definition at line 64 of file ahrs_float_dcm.c.
Referenced by Drift_correction(), and Matrix_update().
float Omega_P[3] = {0, 0, 0} |
Definition at line 63 of file ahrs_float_dcm.c.
Referenced by Drift_correction(), and Matrix_update().
float Omega_Vector[3] = {0, 0, 0} |
Definition at line 62 of file ahrs_float_dcm.c.
Referenced by Matrix_update().
float Temporary_Matrix[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} |
Definition at line 69 of file ahrs_float_dcm.c.
Referenced by Matrix_update().
float Update_Matrix[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}} |
Definition at line 68 of file ahrs_float_dcm.c.
Referenced by Matrix_update().