Paparazzi UAS  v5.15_devel-81-gd13dafb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
guidance_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2014 The Paparazzi Team
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_COMMON_H
29 #define FW_V_CTL_COMMON_H
30 
31 
32 #include <inttypes.h>
33 #include "paparazzi.h"
34 
35 /* Vertical mode */
36 #define V_CTL_MODE_MANUAL 0
37 #define V_CTL_MODE_AUTO_THROTTLE 1
38 #define V_CTL_MODE_AUTO_CLIMB 2
39 #define V_CTL_MODE_AUTO_ALT 3
40 #define V_CTL_MODE_LANDING 4
41 #define V_CTL_MODE_NB 5
42 extern uint8_t v_ctl_mode;
43 
44 /* Inner loop */
45 extern float v_ctl_climb_setpoint;
47 #define V_CTL_CLIMB_MODE_AUTO_THROTTLE 0
48 #define V_CTL_CLIMB_MODE_AUTO_PITCH 1
49 
51 #define V_CTL_AUTO_THROTTLE_STANDARD 0
52 #define V_CTL_AUTO_THROTTLE_AGRESSIVE 1
53 #define V_CTL_AUTO_THROTTLE_BLENDED 2
54 
55 // Needed for telemetry
56 extern float v_ctl_auto_throttle_sum_err;
57 
58 // Needed for course loop gain
59 extern float v_ctl_altitude_error;
60 
61 // Old airspeed code wants:
64 
68 extern float v_ctl_pitch_setpoint;
69 
70 extern void v_ctl_init(void);
71 extern void v_ctl_altitude_loop(void);
72 extern void v_ctl_climb_loop(void);
73 extern void v_ctl_landing_loop(void);
74 
78 extern void v_ctl_guidance_loop(void);
79 
81 extern void v_ctl_throttle_slew(void);
82 
83 #define guidance_v_SetCruiseThrottle(_v) { \
84  v_ctl_auto_throttle_cruise_throttle = (_v ? _v : v_ctl_auto_throttle_nominal_cruise_throttle); \
85  Bound(v_ctl_auto_throttle_cruise_throttle, v_ctl_auto_throttle_min_cruise_throttle, v_ctl_auto_throttle_max_cruise_throttle); \
86  }
87 
88 #define guidance_v_SetAutoThrottleIgain(_v) { \
89  v_ctl_auto_throttle_igain = _v; \
90  v_ctl_auto_throttle_sum_err = 0; \
91  }
92 
93 
94 
95 #endif
96 
pprz_t v_ctl_throttle_slewed
Definition: energy_ctrl.c:132
float v_ctl_auto_airspeed_controlled
Definition: energy_ctrl.c:123
int16_t pprz_t
Definition: paparazzi.h:6
void v_ctl_throttle_slew(void)
Computes throttle_slewed from throttle_setpoint.
Definition: energy_ctrl.c:452
void v_ctl_guidance_loop(void)
General guidance logic This will call the proper control loops according to the sub-modes.
Definition: guidance_v.c:265
float v_ctl_auto_throttle_sum_err
Definition: energy_ctrl.c:77
float v_ctl_pitch_setpoint
Definition: energy_ctrl.c:133
float v_ctl_altitude_error
in meters, (setpoint - alt) -> positive = too low
Definition: energy_ctrl.c:92
pprz_t v_ctl_throttle_setpoint
Definition: energy_ctrl.c:131
uint8_t v_ctl_mode
Definition: energy_ctrl.c:74
void v_ctl_init(void)
Definition: energy_ctrl.c:217
void v_ctl_landing_loop(void)
Definition: guidance_v.c:357
unsigned char uint8_t
Definition: types.h:14
float v_ctl_climb_setpoint
Definition: energy_ctrl.c:98
void v_ctl_altitude_loop(void)
outer loop
Definition: energy_ctrl.c:298
uint8_t v_ctl_climb_mode
Definition: energy_ctrl.c:75
float v_ctl_auto_throttle_cruise_throttle
Definition: energy_ctrl.c:103
void v_ctl_climb_loop(void)
Auto-throttle inner loop.
Definition: energy_ctrl.c:336
uint8_t v_ctl_auto_throttle_submode
Definition: energy_ctrl.c:76
float v_ctl_auto_groundspeed_setpoint
in meters per second
Definition: energy_ctrl.c:125