Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ahrs_float_cmpl.h File Reference

Complementary filter in float to estimate the attitude, heading and gyro bias. More...

#include "std.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_orientation_conversion.h"
#include "subsystems/gps.h"
+ Include dependency graph for ahrs_float_cmpl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  AhrsFloatCmpl
 

Enumerations

enum  AhrsFCStatus { AHRS_FC_UNINIT, AHRS_FC_RUNNING }
 

Functions

void ahrs_fc_init (void)
 
void ahrs_fc_set_body_to_imu (struct OrientationReps *body_to_imu)
 
void ahrs_fc_set_body_to_imu_quat (struct FloatQuat *q_b2i)
 
void ahrs_fc_recompute_ltp_to_body (void)
 
bool ahrs_fc_align (struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag)
 
void ahrs_fc_propagate (struct FloatRates *gyro, float dt)
 
void ahrs_fc_update_accel (struct FloatVect3 *accel, float dt)
 
void ahrs_fc_update_mag (struct FloatVect3 *mag, float dt)
 
void ahrs_fc_update_gps (struct GpsState *gps_s)
 
void ahrs_fc_update_heading (float heading)
 Update yaw based on a heading measurement. More...
 
void ahrs_fc_realign_heading (float heading)
 Hard reset yaw to a heading. More...
 

Variables

struct AhrsFloatCmpl ahrs_fc
 

Detailed Description

Complementary filter in float to estimate the attitude, heading and gyro bias.

Propagation can be done in rotation matrix or quaternion representation.

Definition in file ahrs_float_cmpl.h.


Data Structure Documentation

struct AhrsFloatCmpl

Definition at line 43 of file ahrs_float_cmpl.h.

+ Collaboration diagram for AhrsFloatCmpl:
Data Fields
uint16_t accel_cnt number of propagations since last accel update
float accel_omega filter cut-off frequency for correcting the attitude from accels (pseudo-gravity measurement)
float accel_zeta filter damping for correcting the gyro-bias from accels (pseudo-gravity measurement)
struct OrientationReps body_to_imu
bool correct_gravity enable gravity correction during coordinated turns
uint8_t gravity_heuristic_factor sets how strongly the gravity heuristic reduces accel correction.

Set to zero in order to disable gravity heuristic.

struct FloatRates gyro_bias
bool heading_aligned
struct FloatRates imu_rate
bool is_aligned
struct OrientationReps ltp_to_body
struct FloatQuat ltp_to_imu_quat
struct FloatRMat ltp_to_imu_rmat
float ltp_vel_norm velocity norm for gravity correction during coordinated turns
bool ltp_vel_norm_valid
uint16_t mag_cnt number of propagations since last mag update
struct FloatVect3 mag_h
float mag_omega filter cut-off frequency for correcting the attitude (heading) from magnetometer
float mag_zeta filter damping for correcting the gyro bias from magnetometer
struct FloatRates rate_correction
enum AhrsFCStatus status
float weight

Enumeration Type Documentation

Enumerator
AHRS_FC_UNINIT 
AHRS_FC_RUNNING 

Definition at line 38 of file ahrs_float_cmpl.h.

Function Documentation

bool ahrs_fc_align ( struct FloatRates lp_gyro,
struct FloatVect3 lp_accel,
struct FloatVect3 lp_mag 
)
void ahrs_fc_realign_heading ( float  heading)

Hard reset yaw to a heading.

Doesn't affect the bias. Sets ahrs_fc.heading_aligned to TRUE.

Parameters
headingHeading in body frame, radians (CW/north)

Definition at line 473 of file ahrs_float_cmpl.c.

References ahrs_fc, ahrs_fc_recompute_ltp_to_body(), AhrsFloatCmpl::body_to_imu, FLOAT_ANGLE_NORMALIZE, float_quat_comp(), float_quat_comp_norm_shortest(), float_quat_inv_comp_norm_shortest(), float_quat_normalize(), float_rmat_of_quat(), AhrsFloatCmpl::heading_aligned, AhrsFloatCmpl::ltp_to_body, AhrsFloatCmpl::ltp_to_imu_quat, AhrsFloatCmpl::ltp_to_imu_rmat, orientationGetQuat_f(), FloatQuat::qi, FloatQuat::qx, FloatQuat::qy, and FloatQuat::qz.

Referenced by ahrs_fc_update_gps().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ahrs_fc_recompute_ltp_to_body ( void  )
void ahrs_fc_set_body_to_imu ( struct OrientationReps body_to_imu)

Definition at line 509 of file ahrs_float_cmpl.c.

References ahrs_fc_set_body_to_imu_quat(), and orientationGetQuat_f().

+ Here is the call graph for this function:

void ahrs_fc_set_body_to_imu_quat ( struct FloatQuat q_b2i)

Definition at line 514 of file ahrs_float_cmpl.c.

References ahrs_fc, AhrsFloatCmpl::body_to_imu, AhrsFloatCmpl::is_aligned, AhrsFloatCmpl::ltp_to_imu_quat, AhrsFloatCmpl::ltp_to_imu_rmat, orientationGetQuat_f(), orientationGetRMat_f(), and orientationSetQuat_f().

Referenced by ahrs_fc_set_body_to_imu(), and body_to_imu_cb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ahrs_fc_update_gps ( struct GpsState gps_s)

Definition at line 398 of file ahrs_float_cmpl.c.

References ahrs_fc, ahrs_fc_realign_heading(), ahrs_fc_update_heading(), course, GPS_FIX_3D, AhrsFloatCmpl::heading_aligned, AhrsFloatCmpl::ltp_vel_norm, and AhrsFloatCmpl::ltp_vel_norm_valid.

Referenced by gps_cb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ahrs_fc_update_heading ( float  heading)

Update yaw based on a heading measurement.

e.g. from GPS course

Parameters
headingHeading in body frame, radians (CW/north)

Definition at line 429 of file ahrs_float_cmpl.c.

References ahrs_fc, ahrs_fc_recompute_ltp_to_body(), FLOAT_ANGLE_NORMALIZE, float_rmat_vmult(), AhrsFloatCmpl::gyro_bias, AhrsFloatCmpl::ltp_to_body, AhrsFloatCmpl::ltp_to_imu_rmat, orientationGetRMat_f(), AhrsFloatCmpl::rate_correction, RATES_ADD_SCALED_VECT, RMAT_ELMT, FloatVect2::x, FloatVect2::y, and FloatVect3::z.

Referenced by ahrs_fc_update_gps().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ahrs_fc_update_mag ( struct FloatVect3 mag,
float  dt 
)

Definition at line 279 of file ahrs_float_cmpl.c.

References ahrs_fc, ahrs_fc_update_mag_2d(), ahrs_fc_update_mag_full(), and AhrsFloatCmpl::mag_cnt.

Referenced by mag_cb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation