Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
ground_detect.c File Reference

Ground detection module. More...

#include "ground_detect.h"
#include "filters/median_filter.h"
#include "firmwares/rotorcraft/autopilot_firmware.h"
#include "modules/core/abi.h"
#include "state.h"
#include "pprzlink/messages.h"
#include "modules/datalink/downlink.h"
#include "modules/datalink/telemetry.h"
+ Include dependency graph for ground_detect.c:

Go to the source code of this file.

Data Structures

struct  force_sensor_data_t
 

Macros

#define GROUND_DETECT_NUM_TRIGGERS   3
 
#define GROUND_DETECT_USE_FORCE_SENSOR   0
 
#define GROUND_DETECT_FORCE_SENSOR_THRESHOLD   100000
 
#define GROUND_DETECT_FORCE_SENSOR_MEDIAN_FILT_SIZE   3
 
#define FORCE_SENSOR_MAX_NB   16
 
#define GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED   false
 
#define GROUND_DETECT_SPECIFIC_THRUST_THRESHOLD   -5.0
 
#define GROUND_DETECT_VERTICAL_SPEED_THRESHOLD   0.1
 
#define GROUND_DETECT_VERTICAL_ACCEL_THRESHOLD   -3.0
 
#define GROUND_DETECT_COUNTER_TRIGGER   5
 
#define GROUND_DETECT_FILT_FREQ   5.0
 

Functions

static void send_ground_detect (struct transport_tx *trans, struct link_device *dev)
 
void ground_detect_init ()
 
bool ground_detect (void)
 
void ground_detect_periodic ()
 
void ground_detect_filter_accel (void)
 Filter the vertical acceleration with a low cutoff frequency.
 
bool ground_detect_reverse_thrust (void)
 
void ground_detect_stop_reverse_thrust (void)
 
void ground_detect_start_reverse_thrust (void)
 
void ground_detect_set_offset_sensors (bool set_offset)
 

Variables

uint16_t reverse_th_level = 0
 
bool disarm_on_not_in_flight = false
 
int32_t counter = 0
 
bool ground_detected = false
 
bool reverse_thrust = false
 
union ground_detect_bitmask_t ground_detect_status
 
struct ground_detect_values_t ground_detect_values
 
float force_sensor_ground_threshold = GROUND_DETECT_FORCE_SENSOR_THRESHOLD
 
static struct force_sensor_data_t force_sensor = {0}
 

Detailed Description

Ground detection module.

Definition in file ground_detect.c.


Data Structure Documentation

◆ force_sensor_data_t

struct force_sensor_data_t

Definition at line 127 of file ground_detect.c.

Data Fields
uint8_t count
int32_t offsets[FORCE_SENSOR_MAX_NB]
int32_t values_filt[FORCE_SENSOR_MAX_NB]

Macro Definition Documentation

◆ FORCE_SENSOR_MAX_NB

#define FORCE_SENSOR_MAX_NB   16

Definition at line 67 of file ground_detect.c.

◆ GROUND_DETECT_COUNTER_TRIGGER

#define GROUND_DETECT_COUNTER_TRIGGER   5

Definition at line 107 of file ground_detect.c.

◆ GROUND_DETECT_FILT_FREQ

#define GROUND_DETECT_FILT_FREQ   5.0

Definition at line 112 of file ground_detect.c.

◆ GROUND_DETECT_FORCE_SENSOR_MEDIAN_FILT_SIZE

#define GROUND_DETECT_FORCE_SENSOR_MEDIAN_FILT_SIZE   3

Definition at line 63 of file ground_detect.c.

◆ GROUND_DETECT_FORCE_SENSOR_THRESHOLD

#define GROUND_DETECT_FORCE_SENSOR_THRESHOLD   100000

Definition at line 59 of file ground_detect.c.

◆ GROUND_DETECT_NUM_TRIGGERS

#define GROUND_DETECT_NUM_TRIGGERS   3

Definition at line 38 of file ground_detect.c.

◆ GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED

#define GROUND_DETECT_REVERSE_THRUST_ON_GROUND_DETECTED   false

Definition at line 78 of file ground_detect.c.

◆ GROUND_DETECT_SPECIFIC_THRUST_THRESHOLD

#define GROUND_DETECT_SPECIFIC_THRUST_THRESHOLD   -5.0

Definition at line 92 of file ground_detect.c.

◆ GROUND_DETECT_USE_FORCE_SENSOR

#define GROUND_DETECT_USE_FORCE_SENSOR   0

Definition at line 55 of file ground_detect.c.

◆ GROUND_DETECT_VERTICAL_ACCEL_THRESHOLD

#define GROUND_DETECT_VERTICAL_ACCEL_THRESHOLD   -3.0

Definition at line 102 of file ground_detect.c.

◆ GROUND_DETECT_VERTICAL_SPEED_THRESHOLD

#define GROUND_DETECT_VERTICAL_SPEED_THRESHOLD   0.1

Definition at line 97 of file ground_detect.c.

Function Documentation

◆ ground_detect()

bool ground_detect ( void  )

Definition at line 230 of file ground_detect.c.

References ground_detected.

◆ ground_detect_filter_accel()

void ground_detect_filter_accel ( void  )

Filter the vertical acceleration with a low cutoff frequency.

Definition at line 313 of file ground_detect.c.

References ground_detect_values_t::accel_down_filt, ground_detect_values, stateGetAccelNed_f(), update_butterworth_2_low_pass(), and NedCoor_f::z.

+ Here is the call graph for this function:

◆ ground_detect_init()

◆ ground_detect_periodic()

◆ ground_detect_reverse_thrust()

bool ground_detect_reverse_thrust ( void  )

◆ ground_detect_set_offset_sensors()

void ground_detect_set_offset_sensors ( bool  set_offset)

Definition at line 339 of file ground_detect.c.

References foo.

◆ ground_detect_start_reverse_thrust()

void ground_detect_start_reverse_thrust ( void  )

Definition at line 334 of file ground_detect.c.

References reverse_thrust.

◆ ground_detect_stop_reverse_thrust()

void ground_detect_stop_reverse_thrust ( void  )

Definition at line 329 of file ground_detect.c.

References reverse_thrust.

◆ send_ground_detect()

Variable Documentation

◆ counter

int32_t counter = 0

Definition at line 117 of file ground_detect.c.

Referenced by ground_detect_periodic().

◆ disarm_on_not_in_flight

bool disarm_on_not_in_flight = false

Definition at line 115 of file ground_detect.c.

Referenced by ground_detect_periodic().

◆ force_sensor

struct force_sensor_data_t force_sensor = {0}
static

Definition at line 133 of file ground_detect.c.

Referenced by ground_detect_init(), and send_ground_detect().

◆ force_sensor_ground_threshold

float force_sensor_ground_threshold = GROUND_DETECT_FORCE_SENSOR_THRESHOLD

Definition at line 125 of file ground_detect.c.

◆ ground_detect_status

union ground_detect_bitmask_t ground_detect_status

Definition at line 122 of file ground_detect.c.

Referenced by ground_detect_init(), ground_detect_periodic(), and send_ground_detect().

◆ ground_detect_values

◆ ground_detected

bool ground_detected = false

Definition at line 118 of file ground_detect.c.

Referenced by ground_detect(), ground_detect_periodic(), and send_ground_detect().

◆ reverse_th_level

uint16_t reverse_th_level = 0

Definition at line 88 of file ground_detect.c.

◆ reverse_thrust