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
scheduling_indi_simple.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Ewoud Smeur <ewoud_smeur@msn.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
30#include "generated/airframe.h"
31#include "state.h"
32#define INDI_SCHEDULING_LOWER_BOUND_G1 0.0001
33
35
37
39
40//Get the specified gains in the gainlibrary
42{
43}
44
46{
47 // Go from transition percentage to ratio
48 float ratio = 0.0;
49
50 // Ratio is only based on pitch now, as the pitot tube is often not mounted.
51 if (use_scheduling == 1) {
52 ratio = fabs(stateGetNedToBodyEulers_f()->theta) / M_PI_2;
53 } else {
54 ratio = 0.0;
55 }
56
57 indi.g1.p = g_hover[0] * (1.0 - ratio) + g_forward[0] * ratio;
58 indi.g1.q = g_hover[1] * (1.0 - ratio) + g_forward[1] * ratio;
59 indi.g1.r = g_hover[2] * (1.0 - ratio) + g_forward[2] * ratio;
60
61 // Make sure g1 can never be negative, as the inverse is taken!
64 }
67 }
70 }
71
72 float ratio_spec_force = 0.0;
73 float airspeed = stateGetAirspeed_f();
74 Bound(airspeed, 8.0, 20.0);
75 ratio_spec_force = (airspeed-8.0) / 12.0;
78}
79
float q
in rad/s
float p
in rad/s
float r
in rad/s
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition state.h:1306
static float stateGetAirspeed_f(void)
Get airspeed (float).
Definition state.h:1590
float guidance_indi_specific_force_gain
A guidance mode based on Incremental Nonlinear Dynamic Inversion Come to ICRA2016 to learn more!
uint16_t foo
Definition main_demo5.c:58
Horizontal guidance for rotorcrafts.
int32_t use_scheduling
void ctrl_eff_scheduling_periodic(void)
Periodic function that interpolates between gain sets depending on the scheduling variable.
#define INDI_SCHEDULING_LOWER_BOUND_G1
static float g_forward[3]
static float g_hover[3]
void ctrl_eff_scheduling_init(void)
Initialises periodic loop;.
struct IndiVariables indi
API to get/set the generic vehicle states.
int int32_t
Typedef defining 32 bit int type.