Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
guidance_v.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
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 
27 #ifndef GUIDANCE_V_H
28 #define GUIDANCE_V_H
29 
30 #include "std.h"
31 
34 
35 #define GUIDANCE_V_MODE_KILL 0
36 #define GUIDANCE_V_MODE_RC_DIRECT 1
37 #define GUIDANCE_V_MODE_RC_CLIMB 2
38 #define GUIDANCE_V_MODE_CLIMB 3
39 #define GUIDANCE_V_MODE_HOVER 4
40 #define GUIDANCE_V_MODE_NAV 5
41 #define GUIDANCE_V_MODE_MODULE 6
42 #define GUIDANCE_V_MODE_FLIP 7
43 #define GUIDANCE_V_MODE_GUIDED 8
44 
46 
52 
58 
64 
70 
76 
80 
85 
91 
96 extern float guidance_v_nominal_throttle;
97 
101 
103 
104 extern int32_t guidance_v_kp;
105 extern int32_t guidance_v_kd;
106 extern int32_t guidance_v_ki;
107 
108 extern void guidance_v_init(void);
109 extern void guidance_v_read_rc(void);
110 extern void guidance_v_mode_changed(uint8_t new_mode);
111 extern void guidance_v_thrust_adapt(bool in_flight);
112 extern void guidance_v_notify_in_flight(bool in_flight);
113 extern void guidance_v_run(bool in_flight);
114 extern void guidance_v_z_enter(void);
115 
118 extern void guidance_v_set_ref(int32_t pos, int32_t speed, int32_t accel);
119 // macro for backward compatibility
120 #define GuidanceVSetRef guidance_v_set_ref
121 
122 extern void run_hover_loop(bool in_flight);
123 
126 extern void guidance_v_from_nav(bool in_flight);
127 
130 extern void guidance_v_guided_enter(void);
131 
134 extern void guidance_v_guided_run(bool in_flight);
135 
140 extern bool guidance_v_set_guided_z(float z);
141 
146 extern bool guidance_v_set_guided_vz(float vz);
147 
148 extern bool guidance_v_set_guided_th(float th);
149 
150 #define guidance_v_SetKi(_val) { \
151  guidance_v_ki = _val; \
152  guidance_v_z_sum_err = 0; \
153  }
154 
155 #endif /* GUIDANCE_V_H */
guidance_v_set_guided_th
bool guidance_v_set_guided_th(float th)
Definition: guidance_v.c:582
guidance_v_thrust_coeff
int32_t guidance_v_thrust_coeff
Definition: guidance_v.c:142
guidance_v_fb_cmd
int32_t guidance_v_fb_cmd
feed-back command
Definition: guidance_v.c:105
guidance_v_adapt.h
guidance_v_read_rc
void guidance_v_read_rc(void)
Definition: guidance_v.c:209
guidance_v_kd
int32_t guidance_v_kd
vertical control D-gain
Definition: guidance_v.c:137
guidance_v_ref.h
guidance_v_set_guided_z
bool guidance_v_set_guided_z(float z)
Set z setpoint in GUIDED mode.
Definition: guidance_v.c:551
guidance_v_rc_delta_t
int32_t guidance_v_rc_delta_t
Direct throttle from radio control.
Definition: guidance_v.c:121
guidance_v_z_enter
void guidance_v_z_enter(void)
Definition: guidance_v.c:359
run_hover_loop
void run_hover_loop(bool in_flight)
Definition: guidance_v.c:412
guidance_v_z_sp
int32_t guidance_v_z_sp
altitude setpoint in meters (input).
Definition: guidance_v.c:129
guidance_v_mode_changed
void guidance_v_mode_changed(uint8_t new_mode)
Definition: guidance_v.c:231
guidance_v_zdd_ref
int32_t guidance_v_zdd_ref
vertical acceleration reference in meter/s^2.
Definition: guidance_v.c:134
guidance_v_guided_run
void guidance_v_guided_run(bool in_flight)
Run GUIDED mode control.
Definition: guidance_v.c:519
guidance_v_set_ref
void guidance_v_set_ref(int32_t pos, int32_t speed, int32_t accel)
Set guidance ref parameters.
Definition: guidance_v.c:372
guidance_v_z_sum_err
int32_t guidance_v_z_sum_err
accumulator for I-gain
Definition: guidance_v.c:140
guidance_v_adapt_throttle_enabled
bool guidance_v_adapt_throttle_enabled
Use adaptive throttle command estimation.
Definition: guidance_v.c:109
std.h
guidance_v_init
void guidance_v_init(void)
Definition: guidance_v.c:178
guidance_v_run
void guidance_v_run(bool in_flight)
Definition: guidance_v.c:299
guidance_v_nominal_throttle
float guidance_v_nominal_throttle
nominal throttle for hover.
Definition: guidance_v.c:108
uint8_t
unsigned char uint8_t
Definition: types.h:14
guidance_v_mode
uint8_t guidance_v_mode
Definition: guidance_v.c:103
guidance_v_zd_ref
int32_t guidance_v_zd_ref
vertical speed reference in meter/s.
Definition: guidance_v.c:133
guidance_v_ki
int32_t guidance_v_ki
vertical control I-gain
Definition: guidance_v.c:138
guidance_v_zd_sp
int32_t guidance_v_zd_sp
vertical speed setpoint in meter/s (input).
Definition: guidance_v.c:130
guidance_v_guided_enter
void guidance_v_guided_enter(void)
Enter GUIDED mode control.
Definition: guidance_v.c:505
int32_t
signed long int32_t
Definition: types.h:19
guidance_v_ff_cmd
int32_t guidance_v_ff_cmd
feed-forward command
Definition: guidance_v.c:104
guidance_v_delta_t
int32_t guidance_v_delta_t
thrust command.
Definition: guidance_v.c:106
guidance_v_z_ref
int32_t guidance_v_z_ref
altitude reference in meters.
Definition: guidance_v.c:132
guidance_v_from_nav
void guidance_v_from_nav(bool in_flight)
Set guidance setpoint from NAV and run hover loop.
Definition: guidance_v.c:473
guidance_v_thrust_adapt
void guidance_v_thrust_adapt(bool in_flight)
Definition: guidance_v.c:278
guidance_v_kp
int32_t guidance_v_kp
vertical control P-gain
Definition: guidance_v.c:136
guidance_v_set_guided_vz
bool guidance_v_set_guided_vz(float vz)
Set z velocity setpoint in GUIDED mode.
Definition: guidance_v.c:568
guidance_v_notify_in_flight
void guidance_v_notify_in_flight(bool in_flight)
Definition: guidance_v.c:271