Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Paparazzi specific wrapper to run MEKF-Wind INS filter. More...
#include "modules/ins/ins_mekf_wind_wrapper.h"
#include "modules/ins/ins_mekf_wind.h"
#include "subsystems/ahrs/ahrs_float_utils.h"
#include "subsystems/ahrs/ahrs_aligner.h"
#include "subsystems/ins.h"
#include "subsystems/abi.h"
#include "math/pprz_isa.h"
#include "state.h"
#include "generated/airframe.h"
#include "generated/flight_plan.h"
#include "subsystems/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
Go to the source code of this file.
Macros | |
#define | MEKF_WIND_USE_UTM TRUE |
#define | INS_MEKF_WIND_FILTER_ID 3 |
#define | INS_MEKF_WIND_AIRSPEED_ID ABI_BROADCAST |
airspeed (Pitot tube) More... | |
#define | INS_MEKF_WIND_INCIDENCE_ID ABI_BROADCAST |
incidence angles More... | |
#define | INS_MEKF_WIND_BARO_ID ABI_BROADCAST |
baro More... | |
#define | INS_MEKF_WIND_IMU_ID ABI_BROADCAST |
IMU (gyro, accel) More... | |
#define | INS_MEKF_WIND_MAG_ID ABI_BROADCAST |
magnetometer More... | |
#define | INS_MEKF_WIND_GPS_ID GPS_MULTI_ID |
ABI binding for gps data. More... | |
Functions | |
static void | set_state_from_ins (void) |
update state interface More... | |
static void | send_euler (struct transport_tx *trans, struct link_device *dev) |
logging functions More... | |
static void | send_wind (struct transport_tx *trans, struct link_device *dev) |
static void | send_filter_status (struct transport_tx *trans, struct link_device *dev) |
static void | send_inv_filter (struct transport_tx *trans, struct link_device *dev) |
static void | baro_cb (uint8_t sender_id, float pressure) |
static void | pressure_diff_cb (uint8_t sender_id, float pdyn) |
static void | airspeed_cb (uint8_t sender_id, float airspeed) |
static void | incidence_cb (uint8_t sender_id, uint8_t flag, float aoa, float sideslip) |
static void | gyro_cb (uint8_t sender_id, uint32_t stamp, struct Int32Rates *gyro) |
Call ins_mekf_wind_propagate on new gyro measurements. More... | |
static void | accel_cb (uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *accel) |
static void | mag_cb (uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *mag) |
static void | aligner_cb (uint8_t sender_id, uint32_t stamp, struct Int32Rates *lp_gyro, struct Int32Vect3 *lp_accel, struct Int32Vect3 *lp_mag) |
static void | body_to_imu_cb (uint8_t sender_id, struct FloatQuat *q_b2i) |
static void | geo_mag_cb (uint8_t sender_id, struct FloatVect3 *h) |
static void | gps_cb (uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s) |
void | ins_mekf_wind_wrapper_init (void) |
Init function. More... | |
void | ins_reset_local_origin (void) |
local implemetation of the ins_reset functions More... | |
void | ins_reset_altitude_ref (void) |
INS altitude reference reset. More... | |
Variables | |
struct InsMekfWind | ins_mekf_wind |
static struct FloatVect3 | ins_mekf_wind_accel |
last accel measurement More... | |
static uint32_t | last_imu_stamp = 0 |
static abi_event | pressure_diff_ev |
static abi_event | airspeed_ev |
static abi_event | incidence_ev |
static abi_event | baro_ev |
static abi_event | mag_ev |
static abi_event | gyro_ev |
static abi_event | accel_ev |
static abi_event | aligner_ev |
static abi_event | body_to_imu_ev |
static abi_event | geo_mag_ev |
static abi_event | gps_ev |
Paparazzi specific wrapper to run MEKF-Wind INS filter.
Definition in file ins_mekf_wind_wrapper.c.
#define INS_MEKF_WIND_AIRSPEED_ID ABI_BROADCAST |
airspeed (Pitot tube)
Definition at line 160 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
#define INS_MEKF_WIND_BARO_ID ABI_BROADCAST |
baro
Definition at line 175 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
#define INS_MEKF_WIND_FILTER_ID 3 |
Definition at line 47 of file ins_mekf_wind_wrapper.c.
Referenced by send_euler(), and send_filter_status().
#define INS_MEKF_WIND_GPS_ID GPS_MULTI_ID |
ABI binding for gps data.
Used for GPS ABI messages.
Definition at line 196 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
#define INS_MEKF_WIND_IMU_ID ABI_BROADCAST |
IMU (gyro, accel)
Definition at line 182 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
#define INS_MEKF_WIND_INCIDENCE_ID ABI_BROADCAST |
incidence angles
Definition at line 166 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
#define INS_MEKF_WIND_MAG_ID ABI_BROADCAST |
magnetometer
Definition at line 188 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
#define MEKF_WIND_USE_UTM TRUE |
Definition at line 41 of file ins_mekf_wind_wrapper.c.
|
static |
Definition at line 381 of file ins_mekf_wind_wrapper.c.
References ACCELS_FLOAT_OF_BFP, InsMekfWind::body_to_imu, float_rmat_transp_vmult(), ins_mekf_wind, ins_mekf_wind_accel, and orientationGetRMat_f().
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 269 of file ins_mekf_wind_wrapper.c.
References get_sys_time_float(), ins_mekf_wind, ins_mekf_wind_update_airspeed(), InsMekfWind::is_aligned, pprzLogFile, and tas_from_eas().
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 416 of file ins_mekf_wind_wrapper.c.
References ACCELS_FLOAT_OF_BFP, ahrs_float_get_quat_from_accel_mag(), InsMekfWind::body_to_imu, float_rmat_transp_ratemult(), float_rmat_transp_vmult(), ins_mekf_wind, ins_mekf_wind_align(), InsMekfWind::is_aligned, MAGS_FLOAT_OF_BFP, orientationGetRMat_f(), RATES_FLOAT_OF_BFP, and set_state_from_ins().
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 213 of file ins_mekf_wind_wrapper.c.
References alpha, InsMekfWind::baro_initialized, get_sys_time_float(), InsMekfWind::gps_initialized, ins_mekf_wind, ins_mekf_wind_update_baro(), InsMekfWind::is_aligned, pprz_isa_height_of_pressure(), PPRZ_ISA_SEA_LEVEL_PRESSURE, and pprzLogFile.
Referenced by ins_mekf_wind_wrapper_init().
Definition at line 447 of file ins_mekf_wind_wrapper.c.
References InsMekfWind::body_to_imu, ins_mekf_wind, ins_mekf_wind_set_quat(), InsMekfWind::is_aligned, and orientationSetQuat_f().
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 457 of file ins_mekf_wind_wrapper.c.
References ins_mekf_wind_set_mag_h().
Referenced by ins_mekf_wind_wrapper_init().
Definition at line 462 of file ins_mekf_wind_wrapper.c.
References UtmCoor_f::alt, UtmCoor_f::east, ECEF_FLOAT_OF_BFP, GpsState::ecef_pos, GpsState::ecef_vel, GpsState::fix, get_sys_time_float(), GPS_FIX_3D, InsMekfWind::gps_initialized, ins_mekf_wind, ins_mekf_wind_set_pos_ned(), ins_mekf_wind_set_speed_ned(), ins_mekf_wind_update_pos_speed(), INT32_POS_OF_CM_DEN, INT32_POS_OF_CM_NUM, INT32_VECT3_SCALE_2, InsMekfWind::is_aligned, nav_utm_zone0, NED_FLOAT_OF_BFP, State::ned_initialized_f, ned_of_ecef_point_i(), ned_of_ecef_vect_f(), State::ned_origin_f, State::ned_origin_i, GpsState::ned_vel, UtmCoor_f::north, pprzLogFile, state, utm_float_from_gps(), State::utm_initialized_f, State::utm_origin_f, FloatVect3::x, NedCoor_i::x, FloatVect3::y, NedCoor_i::y, FloatVect3::z, and NedCoor_i::z.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Call ins_mekf_wind_propagate on new gyro measurements.
Since acceleration measurement is also needed for propagation, use the last stored accel from #ins_mekfw_accel.
Definition at line 300 of file ins_mekf_wind_wrapper.c.
References InsMekfWind::body_to_imu, float_eulers_of_quat(), float_rmat_transp_ratemult(), get_sys_time_float(), InsMekfWind::gps_initialized, ins_mekf_wind, ins_mekf_wind_accel, ins_mekf_wind_get_accel_bias(), ins_mekf_wind_get_accel_ned(), ins_mekf_wind_get_airspeed_norm(), ins_mekf_wind_get_baro_bias(), ins_mekf_wind_get_body_rates(), ins_mekf_wind_get_pos_ned(), ins_mekf_wind_get_quat(), ins_mekf_wind_get_rates_bias(), ins_mekf_wind_get_speed_ned(), ins_mekf_wind_get_wind_ned(), ins_mekf_wind_propagate(), ins_mekf_wind_propagate_ahrs(), InsMekfWind::is_aligned, last_imu_stamp, orientationGetRMat_f(), FloatRates::p, FloatEulers::phi, pprzLogFile, PRINT_CONFIG_MSG(), FloatEulers::psi, FloatRates::q, FloatRates::r, RATES_FLOAT_OF_BFP, set_state_from_ins(), FloatEulers::theta, FloatVect3::x, NedCoor_f::x, FloatVect3::y, NedCoor_f::y, FloatVect3::z, and NedCoor_f::z.
Referenced by ins_mekf_wind_wrapper_init().
Definition at line 282 of file ins_mekf_wind_wrapper.c.
References get_sys_time_float(), ins_mekf_wind, ins_mekf_wind_update_incidence(), InsMekfWind::is_aligned, and pprzLogFile.
Referenced by ins_mekf_wind_wrapper_init().
void ins_mekf_wind_wrapper_init | ( | void | ) |
Init function.
Definition at line 546 of file ins_mekf_wind_wrapper.c.
References ABI_BROADCAST, accel_cb(), accel_ev, ahrs_aligner_init(), airspeed_cb(), airspeed_ev, aligner_cb(), aligner_ev, LlaCoor_i::alt, UtmCoor_f::alt, baro_cb(), baro_ev, InsMekfWind::baro_initialized, body_to_imu_cb(), body_to_imu_ev, counter, DefaultPeriodic, UtmCoor_f::east, ecef_of_lla_i(), geo_mag_cb(), geo_mag_ev, gps_cb(), gps_ev, InsMekfWind::gps_initialized, gyro_cb(), gyro_ev, LtpDef_i::hmsl, incidence_cb(), incidence_ev, ins_mekf_wind, INS_MEKF_WIND_AIRSPEED_ID, INS_MEKF_WIND_BARO_ID, INS_MEKF_WIND_GPS_ID, INS_MEKF_WIND_IMU_ID, INS_MEKF_WIND_INCIDENCE_ID, ins_mekf_wind_init(), INS_MEKF_WIND_MAG_ID, ins_mekf_wind_set_mag_h(), InsMekfWind::is_aligned, LlaCoor_i::lat, LlaCoor_i::lon, ltp_def_from_ecef_i(), mag_cb(), mag_ev, nav_utm_east0, nav_utm_north0, nav_utm_zone0, UtmCoor_f::north, pprzLogFile, pressure_diff_cb(), pressure_diff_ev, register_periodic_telemetry(), InsMekfWind::reset, send_euler(), send_filter_status(), send_inv_filter(), send_wind(), stateSetLocalOrigin_i(), stateSetLocalUtmOrigin_f(), stateSetPositionUtm_f(), and UtmCoor_f::zone.
void ins_reset_altitude_ref | ( | void | ) |
INS altitude reference reset.
Reset only vertical reference to the current altitude. Does nothing if not implemented by specific INS algorithm.
Definition at line 648 of file ins_mekf_wind_wrapper.c.
Referenced by nav_reset_alt().
void ins_reset_local_origin | ( | void | ) |
local implemetation of the ins_reset functions
INS local origin reset.
Definition at line 632 of file ins_mekf_wind_wrapper.c.
Referenced by nav_reset_reference().
|
static |
Definition at line 392 of file ins_mekf_wind_wrapper.c.
References InsMekfWind::body_to_imu, float_rmat_transp_vmult(), get_sys_time_float(), InsMekfWind::gps_initialized, ins_mekf_wind, ins_mekf_wind_update_mag(), InsMekfWind::is_aligned, MAGS_FLOAT_OF_BFP, orientationGetRMat_f(), pprzLogFile, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 255 of file ins_mekf_wind_wrapper.c.
References get_sys_time_float(), ins_mekf_wind, ins_mekf_wind_update_airspeed(), InsMekfWind::is_aligned, pprzLogFile, and tas_from_dynamic_pressure().
Referenced by ins_mekf_wind_wrapper_init().
|
static |
logging functions
telemetry functions
Definition at line 78 of file ins_mekf_wind_wrapper.c.
References float_eulers_of_quat(), INS_MEKF_WIND_FILTER_ID, ins_mekf_wind_get_quat(), FloatEulers::phi, FloatEulers::psi, and FloatEulers::theta.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 102 of file ins_mekf_wind_wrapper.c.
References InsMekfWind::baro_initialized, get_sys_time_usec(), InsMekfWind::gps_initialized, ins_mekf_wind, INS_MEKF_WIND_FILTER_ID, InsMekfWind::is_aligned, last_imu_stamp, and val.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 120 of file ins_mekf_wind_wrapper.c.
References float_eulers_of_quat(), ins_mekf_wind_get_accel_bias(), ins_mekf_wind_get_airspeed_norm(), ins_mekf_wind_get_pos_ned(), ins_mekf_wind_get_quat(), ins_mekf_wind_get_rates_bias(), ins_mekf_wind_get_speed_ned(), FloatRates::p, FloatEulers::phi, FloatEulers::psi, FloatRates::q, FloatQuat::qi, FloatRates::r, FloatEulers::theta, FloatVect3::x, NedCoor_f::x, FloatVect3::y, NedCoor_f::y, FloatVect3::z, and NedCoor_f::z.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 91 of file ins_mekf_wind_wrapper.c.
References ENU_OF_TO_NED, ins_mekf_wind_get_airspeed_norm(), ins_mekf_wind_get_wind_ned(), EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
update state interface
Set current state (ltp to body orientation/rates and ned pos/speed/accel.
Definition at line 525 of file ins_mekf_wind_wrapper.c.
References ins_mekf_wind_get_accel_ned(), ins_mekf_wind_get_body_rates(), ins_mekf_wind_get_pos_ned(), ins_mekf_wind_get_quat(), ins_mekf_wind_get_speed_ned(), stateSetAccelNed_f(), stateSetBodyRates_f(), stateSetNedToBodyQuat_f(), stateSetPositionNed_f(), and stateSetSpeedNed_f().
Referenced by aligner_cb(), and gyro_cb().
|
static |
Definition at line 206 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 201 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 207 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 203 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 208 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 209 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 210 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 205 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 202 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
struct InsMekfWind ins_mekf_wind |
Definition at line 50 of file ins_mekf_wind_wrapper.c.
Referenced by accel_cb(), airspeed_cb(), aligner_cb(), baro_cb(), body_to_imu_cb(), gps_cb(), gyro_cb(), incidence_cb(), ins_mekf_wind_wrapper_init(), mag_cb(), pressure_diff_cb(), and send_filter_status().
|
static |
last accel measurement
Definition at line 53 of file ins_mekf_wind_wrapper.c.
Referenced by accel_cb(), and gyro_cb().
|
static |
Definition at line 54 of file ins_mekf_wind_wrapper.c.
Referenced by gyro_cb(), and send_filter_status().
|
static |
Definition at line 204 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().
|
static |
Definition at line 200 of file ins_mekf_wind_wrapper.c.
Referenced by ins_mekf_wind_wrapper_init().