Go to most recent revision | Blame | Last modification | View Log | RSS feed
/* ============================================================================* v0.1** *****MoteCtrl****** written by AndreasB (aka Alpin)** lets you control your MikroKopter with a Wiimote!*** Copyright December 2008** #Credits & Thx:* - Holger & Ingo for the MikroKopter Project (www.mikrokopter.de)* - ExternalControl implementation of the FlightControl* - Ligi for RIDDIM, proof of external control concept* - Documentation of the MK's SerialProtocol (www.mikrokopter.de/ucwiki/en/SerialProtocol)* - Michael Laforest for the wiiuse API** #WEBSITE: http://www.mikrokopter.de/ucwiki/en/MoteCtrl** *****Use at your own risk! No warranty. Only for private usage.******* #LICENSE: Released under the GNU General Public License Version 2 or* (at your option) a later version of this license.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.* For further details see <www.gnu.org/licenses/>.** #DISCLAIMER: Use this project at your own risk!* No warrenty.* Only for private usage.** ============================================================================*/***** Table of Contents *****1. Description2. What you need3. Short checklist4. Controls5. Usage of MoteCtrl - Step by Step6. Useful Tips & Practical Experiences== 1. Description ==============================================================MoteCtrl is a small terminal-based programm, which acts as aninterface to the Wiimote and the MikroKopter platform.The MikroKopter is usually controlled by a normal 35MHz remote control.However, the FlightControl software also allows you to control your MikroKopterwith a so called ExternControl struct, which is send via the serialcommunications line.MoteCtrl.exe, running on your windows pc, exactly does this. It captures theWiimote's and Nunchuck's (extension to the wiimote) data and transfers it to theFlightCtrl.== 2. What you need ============================================================- MikroKopter with at least FlightCtrl firmware version 0.71h running- wireless serial communication to the FilghtCtrl via Bluetooth(I use the F2M03GXA Bluetooth modul, with the wireless UART service activated,see <http://www.mikrokopter.de/ucwiki/F2M03GXA> for more information)- Wiimote with Nunchuck extension- Laptop running windows xp- Bluetooth-dongle or build-in bluetooth communications in your laptop- Since I use the wiiuse lib v0.12 to connect to the Wiimote, your bluetoothstack should be compatible with the wiiuse libOn their page wiiuse.org they say, they successfully tested wiiuse withBlueSoleil, Windows XP SP2 stack and Widcomm(my BT-dongle uses the BlueSoleil stack and it works fine)- Backup Pilot at the 35MHz Remote Control (see =Usage=)- MoteCtrl.exe along with the wiiuse.dll file (both in one folder)== 3. Short Checklist ===========================================================(for more detailed step by step instructions, see =Usage of MoteCtrl=)-MK ready?, ExternalControl switch assigned?, Backup pilot ready?-Nunchuck plugged in to Wiimote? (software check does not work yet, seems to bea bug in the wiiuse API)-BT connections to Wiimote (HID service running) and MikroKopter (Serial PortService running) established?== 4. Controls ================================================================GAS: Controlled by the two buttons on the Nunchuck extension ('c' and 'z').Press 'c' = Increment(++) gas value by 1Press 'z' = Decrement(--) gas value by 1YAW(GIER): Controlled by the Nunchuck's joystick.Pressed to the right half = yaw to the rightPressed to the left half = yaw to the leftThe more you push the joystick to one of the two directions, theMK yaws faster.NICK(PITCH): Controlled by the Wiimote's pitch-tilt.Tilting your Wiimote to the left means, tilting the Quadro left.To the right accordingly.ROLL: Controlled by the Wiimote's roll-tilt.Same like with pitch.SPECIAL: You can reset the GAS value immediatly to ZERO (==no gas!!) with theHOME-Button. Be carefull with that!== 5. Usage of MoteCtrl - Step by Step =========================================Preparations:1. Make sure your all the items listed under "What you need" work2. To allow external control you have to allocate a switch of your normal35MHz RemoteCtrl to the "External Control" variable in the MikroKopter-Tool.You should find this option in the MK Tool -> Configuration/SettingsExplanation:Your normal Remote Control is always used as a backup device, in case theoperator at the Wiimote looses control of the Quadrokopter or the Bluetoothconnection is somehow interruted. Therefore the backup pilot at the 35MHzcontrol can pass the control to the pilot with the Wiimote via his "externalcontrol" switch. If he feels that the Quadro is out of control or theconnection is interrupted he just flips the switch back, gets control himselfagain and can rescue the poor -out of control- MikroKopter ;)Flight:1. Turn your MikroKopter and your normal remote on. Make sure everything isrunning perfectly (perhaps do a "normal" test flight to check everything's ok)2. Establish the wireless UART connection to your Mikrokopter with yourBluetooth stack. The BT stack should assign a windows COM Port to theestablished connection, so you can access it (make sure Serial Port Serviceis running). You need to remember the NUMBER OF THE COM PORT, e.g COM4.So you established the link to your MK.3. Next establish the connection to the Wiimote:- Press both, the 1 and 2 Button at the same time. All the 4 LEDs should beblinking now. Your wiimote is now in "discovery mode", which means it issearching for a little Nintendo Wii to pair with it.- Now we are (or our BT stack is) the Wii: While the wiimote is in discoverymode search for devices in your BT stack program. You should find the wiimotenow. Do NOT pair with it. Rather search for services the wiimote offers.This should bring up the HID (Human Interface Device) service offer.Check that the wiimote is still in discovery mode (only 30 seks active) andactivate the HID service. You should now be connected with the wiimote andthe 4 leds of the wiimote should still blink but shouldn't stop blinkinganymore.4. So the BT stack is now connected to both, the Wiimote and the MK (BT canconnect up to 7 devices at a time). Now start the MoteCtrl.exe via awindows commandline. Make sure you put the wiiuse.dll in the same folderlike MoteCtrl.exe, otherwise the program will return immediatly withoutan error message (and you think huh?).5. Next you should be asked for your COM Port number, which is linked to your MK.Type in the number, hit enter.6. Next is the Wiimote initalizaition. If you your HID service is running every-thing should be fine now and MoteCtrl connects to it.7. Your Wiimote should rumble now for a sek and the LEDs should have stoppedblinking (now only LED 1 is permanently on).--> This tells you, that MoteCtrl established the connection to theWiimote successfully.8. You should now see the DEBUG Output scrolling down your terminal screen.9. First familiarize yourself with the new Wiimote's and Nunchuck's controls,with the engines of the MK deactivated. Watch the Debug output changingits values while you play with the Wiimote & Nunchuck.For Controls, see the chapter =Controls=.10. Flight: Your MAX GAS is always limited by the gas value, which is set atthe backup pilot's 35MHz remote. So the backup pilot "gives you a limit"of the GAS value.The backup pilot can now pass the control up to you by using his"External Control" switch ;)== 6. Useful Tips & Practical Experiences ======================================- It happens often hat the connection to the Wiimote or the MK can't beestablished with your bt stack. Just disconnect everything then and try toreconnect all the devices.- While paring your MK's bluetooth with the one of your laptop place theMK text to your laptop. Bluetooth has a very limited range.- The Bluettoth's range is very limited. Don't fly far away from your MK! Thiswill definitely interrupt or cancel your connection (at least your backuppilot will have a bit of fun then ;)- Don't go far away from your laptop with you wiimote in hand. Same like above.--EOF 26th of December 2008, Andreas Benzin