Paparazzi UAS  v5.15_devel-113-g1b57ff1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins_ekf2.cpp File Reference

INS based in the EKF2 of PX4. More...

#include "subsystems/ins/ins_ekf2.h"
#include "subsystems/abi.h"
#include "stabilization/stabilization_attitude.h"
#include "generated/airframe.h"
#include "EKF/ekf.h"
#include "math/pprz_isa.h"
#include "mcu_periph/sys_time.h"
#include "autopilot.h"
#include "subsystems/datalink/telemetry.h"
+ Include dependency graph for ins_ekf2.cpp:

Go to the source code of this file.

Data Structures

struct  ekf2_t
 

Macros

#define INS_EKF2_AGL_ID   ABI_BROADCAST
 For SITL and NPS we need special includes. More...
 
#define INS_SONAR_MIN_RANGE   0.001
 Default AGL sensor minimum range. More...
 
#define INS_SONAR_MAX_RANGE   4.0
 Default AGL sensor maximum range. More...
 
#define INS_EKF2_BARO_ID   ABI_BROADCAST
 default barometer to use in INS More...
 
#define INS_EKF2_GYRO_ID   ABI_BROADCAST
 
#define INS_EKF2_ACCEL_ID   ABI_BROADCAST
 
#define INS_EKF2_MAG_ID   ABI_BROADCAST
 
#define INS_EKF2_GPS_ID   GPS_MULTI_ID
 

Functions

static void agl_cb (uint8_t sender_id, uint32_t stamp, float distance)
 
static void baro_cb (uint8_t sender_id, uint32_t stamp, float pressure)
 
static void gyro_cb (uint8_t sender_id, uint32_t stamp, struct Int32Rates *gyro)
 
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 gps_cb (uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
 
static void body_to_imu_cb (uint8_t sender_id, struct FloatQuat *q_b2i_f)
 
static void ins_ekf2_publish_attitude (uint32_t stamp)
 Publish the attitude and get the new state Directly called after a succeslfull gyro+accel reading. More...
 
static void send_ins_ref (struct transport_tx *trans, struct link_device *dev)
 
static void send_ins_ekf2 (struct transport_tx *trans, struct link_device *dev)
 
static void send_filter_status (struct transport_tx *trans, struct link_device *dev)
 
void ins_ekf2_init (void)
 
void ins_ekf2_update (void)
 

Variables

static abi_event agl_ev
 
static abi_event baro_ev
 
static abi_event gyro_ev
 
static abi_event accel_ev
 
static abi_event mag_ev
 
static abi_event gps_ev
 
static abi_event body_to_imu_ev
 
static Ekf ekf
 EKF class itself. More...
 
static parameters * ekf2_params
 The EKF parameters. More...
 
static struct ekf2_t ekf2
 Local EKF EKF status structure. More...
 
static uint8_t ahrs_ekf2_id = AHRS_COMP_ID_EKF2
 Component ID for EKF. More...
 

Detailed Description

INS based in the EKF2 of PX4.

Definition in file ins_ekf2.cpp.


Data Structure Documentation

struct ekf2_t

Definition at line 120 of file ins_ekf2.cpp.

+ Collaboration diagram for ekf2_t:
Data Fields
FloatVect3 accel
uint32_t accel_dt
uint32_t accel_stamp
bool accel_valid
struct OrientationReps body_to_imu
bool got_imu_data
FloatRates gyro
uint32_t gyro_dt
uint32_t gyro_stamp
bool gyro_valid
struct LtpDef_i ltp_def
uint64_t ltp_stamp
uint8_t quat_reset_counter

Macro Definition Documentation

#define INS_EKF2_ACCEL_ID   ABI_BROADCAST

Definition at line 85 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_EKF2_AGL_ID   ABI_BROADCAST

For SITL and NPS we need special includes.

Prevent setting INS reference from flight plan default AGL sensor to use in INS

Definition at line 51 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_EKF2_BARO_ID   ABI_BROADCAST

default barometer to use in INS

Definition at line 72 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_EKF2_GPS_ID   GPS_MULTI_ID

Definition at line 97 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_EKF2_GYRO_ID   ABI_BROADCAST

Definition at line 79 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_EKF2_MAG_ID   ABI_BROADCAST

Definition at line 91 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_SONAR_MAX_RANGE   4.0

Default AGL sensor maximum range.

Definition at line 63 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

#define INS_SONAR_MIN_RANGE   0.001

Default AGL sensor minimum range.

Definition at line 57 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

Function Documentation

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

Definition at line 439 of file ins_ekf2.cpp.

References ekf2_t::accel, ekf2_t::accel_dt, ekf2_t::accel_stamp, ekf2_t::accel_valid, ACCELS_FLOAT_OF_BFP, ekf2_t::body_to_imu, ekf2, float_rmat_transp_vmult(), ekf2_t::gyro_valid, ins_ekf2_publish_attitude(), and orientationGetRMat_f().

Referenced by ins_ekf2_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void agl_cb ( uint8_t  sender_id,
uint32_t  stamp,
float  distance 
)
static

Definition at line 407 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

+ Here is the caller graph for this function:

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

Definition at line 393 of file ins_ekf2.cpp.

References pprz_isa_density_of_pressure(), and pprz_isa_height_of_pressure_full().

Referenced by ins_ekf2_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 519 of file ins_ekf2.cpp.

References ekf2_t::body_to_imu, ekf2, and orientationSetQuat_f().

Referenced by ins_ekf2_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void gps_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct GpsState gps_s 
)
static
static void gyro_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct Int32Rates gyro 
)
static

