Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
eff_scheduling_plusquad.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 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, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef CTRL_EFF_SCHED_ROTWING_H
27#define CTRL_EFF_SCHED_ROTWING_H
28
29#include "std.h"
30#include "generated/airframe.h"
31
32#ifndef EFF_MAT_ROWS_NB
33#define EFF_MAT_ROWS_NB 6
34#endif
35
36#define RW_aX 0 // X body axis (linear acceleration)
37#define RW_aY 1 // Y body axis (linear acceleration)
38#define RW_aZ 2 // Z body axis (linear acceleration)
39#define RW_aN 0 // North axis (linear acceleration)
40#define RW_aE 1 // East axis (linear acceleration)
41#define RW_aD 2 // Down axis (linear acceleration)
42#define RW_ap 3 // X body axis (angular acceleration)
43#define RW_aq 4 // Y body axis (angular acceleration)
44#define RW_ar 5 // Z body axis (angular acceleration)
45
46#ifndef COMMANDS_NB_VIRTUAL
47#define COMMANDS_NB_VIRTUAL 0
48#endif
49
50#ifndef COMMAND_ROLL
51#define COMMAND_ROLL COMMANDS_NB+1
52#endif
53
54#ifndef COMMAND_PITCH
55#define COMMAND_PITCH COMMANDS_NB+2
56#endif
57
58#ifndef EFF_MAT_COLS_NB
59#define EFF_MAT_COLS_NB (COMMANDS_NB_REAL + COMMANDS_NB_VIRTUAL)
60#endif
61
62#define RW_G_SCALE 1000.0f
63
65extern float G2_RW[EFF_MAT_COLS_NB] ;
67
69 float Ixx; // Total MMOI around roll axis [kgm²]
70 float Iyy; // Total MMOI around pitch axis [kgm²]
71 float wing_rotation_rad; // Wing rotation angle in radians: from ABI message
72 float wing_rotation_deg; // Wing rotation angle in degrees: (clone in degrees)
73 float cosr; // cosine of wing rotation angle
74 float sinr; // sine of wing rotation angle
75 float cosr2; // cosine² of wing rotation angle
76 float sinr2; // sine² of wing rotation angle
77 float cosr3; // cosine³ of wing rotation angle
78 float sinr3; // sine³ of wing rotation angle
79};
80
81struct I{
82 float xx;
83 float yy;
84 float zz;
85 float w_xx;
86 float w_yy;
87 float b_xx;
88 float b_yy;
89};
90struct F_M_Body{
91 float dFdu; // derivative of the force with respect to the control input (e.g. linear coefficient)
92 float dMdu; // derivative of the reaction trque with respect to the control input (e.g. linear coefficient)
93 float dMdud; // derivative of the reaction torque with respect to the control input time derivative
94 float l; // arm length
95};
96
98 float phi;
99 float theta;
100 float psi;
101 float sphi;
102 float cphi;
103 float stheta;
104 float ctheta;
105 float spsi;
106 float cpsi;
107};
108
109struct RW_Model{
110 struct I I; // Inertia matrix
111 float m; // mass [kg]
112 float T; // Thrust [N]
113 float P; // Pusher thrust [N]
115 struct F_M_Body mF;
116 struct F_M_Body mR;
117 struct F_M_Body mB;
118 struct F_M_Body mL;
119 struct F_M_Body mP;
120 struct F_M_Body ele;
121 struct F_M_Body rud;
122 struct F_M_Body ail;
123 struct F_M_Body flp;
124};
125
126extern bool manual_roll ;
127extern bool manual_pitch ;
128extern bool manual_yaw ;
129
130extern float roll_mult ;
131extern float pitch_mult ;
132extern float yaw_mult ;
133extern float thrust_mult ;
134
135extern int G2_on;
136extern int thrust_curve;
137extern float temp_mQ_k;
138
139extern float roll_eff;
140extern float yaw_eff;
141extern float ele_min;
142
143extern void eff_scheduling_rotwing_init(void);
144extern void eff_scheduling_rotwing_periodic(void);
145
146extern struct RW_Model RW;
147#endif // CTRL_EFF_SCHED_ROTWING_H
148
float yaw_mult
float G2_RW[EFF_MAT_COLS_NB]
int thrust_curve
float G1_RW[EFF_MAT_ROWS_NB][EFF_MAT_COLS_NB]
float ele_min
float thrust_mult
struct RW_Model RW
bool manual_pitch
float roll_eff
#define EFF_MAT_COLS_NB
float EFF_MAT_RW[EFF_MAT_ROWS_NB][EFF_MAT_COLS_NB]
bool manual_roll
float pitch_mult
float yaw_eff
void eff_scheduling_rotwing_init(void)
#define EFF_MAT_ROWS_NB
bool manual_yaw
void eff_scheduling_rotwing_periodic(void)
float temp_mQ_k
float roll_mult
struct F_M_Body ele
struct F_M_Body mP
struct F_M_Body mL
struct F_M_Body mR
struct F_M_Body mF
struct RW_attitude att
struct F_M_Body rud
struct F_M_Body flp
struct F_M_Body mB
struct F_M_Body ail