 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
the-white_knight3
Joined: 27 Jan 2007 Posts: 31
Digg It |
Posted: Mon Jan 29, 2007 4:24 am Post subject: |
|
|
I haven't got any more ideas.... you could test to see if you could map it in GlovePIE quick easy interface, and see if that works, but I doubt it... GlovePIE shouldn't cause your keyboard not to work, unless you have forgotten to release a key. So maybe there is a keyboard, problem, you could try unistalling it and reinstalling, but I don't think that will likely fix the problem. My biggest guess is that your bot program and GlovePIE don't play well with each other when it comes to sharing some sort of keyboard control... whether it is your programs fault, or GlovePIE's or both, I dunno.
The only other advice I have, is to try one of the other programs for the wii remote. |
|
| Back to top |
|
 |
cheng
Joined: 27 Jan 2007 Posts: 33
Digg It |
Posted: Mon Jan 29, 2007 5:34 am Post subject: |
|
|
I think I might find the problem, here is what I have observed:
I am using java to control the robot, there are three types of key event that java can receive: keyPressed, keyReleased and keyTyped. There problem here is the keyReleased Event.
keyReleased - IF A KEY HAS BEEN PRESSED, THEN RELEASED, a keyReleased event will be generated.
I put a console output statement in the keyReleased event. When I run my code WITHOUT running GlovePIE, the keyReleased event only gets called when a key has been pressed down and then released.
However, when I turn on GlovePIE, the keyReleased event gets generated hundreds times a second even when a key is not pressed. So the problem here is, GlovePIE assumes all of the keys are released even when they haven't been pressed first.
How does that effect my code?
In my code, I wrote "when I pressed down the A key, keep turning the robot to the left untill I RELEASE the key." So when I release it, I set the movement to 0 which means stay at where you are and don't turn or walk.
If I turn on GlovePIE and run this code, then the A pressed event and A released event are generated at the same time which "cancel out on each other".
But the thing I don't understand is, why does the D key works but not the A??
Carl HELP!!!!!
Thank you white_knight3 again for keep helping me out!!!! |
|
| Back to top |
|
 |
cheng
Joined: 27 Jan 2007 Posts: 33
Digg It |
Posted: Mon Jan 29, 2007 5:40 am Post subject: |
|
|
I've just tried WiinRemote:
Both of the A and D key don't work, because the keyPressed Event is generated at the same time as the keyReleased Event. Although I can see a bunch of repeating As and Ds in my notepad, it doesn't work with my program.
So I guess different program has different ways of dealing with the "auto-repeat" and key released event. |
|
| Back to top |
|
 |
the-white_knight3
Joined: 27 Jan 2007 Posts: 31
Digg It |
Posted: Mon Jan 29, 2007 6:01 am Post subject: |
|
|
| Unfortunately I haven't messed around with the key events in java. I know key_pressed will return the int. But when the key is released, does key_pressed throw away the int? Or does it remember it? Cause if it throws it away you could forget the key_released and just use key_pressed in a while loop. |
|
| Back to top |
|
 |
cheng
Joined: 27 Jan 2007 Posts: 33
Digg It |
Posted: Mon Jan 29, 2007 6:09 am Post subject: |
|
|
the int? you mean the movement variable for controlling the robot?
I have to send this command to the robot through a wireless network, so when I press down A, my program send "turn 10 degrees to the left", if I release it, the program will send "stop turning".
I can definitely modify my program to only respond to the keyTyped event and just ignore the keyPressed and keyReleased event.
But maybe GlovePIE shoudn't treat all of the keys that haven't been pressed as "released" |
|
| Back to top |
|
 |
the-white_knight3
Joined: 27 Jan 2007 Posts: 31
Digg It |
Posted: Mon Jan 29, 2007 6:17 am Post subject: |
|
|
| Yes I agree with you there, but from appearance, it would seem the GlovePIE script just loops its progarm constantly, and it has auto release so that when lazy programs forget to release a key, GlovePIE will do it anyways. But maybe Carl has a control that shuts that off? He seem to have some sort of extra setting you can use for the mouse, how it is handled, so maybe he has the same thing for the keyboard. |
|
| 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
|