Subversion Repositories Projects

Rev

Rev 178 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 178 Rev 186
1
/*	============================================================================ 
1
/*	============================================================================ 
2
 *	v0.1 
2
 *	v0.1 
3
 *
3
 *
4
 *  *****MoteCtrl*****
4
 *  *****MoteCtrl*****
5
 *	written by Andreas Benzin (aka Alpin)
5
 *	written by AndreasB (aka Alpin)
6
 *
6
 *
7
 *		 lets you control your MikroKopter with a Wiimote!
7
 *		 lets you control your MikroKopter with a Wiimote!
8
 *
8
 *
9
 *
9
 *
10
 *	Copyright December 2008
10
 *	Copyright December 2008
11
 *
11
 *
12
 *	#Credits & Thx: 
12
 *	#Credits & Thx: 
13
 *	- Holger & Ingo for the MikroKopter Project (www.mikrokopter.de)
13
 *	- Holger & Ingo for the MikroKopter Project (www.mikrokopter.de)
14
 *	- ExternalControl implementation of the FlightControl
14
 *	- ExternalControl implementation of the FlightControl
15
 *  - Ligi for RIDDIM, proof of external control concept
15
 *  - Ligi for RIDDIM, proof of external control concept
16
 *	- Documentation of the MK's SerialProtocol (www.mikrokopter.de/ucwiki/en/SerialProtocol)
16
 *	- Documentation of the MK's SerialProtocol (www.mikrokopter.de/ucwiki/en/SerialProtocol)
17
 *	- Michael Laforest for the wiiuse API
17
 *	- Michael Laforest for the wiiuse API
18
 *
18
 *
19
 *	#WEBSITE:	http://www.mikrokopter.de/ucwiki/en/MoteCtrl
19
 *	#WEBSITE:	http://www.mikrokopter.de/ucwiki/en/MoteCtrl
20
 *
20
 *
21
 *	*****Use at your own risk! No warranty. Only for private usage.*****
21
 *	*****Use at your own risk! No warranty. Only for private usage.*****
22
 *
22
 *
23
 *	#LICENSE:	Released under the GNU General Public License Version 2 or 
23
 *	#LICENSE:	Released under the GNU General Public License Version 2 or 
24
 *				(at your option) a later version of this license.
24
 *				(at your option) a later version of this license.
25
 *			
25
 *			
26
 *				This program is distributed in the hope that it will be useful,
26
 *				This program is distributed in the hope that it will be useful,
27
 *				but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 *				but WITHOUT ANY WARRANTY; without even the implied warranty of
28
 *				MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 *				MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
 *				GNU General Public License for more details.
29
 *				GNU General Public License for more details.
30
 *				For further details see <www.gnu.org/licenses/>.
30
 *				For further details see <www.gnu.org/licenses/>.
31
 *
31
 *
32
 *	#DISCLAIMER: Use this project at your own risk! 
32
 *	#DISCLAIMER: Use this project at your own risk! 
33
 *				 No warrenty.
33
 *				 No warrenty.
34
 *				 Only for private usage.
34
 *				 Only for private usage.
35
 *
35
 *
36
 *	============================================================================
36
 *	============================================================================
37
 */
37
 */
38
 
38
 
39
 ***** Table of Contents *****
39
 ***** Table of Contents *****
40
 
40
 
41
	1. Description
41
	1. Description
42
	2. What you need
42
	2. What you need
43
	3. Short checklist
43
	3. Short checklist
44
	4. Controls
44
	4. Controls
45
	5. Usage of MoteCtrl - Step by Step
45
	5. Usage of MoteCtrl - Step by Step
46
	6. Useful Tips & Practical Experiences
46
	6. Useful Tips & Practical Experiences
47
	
47
	
48
 
48
 
49
 
49
 
50
== 1. Description ==============================================================
50
== 1. Description ==============================================================
51
 
51
 
52
MoteCtrl is a small terminal-based programm, which acts as an
52
MoteCtrl is a small terminal-based programm, which acts as an
53
interface to the Wiimote and the MikroKopter platform.
53
interface to the Wiimote and the MikroKopter platform.
54
The MikroKopter is usually controlled by a normal 35MHz remote control. 
54
The MikroKopter is usually controlled by a normal 35MHz remote control. 
55
However, the FlightControl software also allows you to control your MikroKopter
55
However, the FlightControl software also allows you to control your MikroKopter
56
with a so called ExternControl struct, which is send via the serial 
56
with a so called ExternControl struct, which is send via the serial 
57
communications line.
57
communications line.
58
MoteCtrl.exe, running on your windows pc, exactly does this. It captures the 
58
MoteCtrl.exe, running on your windows pc, exactly does this. It captures the 
59
Wiimote's and Nunchuck's (extension to the wiimote) data and transfers it to the
59
Wiimote's and Nunchuck's (extension to the wiimote) data and transfers it to the
60
FlightCtrl. 
60
FlightCtrl. 
61
 
