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