Paparazzi UAS  v7.0_unstable
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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
26 #ifndef GUIDANCE_V_H
27 #define GUIDANCE_V_H
28 
29 #include "std.h"
30 
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_GUIDED 6
42 
45 
51 
57 
63 
69 
75 
80 
86 
91 
96  struct ThrustSetpoint thrust; // FIXME maybe not needed to store the value ?
97 
103 
105 };
106 
107 extern struct VerticalGuidance guidance_v;
108 
109 extern void guidance_v_init(void);
110 extern void guidance_v_mode_changed(uint8_t new_mode);
111 extern void guidance_v_notify_in_flight(bool in_flight);
112 extern void guidance_v_thrust_adapt(bool in_flight);
113 extern void guidance_v_update_ref(void);
114 extern void guidance_v_z_enter(void);
115 extern void guidance_v_run_enter(void);
116 
120 extern struct ThrustSetpoint guidance_v_run(bool in_flight);
121 extern struct ThrustSetpoint guidance_v_run_pos(bool in_flight, struct VerticalGuidance *gv);
122 extern struct ThrustSetpoint guidance_v_run_speed(bool in_flight, struct VerticalGuidance *gv);
123 extern struct ThrustSetpoint guidance_v_run_accel(bool in_flight, struct VerticalGuidance *gv);
124 
127 extern void guidance_v_set_ref(int32_t pos, int32_t speed, int32_t accel);
128 // macro for backward compatibility
129 #define GuidanceVSetRef guidance_v_set_ref
130 
133 extern struct ThrustSetpoint guidance_v_from_nav(bool in_flight);
134 
137 extern void guidance_v_guided_enter(void);
138 
141 extern struct ThrustSetpoint guidance_v_guided_run(bool in_flight);
142 
146 extern void guidance_v_set_z(float z);
147 
151 extern void guidance_v_set_vz(float vz);
152 
156 extern void guidance_v_set_th(float th);
157 
158 #endif /* GUIDANCE_V_H */
Adaptation block of the vertical guidance.
Reference generation for vertical guidance.
void guidance_v_thrust_adapt(bool in_flight)
Definition: guidance_v.c:199
void guidance_v_set_vz(float vz)
Set z velocity setpoint.
Definition: guidance_v.c:378
struct ThrustSetpoint guidance_v_run_accel(bool in_flight, struct VerticalGuidance *gv)
void guidance_v_z_enter(void)
Definition: guidance_v.c:267
void guidance_v_notify_in_flight(bool in_flight)
Definition: guidance_v.c:163
float nominal_throttle
nominal throttle for hover.
Definition: guidance_v.h:102
struct ThrustSetpoint guidance_v_from_nav(bool in_flight)
Set guidance setpoint from NAV and run hover loop.
Definition: guidance_v.c:300
int32_t z_sp
altitude setpoint in meters (input).
Definition: guidance_v.h:50
int32_t zd_sp
vertical speed setpoint in meter/s (input).
Definition: guidance_v.h:56
struct ThrustSetpoint thrust
Final thrust setpoint summation of feed-forward and feed-back commands, can be a total thrust or incr...
Definition: guidance_v.h:96
void guidance_v_run_enter(void)
int32_t z_ref
altitude reference in meters.
Definition: guidance_v.h:62
struct ThrustSetpoint guidance_v_run_speed(bool in_flight, struct VerticalGuidance *gv)
void guidance_v_set_z(float z)
Set z position setpoint.
Definition: guidance_v.c:368
void guidance_v_guided_enter(void)
Enter GUIDED mode control.
Definition: guidance_v.c:328
struct ThrustSetpoint guidance_v_run_pos(bool in_flight, struct VerticalGuidance *gv)
int32_t zd_ref
vertical speed reference in meter/s.
Definition: guidance_v.h:68
void guidance_v_set_ref(int32_t pos, int32_t speed, int32_t accel)
Set guidance ref parameters.
Definition: guidance_v.c:280
int32_t th_sp
input thrust setpoint.
Definition: guidance_v.h:90
void guidance_v_set_th(float th)
Set throttle setpoint.
Definition: guidance_v.c:386
struct ThrustSetpoint guidance_v_guided_run(bool in_flight)
Run GUIDED mode control.
Definition: guidance_v.c:338
int32_t rc_zd_sp
Vertical speed setpoint from radio control.
Definition: guidance_v.h:85
void guidance_v_mode_changed(uint8_t new_mode)
Definition: guidance_v.c:132
struct VerticalGuidance guidance_v
Definition: guidance_v.c:60
void guidance_v_update_ref(void)
Definition: guidance_v.c:289
void guidance_v_init(void)
Definition: guidance_v.c:91
int32_t thrust_coeff
Definition: guidance_v.h:104
int32_t zdd_ref
vertical acceleration reference in meter/s^2.
Definition: guidance_v.h:74
int32_t rc_delta_t
Direct throttle from radio control.
Definition: guidance_v.h:79
struct ThrustSetpoint guidance_v_run(bool in_flight)
Guidance vertical run functions.
Definition: guidance_v.c:221
General stabilization interface for rotorcrafts.
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
Definition: stabilization.h:82
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98