Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces 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, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef GUIDANCE_H_H
27#define GUIDANCE_H_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
35
38#include "generated/airframe.h"
39#include "std.h"
40
44#ifndef GUIDANCE_H_USE_REF
45#define GUIDANCE_H_USE_REF TRUE
46#endif
47
52#ifndef GUIDANCE_H_USE_SPEED_REF
53#define GUIDANCE_H_USE_SPEED_REF TRUE
54#endif
55
56#define GUIDANCE_H_MODE_NONE 0
57#define GUIDANCE_H_MODE_HOVER 1
58#define GUIDANCE_H_MODE_NAV 2
59#define GUIDANCE_H_MODE_GUIDED 3
60
63#ifndef GUIDANCE_H_MAX_BANK
64#define GUIDANCE_H_MAX_BANK RadOfDeg(20)
65#endif
66
67
90
96
102
112
113extern struct HorizontalGuidance guidance_h;
114
115extern void guidance_h_init(void);
117extern void guidance_h_run_enter(void);
118extern struct StabilizationSetpoint guidance_h_run(bool in_flight);
119extern struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh);
122
123extern void guidance_h_hover_enter(void);
124extern void guidance_h_nav_enter(void);
125
128extern struct StabilizationSetpoint guidance_h_from_nav(bool in_flight);
129
132extern struct StabilizationSetpoint guidance_h_guided_run(bool in_flight);
133
138extern void guidance_h_set_pos(float x, float y);
139
143extern void guidance_h_set_heading(float heading);
144
149extern void guidance_h_set_body_vel(float vx, float vy);
150
155extern void guidance_h_set_acc(float ax, float ay);
156
161extern void guidance_h_set_body_acc(float ax, float ay);
162
167extern void guidance_h_set_vel(float vx, float vy);
168
172extern void guidance_h_set_heading_rate(float rate);
173
174/* Make sure that ref can only be temporarily disabled for testing,
175 * but not enabled if GUIDANCE_H_USE_REF was defined to FALSE.
176 */
177#define guidance_h_SetUseRef(_val) { \
178 guidance_h.use_ref = _val && GUIDANCE_H_USE_REF; \
179 }
180
181static inline void guidance_h_SetMaxSpeed(float speed)
182{
183 gh_set_max_speed(speed);
184}
185
186static inline void guidance_h_SetOmega(float omega)
187{
188 gh_set_omega(omega);
189}
190
191static inline void guidance_h_SetZeta(float zeta)
192{
193 gh_set_zeta(zeta);
194}
195
196static inline void guidance_h_SetTau(float tau)
197{
198 gh_set_tau(tau);
199}
200
201#ifdef __cplusplus
202}
203#endif
204
205#endif /* GUIDANCE_H_H */
float gh_set_zeta(float zeta)
float gh_set_tau(float tau)
float gh_set_omega(float omega)
float gh_set_max_speed(float max_speed)
Set a new maximum speed for waypoint navigation.
Reference generation for horizontal guidance.
uint16_t foo
Definition main_demo5.c:58
Paparazzi floating point algebra.
Paparazzi fixed point algebra.
struct StabilizationSetpoint guidance_h_guided_run(bool in_flight)
Run GUIDED mode control.
Definition guidance_h.c:441
void guidance_h_set_acc(float ax, float ay)
Set horizontal velocity setpoint.
Definition guidance_h.c:498
struct StabilizationSetpoint guidance_h_from_nav(bool in_flight)
Set horizontal guidance from NAV and run control loop.
Definition guidance_h.c:375
struct Int32Vect2 vect
Definition guidance_h.h:98
void guidance_h_set_pos(float x, float y)
Set horizontal position setpoint.
Definition guidance_h.c:455
struct Int32Vect2 accel
with INT32_ACCEL_FRAC
Definition guidance_h.h:94
void guidance_h_mode_changed(uint8_t new_mode)
Definition guidance_h.c:128
void guidance_h_run_enter(void)
void guidance_h_hover_enter(void)
Definition guidance_h.c:343
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
void guidance_h_set_body_acc(float ax, float ay)
Set body relative horizontal acceleration setpoint.
Definition guidance_h.c:490
struct Int32Vect2 speed
with INT32_SPEED_FRAC
Definition guidance_h.h:93
static void guidance_h_SetTau(float tau)
Definition guidance_h.h:196
void guidance_h_set_heading(float heading)
Set heading setpoint.
Definition guidance_h.c:465
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
void guidance_h_init(void)
Definition guidance_h.c:86
struct HorizontalGuidanceRCInput rc_sp
remote control setpoint
Definition guidance_h.h:110
struct HorizontalGuidance guidance_h
Definition guidance_h.c:45
static void guidance_h_SetMaxSpeed(float speed)
Definition guidance_h.h:181
void guidance_h_nav_enter(void)
Definition guidance_h.c:364
struct Int32Vect2 pos
with INT32_POS_FRAC
Definition guidance_h.h:92
struct HorizontalGuidanceReference ref
reference calculated from setpoints
Definition guidance_h.h:109
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run(bool in_flight)
Definition guidance_h.c:244
void guidance_h_set_vel(float vx, float vy)
Set horizontal acceleration setpoint.
Definition guidance_h.c:480
static void guidance_h_SetOmega(float omega)
Definition guidance_h.h:186
void guidance_h_set_body_vel(float vx, float vy)
Set body relative horizontal velocity setpoint.
Definition guidance_h.c:472
static void guidance_h_SetZeta(float zeta)
Definition guidance_h.h:191
void guidance_h_set_heading_rate(float rate)
Set heading rate setpoint.
Definition guidance_h.c:508
struct HorizontalGuidanceSetpoint sp
setpoints
Definition guidance_h.h:108
General stabilization interface for rotorcrafts.
enum HorizontalGuidanceSetpoint::@275 yaw_mask
struct Int32Vect2 pos
horizontal position setpoint in NED.
Definition guidance_h.h:73
enum HorizontalGuidanceSetpoint::@274 h_mask
struct Int32Vect2 accel
For direct control of acceleration, if the guidance scheme is able to provide it.
Definition guidance_h.h:75
struct Int32Vect2 speed
only used in HOVER mode if GUIDANCE_H_USE_SPEED_REF or in GUIDED mode
Definition guidance_h.h:74
Stabilization setpoint.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
float heading
Definition wedgebug.c:258