 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sun Dec 03, 2006 1:40 am Post subject: |
|
|
I made it without a Wiimote by looking at this site's description of which HID reports did what, and by making sure my code could read HID reports from other HID devices I did have like a P5 (they aren't bluetooth though).
To set the LEDs with this you set Wiimote.leds to a number between 0 and 15, which is every possible combination of the four leds. I probably should have made it four seperate values, one for each LED, but I was lazy. Is it working how it is? And does the rumble feature work?
Hmm.. I'm not sure why it isn't picking up the remote a second time after you press stop. I'll have to try that with other HID devices and see if the same thing happens. Also that bug will probably stop the GUI's detect input feature from working more than once, and stop the program from working after you use detect input in the GUI.
a) Could I write better documentation?
Eventually I'll get around to it. But writing documentation is a pain in the neck. The current documentation is out of date, and missing lots of stuff. This program has a LOT of features to document.
However the GUI is becoming more and more user friendly, which works fine for simple scripts. In theory the GUI lets you click on an output (like the Enter key), then click on an input (like the B button on the wiimote), then click apply to add that mapping to your script, and repeat. But the bug mentioned here might stop that from working for the wiimote.
For the scripting, basically anything that works in C, Pascal, BASIC or Java should work. Have a look at some of the included scripts for more examples.
b) I could add the rotation functionality, but it requires a calibration step, which doesn't really fit with the current user interface. I may add calibration to the CP Settings menu and save it in a file somewhere.
Currently all it does with the acceleration readings is convert them to the range -128 to 128, and to the DirectX coordinate space. But you can write your own scripts in it to use the formulas you described.
In the long run I want to get position and orientation calculated, which means integrating the acceleration.
c) The nunchuck and classic controller can be detected, but when they are plugged in it stops sending values. Use Wiimote.HasNunchuck and Wiimote.HasClassic to tell if they are plugged in. I posted some suggestions people might try, like sending 12H or 15H reports, on the wiki, but I don't know if anyone has tried.
Getting it to work requires the following steps:
1. Extract the zip file to a new directory.
2. Unplug the nunchuck and classic controller, they stop it from working.
3. Work out some way of getting the Wiimote to pair with the PC. I'm hoping it is plug and play once you hold down the 1+2 buttons, or the Sync button, but you may need some bluetooth software to do it. It shouldn't be too hard, there are instructions around on the web. Pairing will make it register as a HID device, but not one that works with DirectInput.
4. Run the GlovePIE.exe file you extracted.
5. Choose File > Open from the GlovePIE menu, and load the TestWiimote.PIE file.
6. Press the Run button. The title bar should say "[Running]", the Run button should change to a stop button, and the "debug" box should appear next to the stop button.
7. Move the Wiimote around and see if the values in the debug box change. They should be horizontal, vertical, and forwards-backwards movement in that order. Gravity also affects them.
8. Go to any program (notepad will work) and try pressing the buttons on the Wiimote. They should emulate the appropriate keys on the keyboard.
9. When you have finished, click the Stop button in GlovePIE. Apparently there is a bug so you have to exit and restart GlovePIE before running the script a second time will work. I don't know why.
When you have that part working, you can move on to more complicated things with these additional steps:
10. If everything is working, try editing the script to change what keys are triggered by what buttons. You can also edit it by changing to the GUI tab. The detect input button may not work for the Wiimote more than once due to the bug.
11. Try emulating the mouse with lines like this:
Mouse.LeftButton = Wiimote.A
Dec(mouse.DInputY, 20) = Wiimote.RawForceZ > 5
Inc(mouse.DInputY, 20) = Wiimote.RawForceZ < -5
But changing the 5 at the end to whatever the RawForceZ becomes when you tilt the remote up and down.
12. Download and install PPJoy.
13. Read the html file that comes with GlovePIE for instructions about setting up PPJoy to add a Virtual Joystick device. It is a bit confusing at first, but once set up it is easy enough to use in GlovePIE.
14. Try emulating a joystick/gamepad with lines like this:
ppjoy.digital0 = wiimote.A
ppjoy.digital1 = wiimote.B
ppjoy.digital2 = wiimote.One
ppjoy.analog0 = MapRange(Wiimote.RawForceX, -20,20, -1,1)
ppjoy.analog1 = Int(Wiimote.Down) - Int(Wiimote.Up)
15. Use the game controllers control panel to test it.
16. Read the other included samples, or the documentation, for more ideas about what you can do with GlovePIE.
17. Make sure you have Microsoft's speech recogniser installed in the speech control panel. If not, download it from the links in the readme file or website.
18. Do one or two training exercises in the speech recogniser.
19. Add lines like this to your GlovePIE script so that you can use voice recognition (you will need a microphone, the Wiimote doesn't have one):
Enter = said("jump")
One = said("fists")
Two = said("shot gun")
I know voice recognition has nothing to do with the Wiimote, but it is cool! Especially when you don't want to take your hands off the wiimote to do complex keyboard controls.
By the way, you need at least Windows 2000 for the keyboard emulation to work in DirectInput games.
GlovePIE also supports many other 6DOF tracking devices: TrackIR, Z800 visor, polhemus, intersense, flock of birds, worldviz ppt, Essential Reality P5 Glove, etc. As well as gloves like FakeSpace pinch gloves, and the 5DT Data Glove. And other things like MIDI devices or rowing machines. Half of them haven't been tested though. |
|
| Back to top |
|
 |
Jephthah
Joined: 29 Nov 2006 Posts: 16
Digg It |
Posted: Sun Dec 03, 2006 1:50 am Post subject: |
|
|
For some reason, my RawForce outputs are constantly 128,-128,128....
ideas? Also, the LED's don't change from all four consistently blinking, as when its normally paired... |
|
| Back to top |
|
 |
andy753421 Site Admin
Joined: 22 Nov 2006 Posts: 21
Digg It |
Posted: Sun Dec 03, 2006 2:33 am Post subject: |
|
|
| Any chance we could get a look at the source code? |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sun Dec 03, 2006 2:52 am Post subject: |
|
|
| The source is in Delphi, and it makes use of Delphi components to do what it already says how to do on the wiki, so I don't think the source code would help much for anyone wanting to port it to Linux. Also emulating keys and joysticks and things like that are very different between platforms. And the code is a huge mess. |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sun Dec 03, 2006 3:00 am Post subject: |
|
|
| Jephthah wrote: | For some reason, my RawForce outputs are constantly 128,-128,128....
ideas? Also, the LED's don't change from all four consistently blinking, as when its normally paired... |
RawForce outputs of 128,-128,128 mean it has detected your Wiimote and tried to tell it to output the forces, but for some reason it is receiving only zeroes, or not receiving anything. LEDs that won't change also means that the outputs it is sending to the Wiimote aren't working.
Did you plug in your nunchuck or classic controller since you paired your Wiimote with your PC? If so, it stops it from sending any outputs, even after you unplug the attachment again. Some people have suggesting the way to fix that is by taking the batteries out and putting them back, although there may be an easier way of unpairing and then pairing again. |
|
| Back to top |
|
 |
Jephthah
Joined: 29 Nov 2006 Posts: 16
Digg It |
Posted: Sun Dec 03, 2006 3:03 am Post subject: |
|
|
| Quote: |
RawForce outputs of 128,-128,128 mean it has detected your Wiimote and tried to tell it to output the forces, but for some reason it is receiving only zeroes, or not receiving anything. LEDs that won't change also means that the outputs it is sending to the Wiimote aren't working.
Did you plug in your nunchuck or classic controller since you paired your Wiimote with your PC? If so, it stops it from sending any outputs, even after you unplug the attachment again. Some people have suggesting the way to fix that is by taking the batteries out and putting them back, although there may be an easier way of unpairing and then pairing again.
|
I don't own a nunchuck or classic. I'm pairing the wiimote, starting the program, running the script, that's it
.
Could the accelerometer be broken? |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sun Dec 03, 2006 3:08 am Post subject: |
|
|
| Jephthah wrote: | | Quote: |
RawForce outputs of 128,-128,128 mean it has detected your Wiimote and tried to tell it to output the forces, but for some reason it is receiving only zeroes, or not receiving anything. LEDs that won't change also means that the outputs it is sending to the Wiimote aren't working.
Did you plug in your nunchuck or classic controller since you paired your Wiimote with your PC? If so, it stops it from sending any outputs, even after you unplug the attachment again. Some people have suggesting the way to fix that is by taking the batteries out and putting them back, although there may be an easier way of unpairing and then pairing again.
|
I don't own a nunchuck or classic. I'm pairing the wiimote, starting the program, running the script, that's it
.
Could the accelerometer be broken? |
Darn. um... I doubt the acclerometer is broken. Hmmm... I'm stumped for the moment, I just used up all my ideas.
Have you tried restarting GlovePIE rather than just pressing stop and then run a second time? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|