Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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_NB 4
41 extern uint8_t v_ctl_mode;
42 
43 /* Inner loop */
44 extern float v_ctl_climb_setpoint;
46 #define V_CTL_CLIMB_MODE_AUTO_THROTTLE 0
47 #define V_CTL_CLIMB_MODE_AUTO_PITCH 1
48 
50 #define V_CTL_AUTO_THROTTLE_STANDARD 0
51 #define V_CTL_AUTO_THROTTLE_AGRESSIVE 1
52 #define V_CTL_AUTO_THROTTLE_BLENDED 2
53 
54 // Needed for telemetry
55 extern float v_ctl_auto_throttle_sum_err;
56 
57 // Needed for course loop gain
58 extern float v_ctl_altitude_error;
59 
60 // Old airspeed code wants:
63 
67 extern float v_ctl_pitch_setpoint;
68 
69 extern void v_ctl_init(void);
70 extern void v_ctl_altitude_loop(void);
71 extern void v_ctl_climb_loop(void);
72 
74 extern void v_ctl_throttle_slew(void);
75 
76 #define guidance_v_SetCruiseThrottle(_v) { \
77  v_ctl_auto_throttle_cruise_throttle = (_v ? _v : v_ctl_auto_throttle_nominal_cruise_throttle); \
78  Bound(v_ctl_auto_throttle_cruise_throttle, v_ctl_auto_throttle_min_cruise_throttle, v_ctl_auto_throttle_max_cruise_throttle); \
79  }
80 
81 #define guidance_v_SetAutoThrottleIgain(_v) { \
82  v_ctl_auto_throttle_igain = _v; \
83  v_ctl_auto_throttle_sum_err = 0; \
84  }
85 
86 
87 
88 #endif
89 
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:450
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:216
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:296
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:334
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