Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
ins_mekf_wind_wrapper.c File Reference
#include "modules/ins/ins_mekf_wind_wrapper.h"
#include "modules/ins/ins_mekf_wind.h"
#include "modules/air_data/air_data.h"
#include "modules/ahrs/ahrs_float_utils.h"
#include "modules/ahrs/ahrs_aligner.h"
#include "modules/ins/ins.h"
#include "modules/core/abi.h"
#include "math/pprz_isa.h"
#include "state.h"
#include "generated/airframe.h"
#include "generated/flight_plan.h"
#include "modules/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
+ Include dependency graph for ins_mekf_wind_wrapper.c:

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, uint32_t stamp, 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
 

Detailed Description

Paparazzi specific wrapper to run MEKF-Wind INS filter.

Definition in file ins_mekf_wind_wrapper.c.

Macro Definition Documentation

◆ INS_MEKF_WIND_AIRSPEED_ID

#define INS_MEKF_WIND_AIRSPEED_ID   ABI_BROADCAST

airspeed (Pitot tube)

Definition at line 161 of file ins_mekf_wind_wrapper.c.

◆ INS_MEKF_WIND_BARO_ID

#define INS_MEKF_WIND_BARO_ID   ABI_BROADCAST

baro

Definition at line 176 of file ins_mekf_wind_wrapper.c.

◆ INS_MEKF_WIND_FILTER_ID

#define INS_MEKF_WIND_FILTER_ID   3

Definition at line 48 of file ins_mekf_wind_wrapper.c.

◆ INS_MEKF_WIND_GPS_ID

#define INS_MEKF_WIND_GPS_ID   GPS_MULTI_ID

ABI binding for gps data.

Used for GPS ABI messages.

Definition at line 197 of file ins_mekf_wind_wrapper.c.

◆ INS_MEKF_WIND_IMU_ID

#define INS_MEKF_WIND_IMU_ID   ABI_BROADCAST

IMU (gyro, accel)

Definition at line 183 of file ins_mekf_wind_wrapper.c.

◆ INS_MEKF_WIND_INCIDENCE_ID

#define INS_MEKF_WIND_INCIDENCE_ID   ABI_BROADCAST

incidence angles

Definition at line 167 of file ins_mekf_wind_wrapper.c.

◆ INS_MEKF_WIND_MAG_ID

#define INS_MEKF_WIND_MAG_ID   ABI_BROADCAST

magnetometer

Definition at line 189 of file ins_mekf_wind_wrapper.c.

◆ MEKF_WIND_USE_UTM

#define MEKF_WIND_USE_UTM   TRUE

Definition at line 42 of file ins_mekf_wind_wrapper.c.

Function Documentation

◆ accel_cb()

static void accel_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct Int32Vect3 accel 
)
static

Definition at line 382 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ airspeed_cb()

static void airspeed_cb ( uint8_t  sender_id,
float  airspeed 
)
static

Definition at line 270 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aligner_cb()

static void aligner_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct Int32Rates lp_gyro,
struct Int32Vect3 lp_accel,
struct Int32Vect3 lp_mag 
)
static

◆ baro_cb()

static void baro_cb ( uint8_t  sender_id,
uint32_t  stamp,
float  pressure 
)
static

◆ body_to_imu_cb()

static void body_to_imu_cb ( uint8_t  sender_id,
struct FloatQuat q_b2i 
)
static

Definition at line 448 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ geo_mag_cb()

static void geo_mag_cb ( uint8_t  sender_id,
struct FloatVect3 h 
)
static

Definition at line 458 of file ins_mekf_wind_wrapper.c.

References h(), and ins_mekf_wind_set_mag_h().

Referenced by ins_mekf_wind_wrapper_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gps_cb()

◆ gyro_cb()

◆ incidence_cb()

static void incidence_cb ( uint8_t  sender_id,
uint8_t  flag,
float  aoa,
float  sideslip 
)
static

Definition at line 283 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ins_mekf_wind_wrapper_init()

◆ ins_reset_altitude_ref()

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 649 of file ins_mekf_wind_wrapper.c.

References LlaCoor_i::alt, UtmCoor_f::alt, gps, GpsState::hmsl, LtpDef_i::hmsl, LlaCoor_i::lat, LtpDef_i::lla, GpsState::lla_pos, LlaCoor_i::lon, ltp_def, ltp_def_from_lla_i(), State::ned_origin_i, state, stateSetLocalOrigin_i(), stateSetLocalUtmOrigin_f(), and State::utm_origin_f.

+ Here is the call graph for this function:

◆ ins_reset_local_origin()

void ins_reset_local_origin ( void  )

local implemetation of the ins_reset functions

INS local origin reset.

Definition at line 633 of file ins_mekf_wind_wrapper.c.

References GpsState::ecef_pos, gps, GpsState::hmsl, LtpDef_i::hmsl, ins_mekf_wind_wrapper_Reset, ltp_def, ltp_def_from_ecef_i(), stateSetLocalOrigin_i(), stateSetLocalUtmOrigin_f(), and utm_float_from_gps().

+ Here is the call graph for this function:

◆ mag_cb()

static void mag_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct Int32Vect3 mag 
)
static

◆ pressure_diff_cb()

static void pressure_diff_cb ( uint8_t  sender_id,
float  pdyn 
)
static

Definition at line 256 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_euler()

static void send_euler ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

logging functions

telemetry functions

Definition at line 79 of file ins_mekf_wind_wrapper.c.

References dev, 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_filter_status()

static void send_filter_status ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 103 of file ins_mekf_wind_wrapper.c.

References InsMekfWind::baro_initialized, dev, 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_inv_filter()

static void send_inv_filter ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

◆ send_wind()

static void send_wind ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 92 of file ins_mekf_wind_wrapper.c.

References dev, 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_state_from_ins()

static void set_state_from_ins ( void  )
static

update state interface

Set current state (ltp to body orientation/rates and ned pos/speed/accel.

Definition at line 526 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ accel_ev

abi_event accel_ev
static

Definition at line 207 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ airspeed_ev

abi_event airspeed_ev
static

Definition at line 202 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ aligner_ev

abi_event aligner_ev
static

Definition at line 208 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ baro_ev

abi_event baro_ev
static

Definition at line 204 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ body_to_imu_ev

abi_event body_to_imu_ev
static

Definition at line 209 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ geo_mag_ev

abi_event geo_mag_ev
static

Definition at line 210 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ gps_ev

abi_event gps_ev
static

Definition at line 211 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ gyro_ev

abi_event gyro_ev
static

Definition at line 206 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ incidence_ev

abi_event incidence_ev
static

Definition at line 203 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ ins_mekf_wind

◆ ins_mekf_wind_accel

struct FloatVect3 ins_mekf_wind_accel
static

last accel measurement

Definition at line 54 of file ins_mekf_wind_wrapper.c.

Referenced by accel_cb(), and gyro_cb().

◆ last_imu_stamp

uint32_t last_imu_stamp = 0
static

Definition at line 55 of file ins_mekf_wind_wrapper.c.

Referenced by gyro_cb(), and send_filter_status().

◆ mag_ev

abi_event mag_ev
static

Definition at line 205 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().

◆ pressure_diff_ev

abi_event pressure_diff_ev
static

Definition at line 201 of file ins_mekf_wind_wrapper.c.

Referenced by ins_mekf_wind_wrapper_init().