Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
guidance_v.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Pascal Brisset, Antoine Drouin
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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
28 #ifndef FW_V_CTL_H
29 #define FW_V_CTL_H
30 
31 #include <inttypes.h>
32 #include "paparazzi.h"
33 
34 /* Vertical mode */
35 #define V_CTL_MODE_MANUAL 0
36 #define V_CTL_MODE_AUTO_THROTTLE 1
37 #define V_CTL_MODE_AUTO_CLIMB 2
38 #define V_CTL_MODE_AUTO_ALT 3
39 #define V_CTL_MODE_NB 4
40 extern uint8_t v_ctl_mode;
41 
42 /* outer loop */
43 extern float v_ctl_altitude_error;
44 extern float v_ctl_altitude_setpoint;
45 extern float v_ctl_altitude_pre_climb;
46 extern float v_ctl_altitude_pgain;
48 extern float v_ctl_altitude_max_climb;
49 
50 /* inner loop */
51 extern float v_ctl_climb_setpoint;
53 #define V_CTL_CLIMB_MODE_AUTO_THROTTLE 0
54 #define V_CTL_CLIMB_MODE_AUTO_PITCH 1
55 
57 #define V_CTL_AUTO_THROTTLE_STANDARD 0
58 #define V_CTL_AUTO_THROTTLE_AGRESSIVE 1
59 #define V_CTL_AUTO_THROTTLE_BLENDED 2
60 
61 /* "auto throttle" inner loop parameters */
67 extern float v_ctl_auto_throttle_pgain;
68 extern float v_ctl_auto_throttle_igain;
69 extern float v_ctl_auto_throttle_dgain;
70 extern float v_ctl_auto_throttle_sum_err;
73 
74 /* agressive tuning */
75 #ifdef TUNE_AGRESSIVE_CLIMB
76 extern float agr_climb_throttle;
77 extern float agr_climb_pitch;
78 extern float agr_climb_nav_ratio;
79 extern float agr_descent_throttle;
80 extern float agr_descent_pitch;
81 extern float agr_descent_nav_ratio;
82 #endif
83 
84 /* "auto pitch" inner loop parameters */
85 extern float v_ctl_auto_pitch_pgain;
86 extern float v_ctl_auto_pitch_igain;
87 extern float v_ctl_auto_pitch_sum_err;
88 
91 
92 extern void v_ctl_init( void );
93 extern void v_ctl_altitude_loop( void );
94 extern void v_ctl_climb_loop ( void );
95 
96 #if USE_AIRSPEED
97 /* "airspeed" inner loop parameters */
98 extern float v_ctl_auto_airspeed_setpoint;
99 extern float v_ctl_auto_airspeed_controlled;
100 extern float v_ctl_auto_airspeed_pgain;
101 extern float v_ctl_auto_airspeed_igain;
102 extern float v_ctl_auto_airspeed_sum_err;
103 extern float v_ctl_auto_groundspeed_setpoint;
104 extern float v_ctl_auto_groundspeed_pgain;
105 extern float v_ctl_auto_groundspeed_igain;
106 extern float v_ctl_auto_groundspeed_sum_err;
107 #endif
108 
110 extern void v_ctl_throttle_slew( void );
111 
112 #define guidance_v_SetCruiseThrottle(_v) { \
113  v_ctl_auto_throttle_cruise_throttle = (_v ? _v : v_ctl_auto_throttle_nominal_cruise_throttle); \
114  Bound(v_ctl_auto_throttle_cruise_throttle, v_ctl_auto_throttle_min_cruise_throttle, v_ctl_auto_throttle_max_cruise_throttle); \
115 }
116 
117 #define guidance_v_SetAutoThrottleIgain(_v) { \
118  v_ctl_auto_throttle_igain = _v; \
119  v_ctl_auto_throttle_sum_err = 0; \
120  }
121 
122 #endif /* FW_V_CTL_H */
float v_ctl_altitude_setpoint
in meters above MSL
Definition: guidance_v.c:38
pprz_t v_ctl_throttle_slewed
Definition: guidance_v.c:89
void v_ctl_altitude_loop(void)
outer loop
Definition: guidance_v.c:198
float v_ctl_auto_throttle_min_cruise_throttle
Definition: guidance_v.c:57
uint8_t v_ctl_auto_throttle_submode
Definition: guidance_v.c:48
float v_ctl_climb_setpoint
Definition: guidance_v.c:46
uint8_t v_ctl_mode
Definition: guidance_v.c:35
void v_ctl_init(void)
Definition: guidance_v.c:119
float v_ctl_auto_pitch_igain
Definition: guidance_v.c:84
float v_ctl_auto_pitch_sum_err
Definition: guidance_v.c:85
int16_t pprz_t
Definition: paparazzi.h:6
float v_ctl_altitude_pre_climb
Definition: guidance_v.c:39
float v_ctl_auto_throttle_dgain
Definition: guidance_v.c:62
void v_ctl_climb_loop(void)
Definition: guidance_v.c:231
float v_ctl_auto_throttle_sum_err
Definition: guidance_v.c:63
void v_ctl_throttle_slew(void)
Computes throttle_slewed from throttle_setpoint.
Definition: guidance_v.c:390
float v_ctl_auto_pitch_pgain
Definition: guidance_v.c:83
float v_ctl_auto_throttle_climb_throttle_increment
Definition: guidance_v.c:59
float v_ctl_auto_throttle_pitch_of_vz_dgain
Definition: guidance_v.c:66
float v_ctl_altitude_pgain
Definition: guidance_v.c:40
float v_ctl_auto_throttle_pitch_of_vz_pgain
Definition: guidance_v.c:65
uint8_t v_ctl_climb_mode
Definition: guidance_v.c:47
float v_ctl_auto_throttle_cruise_throttle
Definition: guidance_v.c:55
unsigned char uint8_t
Definition: types.h:14
float v_ctl_auto_throttle_igain
Definition: guidance_v.c:61
float v_ctl_auto_throttle_pgain
Definition: guidance_v.c:60
float v_ctl_altitude_pre_climb_correction
Definition: guidance_v.c:42
float v_ctl_altitude_max_climb
Definition: guidance_v.c:43
float v_ctl_auto_throttle_nominal_cruise_throttle
Definition: guidance_v.c:56
float v_ctl_auto_throttle_max_cruise_throttle
Definition: guidance_v.c:58
float v_ctl_altitude_error
in meters, (setpoint - alt) -> positive = too low
Definition: guidance_v.c:41
pprz_t v_ctl_throttle_setpoint
Definition: guidance_v.c:88