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
motor_mixing_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2015 The Paparazzi Team
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 
26 #ifndef MOTOR_MIXING_TYPES_H
27 #define MOTOR_MIXING_TYPES_H
28 
29 /* already defined common configurations*/
30 #define QUAD_PLUS 1
31 #define QUAD_X 2
32 #define HEXA_X 3
33 #define HEXA_PLUS 4
34 #define OCTO_X 5
35 #define OCTO_PLUS 6
36 
37 /* set to TRUE to reverse the rotation direction of all motors */
38 #if MOTOR_MIXING_REVERSE
39 #define MOTOR_YAW_SIGN (-1)
40 #else
41 #define MOTOR_YAW_SIGN 1
42 #endif
43 
44 #if MOTOR_MIXING_TYPE == QUAD_PLUS
45 /*
46  * Quadrotor in plus (+) cross configuration with motor order:
47  * front (CW), right (CCW), back (CW), left (CCW)
48  */
49 #define MOTOR_FRONT 0
50 #define MOTOR_RIGHT 1
51 #define MOTOR_BACK 2
52 #define MOTOR_LEFT 3
53 #define MOTOR_MIXING_NB_MOTOR 4
54 #define MOTOR_MIXING_SCALE 256
55 #define MOTOR_MIXING_ROLL_COEF { 0, -256, 0, 256 }
56 #define MOTOR_MIXING_PITCH_COEF { 256, 0, -256, 0 }
57 #define MOTOR_MIXING_YAW_COEF { -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128 }
58 #define MOTOR_MIXING_THRUST_COEF { 256, 256, 256, 256 }
59 
60 #elif MOTOR_MIXING_TYPE == QUAD_X
61 /*
62  * Quadrotor in time cross (X) configuration with motor order:
63  * front left (CW), front right (CCW), back right (CW), back left (CCW)
64  */
65 #define MOTOR_FRONT_LEFT 0
66 #define MOTOR_FRONT_RIGHT 1
67 #define MOTOR_BACK_RIGHT 2
68 #define MOTOR_BACK_LEFT 3
69 #define MOTOR_MIXING_NB_MOTOR 4
70 #define MOTOR_MIXING_SCALE 256
71 #define MOTOR_MIXING_ROLL_COEF { 181, -181, -181, 181 }
72 #define MOTOR_MIXING_PITCH_COEF { 181, 181, -181, -181 }
73 #define MOTOR_MIXING_YAW_COEF { -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128 }
74 #define MOTOR_MIXING_THRUST_COEF { 256, 256, 256, 256 }
75 
76 #elif MOTOR_MIXING_TYPE == HEXA_X
77 /*
78  * Hexarotor in time cross (X) configuration with motor order:
79  * front left (CW), front right (CCW), right (CW), back right (CCW), back left (CW), left (CCW)
80  */
81 #define MOTOR_FRONT_LEFT 0
82 #define MOTOR_FRONT_RIGHT 1
83 #define MOTOR_RIGHT 2
84 #define MOTOR_BACK_RIGHT 3
85 #define MOTOR_BACK_LEFT 4
86 #define MOTOR_LEFT 5
87 #define MOTOR_MIXING_NB_MOTOR 6
88 #define MOTOR_MIXING_SCALE 256
89 #define MOTOR_MIXING_ROLL_COEF { 128, -128, -256, -128, 128, 256 }
90 #define MOTOR_MIXING_PITCH_COEF { 222, 222, 0, -222, -222, 0 }
91 #define MOTOR_MIXING_YAW_COEF { -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128 }
92 #define MOTOR_MIXING_THRUST_COEF { 256, 256, 256, 256, 256, 256 }
93 
94 #elif MOTOR_MIXING_TYPE == HEXA_PLUS
95 /*
96  * Hexarotor in plus (+) configuration with motor order:
97  * front (CW), front right (CCW), back right (CW), back (CCW), back left (CW), front left (CCW)
98  */
99 #define MOTOR_FRONT 0
100 #define MOTOR_FRONT_RIGHT 1
101 #define MOTOR_BACK_RIGHT 2
102 #define MOTOR_BACK 3
103 #define MOTOR_BACK_LEFT 4
104 #define MOTOR_FRONT_LEFT 5
105 #define MOTOR_MIXING_NB_MOTOR 6
106 #define MOTOR_MIXING_SCALE 256
107 #define MOTOR_MIXING_ROLL_COEF { 0, -222, -222, 0, 222, 222 }
108 #define MOTOR_MIXING_PITCH_COEF { 256, 128, -128, -256, -128, 128 }
109 #define MOTOR_MIXING_YAW_COEF { -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128 }
110 #define MOTOR_MIXING_THRUST_COEF { 256, 256, 256, 256, 256, 256 }
111 
112 #elif MOTOR_MIXING_TYPE == OCTO_PLUS
113 /*
114  * Hexarotor in plus cross (+) configuration with motor order:
115  * front (CW), front right (CCW), right (CW), back right (CCW),
116  * back (CW), back left (CCW), left (CW), front left (CCW)
117  */
118 #define MOTOR_FRONT 0
119 #define MOTOR_FRONT_RIGHT 1
120 #define MOTOR_RIGHT 2
121 #define MOTOR_BACK_RIGHT 3
122 #define MOTOR_BACK 4
123 #define MOTOR_BACK_LEFT 5
124 #define MOTOR_LEFT 6
125 #define MOTOR_FRONT_LEFT 7
126 #define MOTOR_MIXING_NB_MOTOR 8
127 #define MOTOR_MIXING_SCALE 256
128 #define MOTOR_MIXING_ROLL_COEF { 0, -181, -256, -181, 0, 181, 256, 181 }
129 #define MOTOR_MIXING_PITCH_COEF { 256, 181, 0, -181, -256, -181, 0, 181 }
130 #define MOTOR_MIXING_YAW_COEF { -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128 }
131 #define MOTOR_MIXING_THRUST_COEF { 256, 256, 256, 256, 256, 256, 256, 256 }
132 
133 #elif MOTOR_MIXING_TYPE == OCTO_X
134 /*
135  * Hexarotor in time cross (X) configuration with motor order:
136  * front left1 (CW), front right1 (CCW), front right2 (CW), back right1 (CCW),
137  * back right2 (CW), back left1 (CCW), back left2 (CW), front left2 (CCW)
138  */
139 #define MOTOR_FRONT_LEFT1 0
140 #define MOTOR_FRONT_RIGHT1 1
141 #define MOTOR_FRONT_RIGHT2 2
142 #define MOTOR_BACK_RIGHT1 3
143 #define MOTOR_BACK_RIGHT2 4
144 #define MOTOR_BACK_LEFT1 5
145 #define MOTOR_BACK_LEFT2 6
146 #define MOTOR_FRONT_LEFT2 7
147 #define MOTOR_MIXING_NB_MOTOR 8
148 #define MOTOR_MIXING_SCALE 256
149 #define MOTOR_MIXING_ROLL_COEF { 98, -98, -237, -237, -98, 98, 237, 237 }
150 #define MOTOR_MIXING_PITCH_COEF { 237, 237, 98, -98, -237, -237, -98, 98 }
151 #define MOTOR_MIXING_YAW_COEF { -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128, -MOTOR_YAW_SIGN*128, MOTOR_YAW_SIGN*128 }
152 #define MOTOR_MIXING_THRUST_COEF { 256, 256, 256, 256, 256, 256, 256, 256 }
153 
154 #endif
155 
156 #endif /* MOTOR_MIXING_TYPES_H */