61
 
62
 
62
 
63
== 2. What you need ============================================================
63
== 2. What you need ============================================================
64
 
64
 
65
- MikroKopter with at least FlightCtrl firmware version 0.71h running
65
- MikroKopter with at least FlightCtrl firmware version 0.71h running
66
- wireless serial communication to the FilghtCtrl via Bluetooth
66
- wireless serial communication to the FilghtCtrl via Bluetooth
67
  (I use the F2M03GXA Bluetooth modul, with the wireless UART service activated, 
67
  (I use the F2M03GXA Bluetooth modul, with the wireless UART service activated, 
68
  see <http://www.mikrokopter.de/ucwiki/F2M03GXA> for more information)
68
  see <http://www.mikrokopter.de/ucwiki/F2M03GXA> for more information)
69
- Wiimote with Nunchuck extension
69
- Wiimote with Nunchuck extension
70
- Laptop running windows xp
70
- Laptop running windows xp
71
- Bluetooth-dongle or build-in bluetooth communications in your laptop
71
- Bluetooth-dongle or build-in bluetooth communications in your laptop
72
- Since I use the wiiuse lib v0.12 to connect to the Wiimote, your bluetooth
72
- Since I use the wiiuse lib v0.12 to connect to the Wiimote, your bluetooth
73
  stack should be compatible with the wiiuse lib
73
  stack should be compatible with the wiiuse lib
74
  On their page wiiuse.org they say, they successfully tested wiiuse with 
74
  On their page wiiuse.org they say, they successfully tested wiiuse with 
75
  BlueSoleil, Windows XP SP2 stack and Widcomm
75
  BlueSoleil, Windows XP SP2 stack and Widcomm
76
  (my BT-dongle uses the BlueSoleil stack and it works fine)
76
  (my BT-dongle uses the BlueSoleil stack and it works fine)
77
- Backup Pilot at the 35MHz Remote Control (see =Usage=)
77
- Backup Pilot at the 35MHz Remote Control (see =Usage=)
78
- MoteCtrl.exe along with the wiiuse.dll file (both in one folder)
78
- MoteCtrl.exe along with the wiiuse.dll file (both in one folder)
79
 
79
 
80
 
80
 
81
== 3. Short Checklist ===========================================================
81
== 3. Short Checklist ===========================================================
82
(for more detailed step by step instructions, see =Usage of MoteCtrl=)
82
(for more detailed step by step instructions, see =Usage of MoteCtrl=)
83
 
83
 
84
-MK ready?, ExternalControl switch assigned?, Backup pilot ready?
84
-MK ready?, ExternalControl switch assigned?, Backup pilot ready?
85
-Nunchuck plugged in to Wiimote? (software check does not work yet, seems to be 
85
-Nunchuck plugged in to Wiimote? (software check does not work yet, seems to be 
86
								  a bug in the wiiuse API)
86
								  a bug in the wiiuse API)
87
-BT connections to Wiimote (HID service running) and MikroKopter (Serial Port 
87
-BT connections to Wiimote (HID service running) and MikroKopter (Serial Port 
88
 Service running) established?
88
 Service running) established?
89
 
89
 
90
 
90
 
91
 == 4. Controls ================================================================
91
 == 4. Controls ================================================================
92
 
92
 
93
 GAS:		 Controlled by the two buttons on the Nunchuck extension ('c' and 'z'). 
93
 GAS:		 Controlled by the two buttons on the Nunchuck extension ('c' and 'z'). 
94
			 Press 'c' = Increment(++) gas value by 1
94
			 Press 'c' = Increment(++) gas value by 1
95
			 Press 'z' = Decrement(--) gas value by 1
95
			 Press 'z' = Decrement(--) gas value by 1
96
			 
96
			 
97
 YAW(GIER):  Controlled by the Nunchuck's joystick. 
97
 YAW(GIER):  Controlled by the Nunchuck's joystick. 
98
			 Pressed to the right half	=	yaw to the right
98
			 Pressed to the right half	=	yaw to the right
99
			 Pressed to the left  half   =	yaw to the left
99
			 Pressed to the left  half   =	yaw to the left
100
			 The more you push the joystick to one of the two directions, the 
100
			 The more you push the joystick to one of the two directions, the 
101
			 MK yaws faster.
101
			 MK yaws faster.
102
			 
102
			 
103
 NICK(PITCH): Controlled by the Wiimote's pitch-tilt. 
103
 NICK(PITCH): Controlled by the Wiimote's pitch-tilt. 
104
			 Tilting your Wiimote to the left means, tilting the Quadro left. 
104
			 Tilting your Wiimote to the left means, tilting the Quadro left. 
105
			 To the right accordingly.
105
			 To the right accordingly.
106
 
106
 
107
 ROLL:		 Controlled by the Wiimote's roll-tilt. 
107
 ROLL:		 Controlled by the Wiimote's roll-tilt. 
108
			 Same like with pitch.
108
			 Same like with pitch.
109
			 
109
			 
110
 SPECIAL:	You can reset the GAS value immediatly to ZERO (==no gas!!) with the
110
 SPECIAL:	You can reset the GAS value immediatly to ZERO (==no gas!!) with the
111
			HOME-Button. Be carefull with that!
111
			HOME-Button. Be carefull with that!
112
 
112
 
113
			 
113
			 
114
== 5. Usage of MoteCtrl - Step by Step =========================================
114
== 5. Usage of MoteCtrl - Step by Step =========================================
115
 
115
 
116
Preparations:
116
Preparations:
117
1.	Make sure your all the items listed under "What you need" work
117
1.	Make sure your all the items listed under "What you need" work
118
 
118
 
119
2. 	To allow external control you have to allocate a switch of your normal
119
2. 	To allow external control you have to allocate a switch of your normal
120
	35MHz RemoteCtrl to the "External Control" variable in the MikroKopter-Tool.
120
	35MHz RemoteCtrl to the "External Control" variable in the MikroKopter-Tool.
121
	You should find this option in the MK Tool -> Configuration/Settings
121
	You should find this option in the MK Tool -> Configuration/Settings
122
	Explanation: 
122
	Explanation: 
123
	Your normal Remote Control is always used as a backup device, in case the 
123
	Your normal Remote Control is always used as a backup device, in case the 
124
	operator at the Wiimote looses control of the Quadrokopter or the Bluetooth 
124
	operator at the Wiimote looses control of the Quadrokopter or the Bluetooth 
125
	connection is somehow interruted. Therefore the backup pilot at the 35MHz
125
	connection is somehow interruted. Therefore the backup pilot at the 35MHz
126
	control can pass the control to the pilot with the Wiimote via his "external
126
	control can pass the control to the pilot with the Wiimote via his "external
127
	control" switch. If he feels that the Quadro is out of control or the 
127
	control" switch. If he feels that the Quadro is out of control or the 
128
	connection is interrupted he just flips the switch back, gets control himself
128
	connection is interrupted he just flips the switch back, gets control himself
129
	again and can rescue the poor -out of control- MikroKopter ;)
129
	again and can rescue the poor -out of control- MikroKopter ;)
