Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
swashplate_mixing.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 C. De Wagter
3  * 2015 Freek van Tienen <freek.v.tienen@gmail.com>
4  *
5  * This file is part of paparazzi
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
27 #ifndef SWASHPLATE_MIXING_H
28 #define SWASHPLATE_MIXING_H
29 
30 #include "std.h"
31 #include "paparazzi.h"
32 #include "generated/airframe.h"
33 
34 /* Different type of swashplate mixings */
35 #define MECH 0
36 #define H120 1
37 #define HR120 2
38 
42 #if SW_MIXING_TYPE == MECH
43 #define SW_NB 3
44 #define SW_FRONT 0
45 #define SW_RIGHT 1
46 #define SW_COLL 2
47 #define SW_MIXING_ROLL_COEF { 0, -1, 0 }
48 #define SW_MIXING_PITCH_COEF { 1, 0, 0 }
49 #define SW_MIXING_COLL_COEF { 0, 0, 1 }
50 
51 #elif SW_MIXING_TYPE == H120
52 #define SW_NB 3
53 #define SW_FRONT 0
54 #define SW_RIGHTBACK 1
55 #define SW_LEFTBACK 2
56 #define SW_MIXING_ROLL_COEF { 0, -0.866, 0.866 }
57 #define SW_MIXING_PITCH_COEF { 1, -0.5, -0.5 }
58 #define SW_MIXING_COLL_COEF { 1, 1, 1 }
59 
60 #elif SW_MIXING_TYPE == HR120
61 #define SW_NB 3
62 #define SW_BACK 0
63 #define SW_LEFTFRONT 1
64 #define SW_RIGHTFRONT 2
65 #define SW_MIXING_ROLL_COEF { 0, 0.866, -0.866 }
66 #define SW_MIXING_PITCH_COEF { -1, 0.5, 0.5 }
67 #define SW_MIXING_COLL_COEF { 1, 1, 1 }
68 #endif
69 
70 /* Swashplate mixing structure */
74 };
76 
77 /* External used functions */
78 extern void swashplate_mixing_init(void);
79 extern void swashplate_mixing_run(pprz_t in_cmd[]);
80 
81 #endif
#define SW_NB
MECH (front/right/coll), H120 (front/rightback/leftback), HR120 (back/leftfront/rightfront) ...
int16_t pprz_t
Definition: paparazzi.h:6
struct swashplate_mixing_t swashplate_mixing
void swashplate_mixing_init(void)
Initialize the motor mixing and calculate the trim values.
int32_t commands[SW_NB]
The output commands.
signed long int32_t
Definition: types.h:19
void swashplate_mixing_run(pprz_t in_cmd[])
int32_t trim[SW_NB]
Trim values for the different actuators.