32 #if USE_GROUND_DETECT_INDI_THRUST
36 #if USE_GROUND_DETECT_AGL_DIST
38 #ifndef GROUND_DETECT_AGL_MIN_VALUE
39 #define GROUND_DETECT_AGL_MIN_VALUE 0.1
43 #include "pprzlink/messages.h"
46 #define GROUND_DETECT_COUNTER_TRIGGER 5
49 #define GROUND_DETECT_FILT_FREQ 5.0
58 #define DEBUG_GROUND_DETECT TRUE
63 float sample_time = 1.0 / PERIODIC_FREQUENCY;
83 float specific_thrust = 0.0;
85 #if USE_GROUND_DETECT_INDI_THRUST
87 for (i = 0; i < INDI_NUM_ACT; i++) {
93 float spec_thrust_down;
95 spec_thrust_down = ned_to_body_rmat->
m[8] * specific_thrust;
105 if ((fabsf(vspeed_ned) < 5.0)
106 && (spec_thrust_down > -5.0)
108 #
if USE_GROUND_DETECT_AGL_DIST
127 #ifdef DEBUG_GROUND_DETECT
129 payload[0] = vspeed_ned;
130 payload[1] = spec_thrust_down;
133 #if USE_GROUND_DETECT_AGL_DIST
float agl_dist_value_filtered
Bind to agl ABI message and provide a filtered value to be used in flight plans.
bool autopilot_set_motors_on(bool motors_on)
turn motors on/off, eventually depending of the current mode set kill_throttle accordingly FIXME is i...
Common code for AP and FBW telemetry.
Butterworth2LowPass accel_filter
void ground_detect_filter_accel(void)
Filter the vertical acceleration with a low cutoff frequency.
bool disarm_on_not_in_flight
#define GROUND_DETECT_FILT_FREQ
#define GROUND_DETECT_COUNTER_TRIGGER
void ground_detect_init()
void ground_detect_periodic()
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
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).
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.
vector in North East Down coordinates Units: meters
Rotorcraft specific autopilot interface and initialization.
bool act_is_servo[INDI_NUM_ACT]
float g1g2[INDI_OUTPUTS][INDI_NUM_ACT]
float actuator_state_filt_vect[INDI_NUM_ACT]
API to get/set the generic vehicle states.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.