130
 
130
 
131
Flight:
131
Flight:
132
1.	Turn your MikroKopter and your normal remote on. Make sure everything is 
132
1.	Turn your MikroKopter and your normal remote on. Make sure everything is 
133
	running perfectly (perhaps do a "normal" test flight to check everything's ok)
133
	running perfectly (perhaps do a "normal" test flight to check everything's ok)
134
2.	Establish the wireless UART connection to your Mikrokopter with your
134
2.	Establish the wireless UART connection to your Mikrokopter with your
135
	Bluetooth stack. The BT stack should assign a windows COM Port to the 
135
	Bluetooth stack. The BT stack should assign a windows COM Port to the 
136
	established connection, so you can access it (make sure Serial Port Service
136
	established connection, so you can access it (make sure Serial Port Service
137
	is running). You need to remember the NUMBER OF THE COM PORT, e.g COM4. 
137
	is running). You need to remember the NUMBER OF THE COM PORT, e.g COM4. 
138
	So you established the link to your MK. 
138
	So you established the link to your MK. 
139
3.	Next establish the connection to the Wiimote:
139
3.	Next establish the connection to the Wiimote:
140
	- Press both, the 1 and 2 Button at the same time. All the 4 LEDs should be
140
	- Press both, the 1 and 2 Button at the same time. All the 4 LEDs should be
141
	blinking now. Your wiimote is now in "discovery mode", which means it is
141
	blinking now. Your wiimote is now in "discovery mode", which means it is
142
	searching for a little Nintendo Wii to pair with it. 
142
	searching for a little Nintendo Wii to pair with it. 
143
	- Now we are (or our BT stack is) the Wii: While the wiimote is in discovery
143
	- Now we are (or our BT stack is) the Wii: While the wiimote is in discovery
144
	mode search for devices in your BT stack program. You should find the wiimote
144
	mode search for devices in your BT stack program. You should find the wiimote
145
	now. Do NOT pair with it. Rather search for services the wiimote offers.
145
	now. Do NOT pair with it. Rather search for services the wiimote offers.
146
	This should bring up the HID (Human Interface Device) service offer. 
146
	This should bring up the HID (Human Interface Device) service offer. 
147
	Check that the wiimote is still in discovery mode (only 30 seks active) and
147
	Check that the wiimote is still in discovery mode (only 30 seks active) and
148
	activate the HID service. You should now be connected with the wiimote and
148
	activate the HID service. You should now be connected with the wiimote and
149
	the 4 leds of the wiimote should still blink but shouldn't stop blinking
149
	the 4 leds of the wiimote should still blink but shouldn't stop blinking
150
	anymore. 
150
	anymore. 
151
4.	So the BT stack is now connected to both, the Wiimote and the MK (BT can 
151
4.	So the BT stack is now connected to both, the Wiimote and the MK (BT can 
152
	connect up to 7 devices at a time). Now start the MoteCtrl.exe via a
152
	connect up to 7 devices at a time). Now start the MoteCtrl.exe via a
153
	windows commandline. Make sure you put the wiiuse.dll in the same folder
153
	windows commandline. Make sure you put the wiiuse.dll in the same folder
154
	like MoteCtrl.exe, otherwise the program will return immediatly without 
154
	like MoteCtrl.exe, otherwise the program will return immediatly without 
155
	an error message (and you think huh?). 
155
	an error message (and you think huh?). 
156
5.	Next you should be asked for your COM Port number, which is linked to your MK. 
156
5.	Next you should be asked for your COM Port number, which is linked to your MK. 
157
	Type in the number, hit enter. 
157
	Type in the number, hit enter. 
158
6.	Next is the Wiimote initalizaition. If you your HID service is running every-
158
6.	Next is the Wiimote initalizaition. If you your HID service is running every-
159
	thing should be fine now and MoteCtrl connects to it. 
159
	thing should be fine now and MoteCtrl connects to it. 
160
7.	Your Wiimote should rumble now for a sek and the LEDs should have stopped
160
7.	Your Wiimote should rumble now for a sek and the LEDs should have stopped
161
	blinking (now only LED 1 is permanently on).
161
	blinking (now only LED 1 is permanently on).
162
	--> This tells you, that MoteCtrl established the connection to the
162
	--> This tells you, that MoteCtrl established the connection to the
163
	Wiimote successfully. 
163
	Wiimote successfully. 
164
8.	You should now see the DEBUG Output scrolling down your terminal screen. 
164
8.	You should now see the DEBUG Output scrolling down your terminal screen. 
165
9.	First familiarize yourself with the new Wiimote's and Nunchuck's controls,
165
9.	First familiarize yourself with the new Wiimote's and Nunchuck's controls,
166
	with the engines of the MK deactivated. Watch the Debug output changing 
166
	with the engines of the MK deactivated. Watch the Debug output changing 
167
	its values while you play with the Wiimote & Nunchuck. 
167
	its values while you play with the Wiimote & Nunchuck. 
168
	For Controls, see the chapter =Controls=. 
168
	For Controls, see the chapter =Controls=. 
169
10.	Flight: Your MAX GAS is always limited by the gas value, which is set at
169
10.	Flight: Your MAX GAS is always limited by the gas value, which is set at
170
	the backup pilot's 35MHz remote. So the backup pilot "gives you a limit"
170
	the backup pilot's 35MHz remote. So the backup pilot "gives you a limit"
171
	of the GAS value.
171
	of the GAS value.
172
	The backup pilot can now pass the control up to you by using his 
172
	The backup pilot can now pass the control up to you by using his 
173
	"External Control" switch ;)
173
	"External Control" switch ;)
