uint8_tquality;// quality indicator between 0 and 255
Vector2fflowRadXY;// measured delta angle of the image about the X and Y body axes (rad), RH rotaton is positive
Vector2fflowRadXYcomp;// measured delta angle of the image about the X and Y body axes after removal of body rotation (rad), RH rotation is positive
Vector2fgyroXY;// measured delta angle of the inertial frame about the X and Y body axes obtained from rate gyro measurements (rad), RH rotation is positive
floatdt;// amount of integration time (sec)
uint64_ttime_us;// timestamp in microseconds of the integration period mid-point
};
enumvdist_sensor_type_t{
VDIST_SENSOR_RANGE,
VDIST_SENSOR_BARO,
VDIST_SENSOR_GPS,
VDIST_SENSOR_NONE
};
// Bit locations for mag_declination_source
#define MASK_USE_GEO_DECL (1<<0) // set to true to use the declination from the geo library when the GPS position becomes available, set to false to always use the EKF2_MAG_DECL value
#define MASK_SAVE_GEO_DECL (1<<1) // set to true to set the EKF2_MAG_DECL parameter to the value returned by the geo library
#define MASK_FUSE_DECL (1<<2) // set to true if the declination is always fused as an observation to constrain drift when 3-axis fusion is performed
// Bit locations for fusion_mode
#define MASK_USE_GPS (1<<0) // set to true to use GPS data
#define MASK_USE_OF (1<<1) // set to true to use optical flow data
// Integer definitions for mag_fusion_type
#define MAG_FUSE_TYPE_AUTO 0 // The selection of either heading or 3D magnetometer fusion will be automatic
#define MAG_FUSE_TYPE_HEADING 1 // Simple yaw angle fusion will always be used. This is less accurate, but less affected by earth field distortions. It should not be used for pitch angles outside the range from -60 to +60 deg
#define MAG_FUSE_TYPE_3D 2 // Magnetometer 3-axis fusion will always be used. This is more accurate, but more affected by localised earth field distortions
#define MAG_FUSE_TYPE_2D 3 // A 2D fusion that uses the horizontal projection of the magnetic fields measurement will alays be used. This is less accurate, but less affected by earth field distortions.
structparameters{
floatmag_delay_ms;// magnetometer measurement delay relative to the IMU
floatbaro_delay_ms;// barometer height measurement delay relative to the IMU
floatgps_delay_ms;// GPS measurement delay relative to the IMU
floatairspeed_delay_ms;// airspeed measurement delay relative to the IMU
// measurement source control
intfusion_mode;
intvdist_sensor_type;
// measurement time delays
floatmag_delay_ms;// magnetometer measurement delay relative to the IMU (msec)
floatbaro_delay_ms;// barometer height measurement delay relative to the IMU (msec)
floatgps_delay_ms;// GPS measurement delay relative to the IMU (msec)
floatairspeed_delay_ms;// airspeed measurement delay relative to the IMU (msec)
floatflow_delay_ms;// optical flow measurement delay relative to the IMU (msec) - this is to the middle of the optical flow integration interval
floatrange_delay_ms;// range finder measurement delay relative to the IMU (msec)
// input noise
floatgyro_noise;// IMU angular rate noise used for covariance prediction
floataccel_noise;// IMU acceleration noise use for covariance prediction
floatgyro_noise;// IMU angular rate noise used for covariance prediction (rad/sec)
floataccel_noise;// IMU acceleration noise use for covariance prediction (m/sec/sec)
// process noise
floatgyro_bias_p_noise;// process noise for IMU delta angle bias prediction
floataccel_bias_p_noise;// process noise for IMU delta velocity bias prediction
floatgyro_scale_p_noise;// process noise for gyro scale factor prediction
floatmag_p_noise;// process noise for magnetic field prediction
floatwind_vel_p_noise;// process noise for wind velocity prediction
floatgps_vel_noise;// observation noise for gps velocity fusion
floatgps_pos_noise;// observation noise for gps position fusion
floatpos_noaid_noise;// observation noise for non-aiding position fusion
floatbaro_noise;// observation noise for barometric height fusion
floatbaro_innov_gate;// barometric height innovation consistency gate size in standard deviations
floatposNE_innov_gate;// GPS horizontal position innovation consistency gate size in standard deviations
floatvel_innov_gate;// GPS velocity innovation consistency gate size in standard deviations
floatmag_heading_noise;// measurement noise used for simple heading fusion
floatmag_noise;// measurement noise used for 3-axis magnetoemeter fusion
floatmag_declination_deg;// magnetic declination in degrees
floatheading_innov_gate;// heading fusion innovation consistency gate size in standard deviations
floatmag_innov_gate;// magnetometer fusion innovation consistency gate size in standard deviations
floatgyro_bias_p_noise;// process noise for IMU delta angle bias prediction (rad/sec)
floataccel_bias_p_noise;// process noise for IMU delta velocity bias prediction (m/sec/sec)
floatgyro_scale_p_noise;// process noise for gyro scale factor prediction (N/A)
floatmag_p_noise;// process noise for magnetic field prediction (Guass/sec)
floatwind_vel_p_noise;// process noise for wind velocity prediction (m/sec/sec)
floatterrain_p_noise;// process noise for terrain offset (m/sec)
// position and velocity fusion
floatgps_vel_noise;// observation noise for gps velocity fusion (m/sec)
floatgps_pos_noise;// observation noise for gps position fusion (m)
floatpos_noaid_noise;// observation noise for non-aiding position fusion (m)
floatbaro_noise;// observation noise for barometric height fusion (m)
#define MASK_USE_GEO_DECL (1<<0) // set to true to use the declination from the geo library when the GPS position becomes available, set to false to always use the EKF2_MAG_DECL value
#define MASK_SAVE_GEO_DECL (1<<1) // set to true to set the EKF2_MAG_DECL parameter to the value returned by the geo library
#define MASK_FUSE_DECL (1<<2) // set to true if the declination is always fused as an observation to constrain drift when 3-axis fusion is performed
// Integer definitions for mag_fusion_type
#define MAG_FUSE_TYPE_AUTO 0 // The selection of either heading or 3D magnetometer fusion will be automatic
#define MAG_FUSE_TYPE_HEADING 1 // Simple yaw angle fusion will always be used. This is less accurate, but less affected by earth field distortions. It should not be used for pitch angles outside the range from -60 to +60 deg
#define MAG_FUSE_TYPE_3D 2 // Magnetometer 3-axis fusion will always be used. This is more accurate, but more affected by localised earth field distortions
#define MAG_FUSE_TYPE_2D 3 // A 2D fusion that uses the horizontal projection of the magnetic fields measurement will alays be used. This is less accurate, but less affected by earth field distortions.
structstateSample{
Vector3fang_error;// attitude axis angle error (error state formulation)
Vector3fvel;// NED velocity in earth frame in m/s
@ -259,17 +324,20 @@ union gps_check_fail_status_u {
@@ -259,17 +324,20 @@ union gps_check_fail_status_u {
// bitmask containing filter control status
unionfilter_control_status_u{
struct{
uint8_ttilt_align:1;// 0 - true if the filter tilt alignment is complete
uint8_tyaw_align:1;// 1 - true if the filter yaw alignment is complete
uint8_tgps:1;// 2 - true if GPS measurements are being fused
uint8_topt_flow:1;// 3 - true if optical flow measurements are being fused
uint8_tmag_hdg:1;// 4 - true if a simple magnetic yaw heading is being fused
uint8_tmag_2D:1;// 5 - true if the horizontal projection of magnetometer data is being fused
uint8_tmag_3D:1;// 6 - true if 3-axis magnetometer measurement are being fused
uint8_tmag_dec:1;// 7 - true if synthetic magnetic declination measurements are being fused
uint8_tin_air:1;// 8 - true when the vehicle is airborne
uint8_tarmed:1;// 9 - true when the vehicle motors are armed
uint8_twind:1;// 10 - true when wind velocity is being estimated
uint16_ttilt_align:1;// 0 - true if the filter tilt alignment is complete
uint16_tyaw_align:1;// 1 - true if the filter yaw alignment is complete
uint16_tgps:1;// 2 - true if GPS measurements are being fused
uint16_topt_flow:1;// 3 - true if optical flow measurements are being fused
uint16_tmag_hdg:1;// 4 - true if a simple magnetic yaw heading is being fused
uint16_tmag_2D:1;// 5 - true if the horizontal projection of magnetometer data is being fused
uint16_tmag_3D:1;// 6 - true if 3-axis magnetometer measurement are being fused
uint16_tmag_dec:1;// 7 - true if synthetic magnetic declination measurements are being fused
uint16_tin_air:1;// 8 - true when the vehicle is airborne
uint16_tarmed:1;// 9 - true when the vehicle motors are armed
uint16_twind:1;// 10 - true when wind velocity is being estimated
uint16_tbaro_hgt:1;// 11 - true when baro height is being fused as a primary height reference
uint16_trng_hgt:1;// 12 - true when range finder height is being fused as a primary height reference
uint16_tgps_hgt:1;// 15 - true when range finder height is being fused as a primary height reference