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
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
35 #ifndef OPTICAL_FLOW_LANDING_H_
36 #define OPTICAL_FLOW_LANDING_H_
37 
38 // number of time steps used for calculating the covariance (oscillations)
39 #define COV_WINDOW_SIZE 60
40 
41 #include "std.h"
42 
43 
45  float agl;
46  float agl_lp;
47  float lp_factor;
48  float vel;
50  float pgain;
51  float igain;
52  float dgain;
53  float sum_err;
57  float cov_set_point;
58  float cov_limit;
62  int COV_METHOD;
64 };
65 
67 
68 // arrays containing histories for determining covariance
72 unsigned long ind_hist;
73 
74 // Without optitrack set to: GUIDANCE_H_MODE_ATTITUDE
75 // With optitrack set to: GUIDANCE_H_MODE_HOVER
76 #define GUIDANCE_H_MODE_MODULE_SETTING GUIDANCE_H_MODE_HOVER
77 
78 // Own guidance_v
79 #define GUIDANCE_V_MODE_MODULE_SETTING GUIDANCE_V_MODE_MODULE
80 
81 // supporting functions for cov calculation:
82 float get_cov(float *a, float *b, int n_elements);
83 float get_mean_array(float *a, int n_elements);
84 void reset_all_vars(void);
85 
86 // Implement own Vertical loops
87 extern void guidance_v_module_init(void);
88 extern void guidance_v_module_enter(void);
89 extern void guidance_v_module_run(bool in_flight);
90 
91 #endif /* OPTICAL_FLOW_LANDING_H_ */
void guidance_v_module_init(void)
unsigned long ind_hist
float igain
I-gain for constant divergence control.
float thrust_history[COV_WINDOW_SIZE]
float dgain
D-gain for constant divergence control.
struct OpticalFlowLanding of_landing_ctrl
float lp_factor
low-pass factor in [0,1], with 0 purely using the current measurement
float agl
agl = height from sonar (only used when using "fake" divergence)
float igain_adaptive
I-gain for adaptive gain control.
float pgain_adaptive
P-gain for adaptive gain control.
float vel
vertical velocity as determined with sonar (only used when using "fake" divergence) ...
float divergence_history[COV_WINDOW_SIZE]
float divergence_setpoint
setpoint for constant divergence approach
void guidance_v_module_enter(void)
Entering the module (user switched to module)
float get_mean_array(float *a, int n_elements)
Get the mean value of an array.
int delay_steps
number of delay steps for div past
int COV_METHOD
method to calculate the covariance: between thrust and div (0) or div and div past (1) ...
void guidance_v_module_run(bool in_flight)
int CONTROL_METHOD
type of divergence control: 0 = fixed gain, 1 = adaptive gain
float past_divergence_history[COV_WINDOW_SIZE]
int VISION_METHOD
whether to use vision (1) or Optitrack / sonar (0)
float agl_lp
low-pass version of agl
float get_cov(float *a, float *b, int n_elements)
Get the covariance of two arrays.
float cov_limit
for fixed gain control, what is the cov limit triggering the landing
float cov_set_point
for adaptive gain control, setpoint of the covariance (oscillations)
float pgain
P-gain for constant divergence control (from divergence error to thrust)
#define COV_WINDOW_SIZE
float sum_err
integration of the error for I-gain
float dgain_adaptive
D-gain for adaptive gain control.
void reset_all_vars(void)
Reset all variables:
float nominal_thrust
nominal thrust around which the PID-control operates