Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
optical_flow_landing.h File Reference

This module implements optical flow landings in which the divergence is kept constant. More...

#include "std.h"
+ Include dependency graph for optical_flow_landing.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  OpticalFlowLanding
 

Macros

#define COV_WINDOW_SIZE   60
 
#define GUIDANCE_H_MODE_MODULE_SETTING   GUIDANCE_H_MODE_HOVER
 
#define GUIDANCE_V_MODE_MODULE_SETTING   GUIDANCE_V_MODE_MODULE
 

Functions

float get_cov (float *a, float *b, int n_elements)
 Get the covariance of two arrays. More...
 
float get_mean_array (float *a, int n_elements)
 Get the mean value of an array. More...
 
void reset_all_vars (void)
 Reset all variables: More...
 
void guidance_v_module_init (void)
 
void guidance_v_module_enter (void)
 Entering the module (user switched to module) More...
 
void guidance_v_module_run (bool in_flight)
 

Variables

struct OpticalFlowLanding of_landing_ctrl
 
float thrust_history [COV_WINDOW_SIZE]
 
float divergence_history [COV_WINDOW_SIZE]
 
float past_divergence_history [COV_WINDOW_SIZE]
 
unsigned long ind_hist
 

Detailed Description

This module implements optical flow landings in which the divergence is kept constant.

When using a fixed gain for control, the covariance between thrust and divergence is tracked, so that the drone knows when it has arrived close to the landing surface. Then, a final landing procedure is triggered. It can also be set to adaptive gain control, where the goal is to continuously gauge the distance to the landing surface. In this mode, the drone will oscillate all the way down to the surface.

de Croon, G.C.H.E. (2016). Monocular distance estimation with optical flow maneuvers and efference copies: a stability-based strategy. Bioinspiration & biomimetics, 11(1), 016004. http://iopscience.iop.org/article/10.1088/1748-3190/11/1/016004

Definition in file optical_flow_landing.h.


Data Structure Documentation

struct OpticalFlowLanding

Definition at line 44 of file optical_flow_landing.h.

Data Fields
float agl agl = height from sonar (only used when using "fake" divergence)
float agl_lp low-pass version of agl
int CONTROL_METHOD type of divergence control: 0 = fixed gain, 1 = adaptive gain
float cov_limit for fixed gain control, what is the cov limit triggering the landing
int COV_METHOD method to calculate the covariance: between thrust and div (0) or div and div past (1)
float cov_set_point for adaptive gain control, setpoint of the covariance (oscillations)
int delay_steps number of delay steps for div past
float dgain D-gain for constant divergence control.
float dgain_adaptive D-gain for adaptive gain control.
float divergence_setpoint setpoint for constant divergence approach
float igain I-gain for constant divergence control.
float igain_adaptive I-gain for adaptive gain control.
float lp_factor low-pass factor in [0,1], with 0 purely using the current measurement
float nominal_thrust nominal thrust around which the PID-control operates
float pgain P-gain for constant divergence control (from divergence error to thrust)
float pgain_adaptive P-gain for adaptive gain control.
float sum_err integration of the error for I-gain
float vel vertical velocity as determined with sonar (only used when using "fake" divergence)
int VISION_METHOD whether to use vision (1) or Optitrack / sonar (0)

Macro Definition Documentation

#define COV_WINDOW_SIZE   60
#define GUIDANCE_H_MODE_MODULE_SETTING   GUIDANCE_H_MODE_HOVER

Definition at line 76 of file optical_flow_landing.h.

#define GUIDANCE_V_MODE_MODULE_SETTING   GUIDANCE_V_MODE_MODULE

Definition at line 79 of file optical_flow_landing.h.

Function Documentation

float get_cov ( float *  a,
float *  b,
int  n_elements 
)

Get the covariance of two arrays.

Parameters
[out]covThe covariance
[in]*aThe first array
[in]*bThe second array
[in]nNumber of elements in the arrays

Definition at line 459 of file optical_flow_landing.c.

References get_mean_array().

Referenced by vertical_ctrl_module_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float get_mean_array ( float *  a,
int  n_elements 
)

Get the mean value of an array.

Parameters
[out]meanThe mean value
[in]*aThe array
[in]nNumber of elements in the array

Definition at line 440 of file optical_flow_landing.c.

Referenced by get_cov().

+ Here is the caller graph for this function:

void guidance_v_module_enter ( void  )

Entering the module (user switched to module)

Definition at line 111 of file ctrl_module_demo.c.

void guidance_v_module_init ( void  )

Definition at line 105 of file ctrl_module_demo.c.

void guidance_v_module_run ( bool  in_flight)

Definition at line 526 of file optical_flow_landing.c.

Variable Documentation

unsigned long ind_hist
float past_divergence_history[COV_WINDOW_SIZE]

Definition at line 71 of file optical_flow_landing.h.

Referenced by vertical_ctrl_module_run().