Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
guidance_h.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_H_H
28 #define GUIDANCE_H_H
29 
30 
31 #include "math/pprz_algebra_int.h"
32 
34 #include "generated/airframe.h"
35 #include "std.h"
36 
40 #ifndef GUIDANCE_H_USE_REF
41 #define GUIDANCE_H_USE_REF TRUE
42 #endif
43 
44 #define GUIDANCE_H_MODE_KILL 0
45 #define GUIDANCE_H_MODE_RATE 1
46 #define GUIDANCE_H_MODE_ATTITUDE 2
47 #define GUIDANCE_H_MODE_HOVER 3
48 #define GUIDANCE_H_MODE_NAV 4
49 #define GUIDANCE_H_MODE_RC_DIRECT 5
50 #define GUIDANCE_H_MODE_CARE_FREE 6
51 #define GUIDANCE_H_MODE_FORWARD 7
52 
53 
55 extern bool_t guidance_h_use_ref;
56 
61 extern struct Int32Vect2 guidance_h_pos_sp;
62 
63 extern struct Int32Vect2 guidance_h_pos_ref;
64 extern struct Int32Vect2 guidance_h_speed_ref;
65 extern struct Int32Vect2 guidance_h_accel_ref;
66 
67 extern struct Int32Vect2 guidance_h_pos_err;
68 extern struct Int32Vect2 guidance_h_speed_err;
70 extern struct Int32Vect2 guidance_h_nav_err;
71 
72 extern struct Int32Eulers guidance_h_rc_sp;
75 
80 
83 
84 extern void guidance_h_init(void);
85 extern void guidance_h_mode_changed(uint8_t new_mode);
86 extern void guidance_h_read_rc(bool_t in_flight);
87 extern void guidance_h_run(bool_t in_flight);
88 
89 
90 #define guidance_h_SetKi(_val) { \
91  guidance_h_igain = _val; \
92  INT_VECT2_ZERO(guidance_h_pos_err_sum); \
93  }
94 
95 /* Make sure that ref can only be temporarily disabled for testing,
96  * but not enabled if GUIDANCE_H_USE_REF was defined to FALSE.
97  */
98 #define guidance_h_SetUseRef(_val) { \
99  guidance_h_use_ref = _val && GUIDANCE_H_USE_REF; \
100  }
101 
102 #endif /* GUIDANCE_H_H */
bool_t guidance_h_use_ref
Definition: guidance_h.c:60
int32_t guidance_h_dgain
Definition: guidance_h.c:78
int32_t guidance_h_pgain
Definition: guidance_h.c:77
Reference generation for horizontal guidance.
struct Int32Eulers guidance_h_command_body
with INT32_ANGLE_FRAC
Definition: guidance_h.c:75
void guidance_h_mode_changed(uint8_t new_mode)
Definition: guidance_h.c:120
int32_t guidance_h_again
Definition: guidance_h.c:80
void guidance_h_run(bool_t in_flight)
Definition: guidance_h.c:213
struct Int32Vect2 guidance_h_pos_sp
horizontal position setpoint in NED.
Definition: guidance_h.c:62
struct Int32Eulers guidance_h_rc_sp
with INT32_ANGLE_FRAC
Definition: guidance_h.c:72
struct Int32Vect2 guidance_h_pos_err
Definition: guidance_h.c:67
int32_t transition_theta_offset
Definition: guidance_h.c:83
struct Int32Vect2 guidance_h_nav_err
Definition: guidance_h.c:70
void guidance_h_read_rc(bool_t in_flight)
Definition: guidance_h.c:172
struct Int32Vect2 guidance_h_command_earth
Definition: guidance_h.c:73
struct Int32Vect2 guidance_h_speed_err
Definition: guidance_h.c:68
int32_t transition_percentage
Definition: guidance_h.c:82
struct Int32Vect2 guidance_h_pos_err_sum
Definition: guidance_h.c:69
signed long int32_t
Definition: types.h:19
struct Int32Vect2 guidance_h_speed_ref
with INT32_SPEED_FRAC
Definition: guidance_h.c:64
void guidance_h_init(void)
Definition: guidance_h.c:93
unsigned char uint8_t
Definition: types.h:14
uint8_t guidance_h_mode
Definition: guidance_h.c:59
struct Int32Vect2 guidance_h_accel_ref
with INT32_ACCEL_FRAC
Definition: guidance_h.c:65
struct Int32Vect2 guidance_h_pos_ref
with INT32_POS_FRAC
Definition: guidance_h.c:63
int32_t guidance_h_igain
Definition: guidance_h.c:79
Paparazzi fixed point algebra.
euler angles