174
	
174
	
175
	
175
	
176
== 6. Useful Tips & Practical Experiences ======================================
176
== 6. Useful Tips & Practical Experiences ======================================
177
 
177
 
178
- It happens often hat the connection to the Wiimote or the MK can't be 
178
- It happens often hat the connection to the Wiimote or the MK can't be 
179
  established with your bt stack. Just disconnect everything then and try to
179
  established with your bt stack. Just disconnect everything then and try to
180
  reconnect all the devices.
180
  reconnect all the devices.
181
- While paring your MK's bluetooth with the one of your laptop place the
181
- While paring your MK's bluetooth with the one of your laptop place the
182
  MK text to your laptop. Bluetooth has a very limited range. 
182
  MK text to your laptop. Bluetooth has a very limited range. 
183
- The Bluettoth's range is very limited. Don't fly far away from your MK! This
183
- The Bluettoth's range is very limited. Don't fly far away from your MK! This
184
  will definitely interrupt or cancel your connection (at least your backup 
184
  will definitely interrupt or cancel your connection (at least your backup 
185
  pilot will have a bit of fun then ;)
185
  pilot will have a bit of fun then ;)
186
- Don't go far away from your laptop with you wiimote in hand. Same like above.
186
- Don't go far away from your laptop with you wiimote in hand. Same like above.
187
 
187
 
188
 
188
 
189
--EOF 26th of December 2008, Andreas Benzin
189
--EOF 26th of December 2008, Andreas Benzin