33#include "pprzlink/messages.h"
37#ifndef GROUND_DETECT_NUM_TRIGGERS
38#define GROUND_DETECT_NUM_TRIGGERS 3
41#if GROUND_DETECT_USE_INDI_THRUST
46#if GROUND_DETECT_USE_AGL_DIST
48#ifndef GROUND_DETECT_AGL_MIN_VALUE
49#define GROUND_DETECT_AGL_MIN_VALUE 0.1
54#ifndef GROUND_DETECT_USE_FORCE_SENSOR
55#define GROUND_DETECT_USE_FORCE_SENSOR 0
58#ifndef GROUND_DETECT_FORCE_SENSOR_THRESHOLD
59#define GROUND_DETECT_FORCE_SENSOR_THRESHOLD 100000
62#ifndef GROUND_DETECT_FORCE_SENSOR_MEDIAN_FILT_SIZE
63#define GROUND_DETECT_FORCE_SENSOR_MEDIAN_FILT_SIZE 3
66#ifndef FORCE_SENSOR_MAX_NB
67#define FORCE_SENSOR_MAX_NB 16
70#if GROUND_DETECT_USE_FORCE_SENSOR
71#ifndef GROUND_DETECT_FORCE_SENSOR_ID
72#define GROUND_DETECT_FORCE_SENSOR_ID ABI_BROADCAST
77#ifndef GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED
78#define GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED false
82#if GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED
83#ifndef GROUND_DETECT_REVERSE_THRUST_LEVEL
84#error "GROUND_DETECT_REVERSE_THRUST_LEVEL needs to be defined if GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED is true"
91#ifndef GROUND_DETECT_SPECIFIC_THRUST_THRESHOLD
92#define GROUND_DETECT_SPECIFIC_THRUST_THRESHOLD -5.0
96#ifndef GROUND_DETECT_VERTICAL_SPEED_THRESHOLD
97#define GROUND_DETECT_VERTICAL_SPEED_THRESHOLD 0.1
101#ifndef GROUND_DETECT_VERTICAL_ACCEL_THRESHOLD
102#define GROUND_DETECT_VERTICAL_ACCEL_THRESHOLD -3.0
106#ifndef GROUND_DETECT_COUNTER_TRIGGER
107#define GROUND_DETECT_COUNTER_TRIGGER 5
111#ifndef GROUND_DETECT_FILT_FREQ
112#define GROUND_DETECT_FILT_FREQ 5.0
135#if GROUND_DETECT_USE_FORCE_SENSOR
160 for (
uint8_t i = 0; i < n; i++) {
180#if PERIODIC_TELEMETRY
216#if GROUND_DETECT_USE_FORCE_SENSOR
225#if PERIODIC_TELEMETRY
248#if GROUND_DETECT_USE_INDI_THRUST
267#if GROUND_DETECT_USE_FORCE_SENSOR
275#if GROUND_DETECT_USE_INDI_THRUST
283#if GROUND_DETECT_USE_AGL_DIST
342#if GROUND_DETECT_USE_FORCE_SENSOR
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
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.
static struct uart_periph * dev
#define GROUND_DETECT_VERTICAL_SPEED_THRESHOLD
void ground_detect_filter_accel(void)
Filter the vertical acceleration with a low cutoff frequency.
#define GROUND_DETECT_FORCE_SENSOR_THRESHOLD
int32_t values_filt[FORCE_SENSOR_MAX_NB]
#define GROUND_DETECT_FORCE_SENSOR_MEDIAN_FILT_SIZE
uint16_t reverse_th_level
void ground_detect_stop_reverse_thrust(void)
bool disarm_on_not_in_flight
bool ground_detect_reverse_thrust(void)
#define GROUND_DETECT_FILT_FREQ
#define GROUND_DETECT_COUNTER_TRIGGER
void ground_detect_init()
struct ground_detect_values_t ground_detect_values
int32_t offsets[FORCE_SENSOR_MAX_NB]
void ground_detect_start_reverse_thrust(void)
float force_sensor_ground_threshold
#define FORCE_SENSOR_MAX_NB
static struct force_sensor_data_t force_sensor
static void send_ground_detect(struct transport_tx *trans, struct link_device *dev)
#define GROUND_DETECT_USE_FORCE_SENSOR
#define GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED
union ground_detect_bitmask_t ground_detect_status
#define GROUND_DETECT_VERTICAL_ACCEL_THRESHOLD
#define GROUND_DETECT_SPECIFIC_THRUST_THRESHOLD
#define GROUND_DETECT_NUM_TRIGGERS
void ground_detect_periodic()
void ground_detect_set_offset_sensors(bool set_offset)
float agl_dist_value_filtered
Butterworth2LowPass accel_down_filt
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).
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, const float tau, const float sample_time, const float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, const float value)
Update second order Butterworth low pass filter state with a new value.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
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.
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_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 short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.