30 #include "generated/airframe.h"
32 #include "generated/modules.h"
36 #if PERIODIC_TELEMETRY
40 #define WE_QUAD_STATUS_IDLE 0
41 #define WE_QUAD_STATUS_RUN 1
43 #define WE_QUAD_STATE_SIZE 4
44 #define WE_QUAD_CMD_SIZE 2
45 #define WE_QUAD_MEAS_SIZE 2
47 #define WE_QUAD_VA_X 0
49 #define WE_QUAD_VA_Y 2
53 #define WE_QUAD_P0_VA 1.f
57 #define WE_QUAD_P0_W 1.f
61 #define WE_QUAD_Q_VA .05f
65 #define WE_QUAD_Q_W .001f
73 #ifndef WE_QUAD_UPDATE_STATE
74 #define WE_QUAD_UPDATE_STATE TRUE
77 static const float we_dt = WIND_ESTIMATION_QUADROTOR_PERIODIC_PERIOD;
79 static void send_wind(
struct transport_tx *trans,
struct link_device *
dev);
127 #if PERIODIC_TELEMETRY
140 struct FloatVect3 Tbody = { 0.f, 0.f, -Tnorm };
160 #if WE_QUAD_UPDATE_STATE
172 #if WE_QUAD_UPDATE_STATE
173 struct FloatVect2 zero_wind_ne = { 0.f, 0.f };
213 static void send_wind(
struct transport_tx *trans,
struct link_device *
dev)
219 pprz_msg_send_WIND_INFO_RET(trans,
dev, AC_ID,
Main include for ABI (AirBorneInterface).
#define AIRSPEED_WE_QUAD_ID
float eas_from_tas(float tas)
Calculate equivalent airspeed from true airspeed.
Common code for AP and FBW telemetry.
static void float_vect_zero(float *a, const int n)
a = 0
static float float_vect2_norm(struct FloatVect2 *v)
void float_rmat_transp_vmult(struct FloatVect3 *vb, struct FloatRMat *m_b2a, struct FloatVect3 *va)
rotate 3D vector by transposed rotation matrix.
#define MAT33_ELMT(_m, _row, _col)
#define PPRZ_ISA_GRAVITY
earth-surface gravitational acceleration in m/s^2
static struct FloatRMat * stateGetNedToBodyRMat_f(void)
Get vehicle body attitude rotation matrix (float).
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
static void stateSetHorizontalWindspeed_f(struct FloatVect2 *h_windspeed)
Set horizontal windspeed (float).
bool linear_kalman_filter_init(struct linear_kalman_filter *filter, uint8_t n, uint8_t c, uint8_t m)
Init all matrix and vectors to zero.
void linear_kalman_filter_predict(struct linear_kalman_filter *filter, float *U)
Prediction step.
void linear_kalman_filter_update(struct linear_kalman_filter *filter, float *Y)
Update step.
float C[KF_MAX_MEAS_SIZE][KF_MAX_STATE_SIZE]
observation matrix
float R[KF_MAX_MEAS_SIZE][KF_MAX_MEAS_SIZE]
measurement covariance noise
float X[KF_MAX_STATE_SIZE]
estimated state X
float P[KF_MAX_STATE_SIZE][KF_MAX_STATE_SIZE]
state covariance matrix
float A[KF_MAX_STATE_SIZE][KF_MAX_STATE_SIZE]
dynamic matrix
float B[KF_MAX_STATE_SIZE][KF_MAX_CMD_SIZE]
command matrix
float Q[KF_MAX_STATE_SIZE][KF_MAX_STATE_SIZE]
proces covariance noise
Paparazzi atmospheric pressure conversion utilities.
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
float wind_estimation_quadrotor_SetQva(float Q_va)
#define WE_QUAD_STATE_SIZE
void wind_estimation_quadrotor_start(void)
void wind_estimation_quadrotor_stop(void)
void wind_estimation_quadrotor_periodic(void)
float wind_estimation_quadrotor_SetQw(float Q_w)
float wind_estimation_quadrotor_SetR(float R)
static void send_wind(struct transport_tx *trans, struct link_device *dev)
static struct wind_estimation_quadrotor we_quad
static void wind_estimation_quadrotor_reset(void)
#define WE_QUAD_STATUS_RUN
void wind_estimation_quadrotor_report(void)
void wind_estimation_quadrotor_init(void)
#define WE_QUAD_STATUS_IDLE
struct linear_kalman_filter filter
#define WE_QUAD_MEAS_SIZE
struct wind_estimation_quadrotor_params we_quad_params
float Q_va
model noise on airspeed
float Q_w
model noise on wind
float R
measurement noise (ground speed)