Definition at line 413 of file ins_ekf2.cpp.

References ekf2_t::accel_valid, ekf2_t::body_to_imu, ekf2, float_rmat_transp_ratemult(), ekf2_t::gyro, ekf2_t::gyro_dt, ekf2_t::gyro_stamp, ekf2_t::gyro_valid, ins_ekf2_publish_attitude(), orientationGetRMat_f(), and RATES_FLOAT_OF_BFP.

Referenced by ins_ekf2_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 465 of file ins_ekf2.cpp.

References ekf2_t::body_to_imu, ekf2, float_rmat_transp_vmult(), ekf2_t::got_imu_data, MAGS_FLOAT_OF_BFP, orientationGetRMat_f(), FloatVect3::x, FloatVect3::y, and FloatVect3::z.

Referenced by ins_ekf2_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 179 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

+ Here is the caller graph for this function:

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

Definition at line 162 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

+ Here is the caller graph for this function:

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

Definition at line 152 of file ins_ekf2.cpp.

References LlaCoor_i::alt, LtpDef_i::ecef, ekf2, LtpDef_i::hmsl, LlaCoor_i::lat, LtpDef_i::lla, LlaCoor_i::lon, ekf2_t::ltp_def, ekf2_t::ltp_stamp, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.

Referenced by ins_ekf2_init().

+ Here is the caller graph for this function:

Variable Documentation

abi_event accel_ev
static

Definition at line 105 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

abi_event agl_ev
static

Definition at line 102 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

uint8_t ahrs_ekf2_id = AHRS_COMP_ID_EKF2
static

Component ID for EKF.

Definition at line 146 of file ins_ekf2.cpp.

abi_event baro_ev
static

Definition at line 103 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

abi_event body_to_imu_ev
static

Definition at line 108 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

Ekf ekf
static

EKF class itself.

Definition at line 143 of file ins_ekf2.cpp.

struct ekf2_t ekf2
static

Local EKF EKF status structure.

Definition at line 145 of file ins_ekf2.cpp.

Referenced by accel_cb(), body_to_imu_cb(), gyro_cb(), ins_ekf2_init(), ins_ekf2_publish_attitude(), ins_ekf2_update(), mag_cb(), and send_ins_ref().

parameters* ekf2_params
static

The EKF parameters.

Definition at line 144 of file ins_ekf2.cpp.

abi_event gps_ev
static

Definition at line 107 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

abi_event gyro_ev
static

Definition at line 104 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().

abi_event mag_ev
static

Definition at line 106 of file ins_ekf2.cpp.

Referenced by ins_ekf2_init().