29#include "navigation.h"
32#include "generated/modules.h"
37#ifndef AIRSPEED_CONSISTENCY_MIN_SAMPLES
38#define AIRSPEED_CONSISTENCY_MIN_SAMPLES 20
41#ifndef AIRSPEED_CONSISTENCY_INTERVAL
42#define AIRSPEED_CONSISTENCY_INTERVAL 10
45#if AIRSPEED_CONSISTENCY_BUFFER_SIZE < AIRSPEED_CONSISTENCY_MIN_SAMPLES
46#error "AIRSPEED_CONSISTENCY_BUFFER_SIZE must be larger than or equal to AIRSPEED_CONSISTENCY_MIN_SAMPLES"
49#if AIRSPEED_CONSISTENCY_BUFFER_SIZE > UINT16_MAX
50#error "AIRSPEED_CONSISTENCY_BUFFER_SIZE must be less than or equal to UINT16_MAX"
64 float tau = 1.0 / (2.0 *
M_PI);
86 asc.as_circ_status = get_circle_from_speeds(&asc.as, asc.as_N, asc.as_E);
87 asc.gs_circ_status = get_circle_from_speeds(&asc.gs, asc.gs_N, asc.gs_E);
91 asc.ratio = asc.gs.r / asc.as.r;
92 asc.ratio *= asc.ratio;
94 int rc = snprintf(error_msg, sizeof(error_msg),
"ASC: ratio squared = %.4f", asc.ratio);
95 DOWNLINK_SEND_INFO_MSG(DefaultChannel, DefaultDevice, rc, error_msg);
96#if FLIGHTRECORDER_SDLOG
97 pprz_msg_send_INFO_MSG(&pprzlog_tp.trans_tx, &flightrecorder_sdlog.device, AC_ID, rc, error_msg);
Main include for ABI (AirBorneInterface).
struct AirData air_data
global AirData state
float tas
True Air Speed (TAS) in m/s, -1 if unknown.
#define AIRSPEED_CONSISTENCY_INTERVAL
static void save_speeds(void)
static enum CircFitStatus_t get_circle_from_speeds(struct circle_t *c, float *N, float *E)
#define AIRSPEED_CONSISTENCY_MIN_SAMPLES
void airspeed_consistency_init(void)
static Butterworth2LowPass tas_filt
void airspeed_consistency_reset(bool reset)
void airspeed_consistency_periodic(void)
static void reset_speeds(void)
enum CircFitStatus_t gs_circ_status
float gs_N[AIRSPEED_CONSISTENCY_BUFFER_SIZE]
float gs_E[AIRSPEED_CONSISTENCY_BUFFER_SIZE]
float as_E[AIRSPEED_CONSISTENCY_BUFFER_SIZE]
enum CircFitStatus_t as_circ_status
float as_N[AIRSPEED_CONSISTENCY_BUFFER_SIZE]
#define AIRSPEED_CONSISTENCY_BUFFER_SIZE
if(GpsFixValid() &&e_identification_started)
static float float_vect2_norm(struct FloatVect2 *v)
#define VECT2_DIFF(_c, _a, _b)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Simple first order low pass filter with bilinear transform.
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, float tau, float sample_time, float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, float value)
Update second order Butterworth low pass filter state with a new value.
Second order low pass filter structure.
#define NAVIGATION_FREQUENCY
Default fixedwing navigation frequency.
struct EnuCoor_f center
center WP position
struct NavCircle_t circle
float radius
radius in meters
struct NavBase_t nav_rotorcraft_base
Basic Nav struct.
enum CircFitStatus_t pprz_circfit_wei_float(struct circle_t *c, const float *x, const float *y, uint16_t n, struct circle_t *g)
struct RotorcraftNavigation nav
#define NAV_HORIZONTAL_MODE_CIRCLE
#define ARRIVED_AT_WAYPOINT
minimum horizontal distance to waypoint to mark as arrived
API to get/set the generic vehicle states.
Periodic telemetry system header (includes downlink utility and generated code).
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.