Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
guidance_oneloop.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Tomaso De Ponti <t.m.l.deponti@tudelft.nl>
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
34
36{
38}
39
41{
42 // nothing to do
43}
44
47
52
57
62
64{
65 _gv = gv;
67 return thrust_sp; // nothing to do
68}
69
71{
72 _gv = gv;
74 return thrust_sp; // nothing to do
75}
76
78{
79 _gv = gv;
81 return thrust_sp;; // nothing to do
82}
83
85{
86 struct FloatVect3 PSA_des = { 0 };
87 int rm_order_h = 3;
88 int rm_order_v = 3;
89 // Oneloop controller wants desired targets and handles reference generation internally
91 PSA_des.x = POS_FLOAT_OF_BFP(gh->sp.pos.x);
92 PSA_des.y = POS_FLOAT_OF_BFP(gh->sp.pos.y);
93 rm_order_h = 3;
94 }
95 else if (h_mode == GUIDANCE_ONELOOP_H_SPEED) {
96 PSA_des.x = SPEED_FLOAT_OF_BFP(gh->sp.speed.x);
97 PSA_des.y = SPEED_FLOAT_OF_BFP(gh->sp.speed.y);
98 PSA_des.z = SPEED_FLOAT_OF_BFP(gv->zd_sp);
99 rm_order_h = 2;
100 }
101 else { // H_ACCEL
102 PSA_des.x = ACCEL_FLOAT_OF_BFP(gh->ref.accel.x);
103 PSA_des.y = ACCEL_FLOAT_OF_BFP(gh->ref.accel.y);
104 PSA_des.z = ACCEL_FLOAT_OF_BFP(gv->zdd_ref);
105 rm_order_h = 1;
106 }
107
109 PSA_des.z = POS_FLOAT_OF_BFP(gv->z_sp);
110 rm_order_v = 3;
111 }
112 else if (v_mode == GUIDANCE_ONELOOP_V_SPEED) {
113 PSA_des.z = SPEED_FLOAT_OF_BFP(gv->zd_sp);
114 rm_order_v = 2;
115 }
116 else { // H_ACCEL
117 PSA_des.z = ACCEL_FLOAT_OF_BFP(gv->zdd_ref); //why is there not acceleration SP and only REF?
118 rm_order_v = 1;
119 }
120 oneloop_andi.half_loop = false;
122 struct StabilizationSetpoint sp = { 0 };
123 return sp;
124}
#define UNUSED(x)
#define POS_FLOAT_OF_BFP(_ai)
#define SPEED_FLOAT_OF_BFP(_ai)
#define ACCEL_FLOAT_OF_BFP(_ai)
void guidance_h_run_enter(void)
static enum GuidanceOneloop_VMode _v_mode
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_oneloop_run_mode(bool in_flight, struct HorizontalGuidance *gh, struct VerticalGuidance *gv, enum GuidanceOneloop_HMode h_mode, enum GuidanceOneloop_VMode v_mode)
void guidance_v_run_enter(void)
static struct VerticalGuidance * _gv
struct ThrustSetpoint guidance_v_run_pos(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
struct ThrustSetpoint guidance_v_run_speed(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct ThrustSetpoint thrust_sp
struct ThrustSetpoint guidance_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
A dummy guidance mode to run the oneloop_andi controller.
GuidanceOneloop_HMode
@ GUIDANCE_ONELOOP_H_ACCEL
@ GUIDANCE_ONELOOP_H_POS
@ GUIDANCE_ONELOOP_H_SPEED
GuidanceOneloop_VMode
@ GUIDANCE_ONELOOP_V_POS
@ GUIDANCE_ONELOOP_V_SPEED
@ GUIDANCE_ONELOOP_V_ACCEL
uint16_t foo
Definition main_demo5.c:58
void oneloop_andi_enter(bool half_loop_sp, int ctrl_type)
Function that resets important values upon engaging Oneloop ANDI.
void oneloop_andi_run(bool in_flight, bool half_loop, struct FloatVect3 PSA_des, int rm_order_h, int rm_order_v)
Main function that runs the controller and performs control allocation.
struct OneloopGeneral oneloop_andi
#define CTRL_ANDI
Control types.
Horizontal guidance for rotorcrafts.
struct VerticalGuidance guidance_v
Definition guidance_v.c:60
Vertical guidance for rotorcrafts.
Stabilization setpoint.
union StabilizationSetpoint::@278 sp
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...