Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
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 
48 #ifndef GUIDANCE_H_USE_SPEED_REF
49 #define GUIDANCE_H_USE_SPEED_REF TRUE
50 #endif
51 
52 #define GUIDANCE_H_MODE_KILL 0
53 #define GUIDANCE_H_MODE_RATE 1
54 #define GUIDANCE_H_MODE_ATTITUDE 2
55 #define GUIDANCE_H_MODE_HOVER 3
56 #define GUIDANCE_H_MODE_NAV 4
57 #define GUIDANCE_H_MODE_RC_DIRECT 5
58 #define GUIDANCE_H_MODE_CARE_FREE 6
59 #define GUIDANCE_H_MODE_FORWARD 7
60 
61 
63 extern bool_t guidance_h_use_ref;
65 
70 extern struct Int32Vect2 guidance_h_pos_sp;
71 
72 extern struct Int32Vect2 guidance_h_pos_ref;
73 extern struct Int32Vect2 guidance_h_speed_ref;
74 extern struct Int32Vect2 guidance_h_accel_ref;
75 
76 extern struct Int32Vect2 guidance_h_pos_err;
77 extern struct Int32Vect2 guidance_h_speed_err;
79 
80 
85 extern struct Int32Vect2 guidance_h_cmd_earth;
86 extern struct Int32Eulers guidance_h_rc_sp;
88 
94 
97 
98 extern void guidance_h_init(void);
99 extern void guidance_h_mode_changed(uint8_t new_mode);
100 extern void guidance_h_read_rc(bool_t in_flight);
101 extern void guidance_h_run(bool_t in_flight);
102 
103 
104 #define guidance_h_SetKi(_val) { \
105  guidance_h_igain = _val; \
106  INT_VECT2_ZERO(guidance_h_trim_att_integrator); \
107  }
108 
109 /* Make sure that ref can only be temporarily disabled for testing,
110  * but not enabled if GUIDANCE_H_USE_REF was defined to FALSE.
111  */
112 #define guidance_h_SetUseRef(_val) { \
113  guidance_h_use_ref = _val && GUIDANCE_H_USE_REF; \
114  }
115 
116 #define guidance_h_SetMaxSpeed(_val) { \
117  gh_set_max_speed(_val); \
118  }
119 
120 #endif /* GUIDANCE_H_H */
bool_t guidance_h_use_ref
Definition: guidance_h.c:70
int32_t guidance_h_dgain
Definition: guidance_h.c:89
int32_t guidance_h_pgain
Definition: guidance_h.c:88
struct Int32Vect2 guidance_h_trim_att_integrator
Definition: guidance_h.c:82
Reference generation for horizontal guidance.
void guidance_h_mode_changed(uint8_t new_mode)
Definition: guidance_h.c:199
int32_t guidance_h_again
Definition: guidance_h.c:91
void guidance_h_run(bool_t in_flight)
Definition: guidance_h.c:307
struct Int32Vect2 guidance_h_pos_sp
horizontal position setpoint in NED.
Definition: guidance_h.c:73
int32_t guidance_h_heading_sp
with INT32_ANGLE_FRAC
Definition: guidance_h.c:86
struct Int32Eulers guidance_h_rc_sp
with INT32_ANGLE_FRAC
Definition: guidance_h.c:85
int32_t guidance_h_vgain
Definition: guidance_h.c:92
struct Int32Vect2 guidance_h_pos_err
Definition: guidance_h.c:80
bool_t guidance_h_approx_force_by_thrust
Definition: guidance_h.c:71
int32_t transition_theta_offset
Definition: guidance_h.c:95
void guidance_h_read_rc(bool_t in_flight)
Definition: guidance_h.c:261
struct Int32Vect2 guidance_h_speed_err
Definition: guidance_h.c:81
int32_t transition_percentage
Definition: guidance_h.c:94
signed long int32_t
Definition: types.h:19
struct Int32Vect2 guidance_h_speed_ref
with INT32_SPEED_FRAC
Definition: guidance_h.c:75
void guidance_h_init(void)
Definition: guidance_h.c:163
unsigned char uint8_t
Definition: types.h:14
struct Int32Vect2 guidance_h_cmd_earth
horizontal guidance command.
Definition: guidance_h.c:84
uint8_t guidance_h_mode
Definition: guidance_h.c:69
struct Int32Vect2 guidance_h_accel_ref
with INT32_ACCEL_FRAC
Definition: guidance_h.c:76
struct Int32Vect2 guidance_h_pos_ref
with INT32_POS_FRAC
Definition: guidance_h.c:74
int32_t guidance_h_igain
Definition: guidance_h.c:90
Paparazzi fixed point algebra.
euler angles