 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
BlackFrog
Joined: 03 Dec 2006 Posts: 6
Digg It |
Posted: Tue Dec 05, 2006 5:38 pm Post subject: wiimote IR data from glovepie |
|
|
So we've determined dotJvis is True when you can see that dot, false when you cannot.
dotJx and dotJy will give you values between 0 and 1023
dotJsize gives you 6 when very close to sensorbar (1 foot away) and 1 when far away (8 feet maybe?)
dot1 and dot2 work with the wii sensorbar, dot3 and dot4 always show up as vis=false and x and y set to 1023
dot1x will cycle thru 0-1023 then wrap around the 0 again go to 1023 and do this twice more as you point the controller form the far left edge to teh far right edge. This suggests some sort of 4 block grid along the x axis.
dot1y is similar in except the grid size is only 3. Also cycles thro 0 to 1023, but only 3 times from top to bottom
dot2x and dot2y behave the same except have slightly different values than dot1x and dot1y. heres a sample when the wiimote is sittin on my desk pointed at the sensorbar: d1x=627 d2x=558 d1y=74 d2y=118
heres the code i tried to make it navigate the grid system which didn't quite work
| Code: |
// first try at IR reading/displaying correctly...doesnt work tho/
// using glovepie 0.23
// x is backwards x.x
// blackfrog :D
debug = "d1x="+wiimote.dot1x+" d2x="+wiimote.dot2x+" d3x="+wiimote.dot3x+" d1y="+wiimote.dot1y+" dot2y="+wiimote.dot2y+" d3y="+wiimote.dot3y
var.gridthreshx= 800
var.gridthreshy= 800
// calibrate offscreen in the topleft corner by pressing A
if wiimote.A then
var.gridx= 0
var.gridy= 0
var.oldy=0
var.oldx=0
endif
var.x = wiimote.dot1x
var.deltax= var.x-var.oldx
var.oldx= var.x
var.y= wiimote.dot1y
var.deltay= var.y-var.oldy
var.oldy=var.y
if var.deltax < -var.gridthreshx then
var.deltax = var.deltax+ 1024
endif
if var.deltax> var.gridthreshx then
var.deltax= var.deltax- 1024
endif
if var.deltay<-var.gridthreshy then
var.deltay=var.deltay+1024
endif
if var.deltay>var.gridthreshy then
var.deltay=var.deltay-1024
endif
mouse.cursorposx = mouse.cursorposx + (var.deltax/1024)*screen.DesktopRight
mouse.cursorposy = mouse.cursorposy+ (var.deltay/1024)*screen.DesktopBottom
|
also check out another video i made of playing half-life 2 using just the accelerometers at http://www.youtube.com/watch?v=asY_I8y6C0M
phew! |
|
| Back to top |
|
 |
BlackFrog
Joined: 03 Dec 2006 Posts: 6
Digg It |
Posted: Tue Dec 05, 2006 5:52 pm Post subject: |
|
|
Okay figured out that InByte8 will give you a decimal value from 0-255 (255 when the contorller isn't pointe at the sensorbar) that tells you the grid you're in
heres the chart
50, 34, 18, 2,
114, 98, 82, 66,
178, 162, 146, 130,
topleft corner is 50, topright is 2, bottomleft is 178, bottomright is 130
woot |
|
| Back to top |
|
 |
BlackFrog
Joined: 03 Dec 2006 Posts: 6
Digg It |
Posted: Tue Dec 05, 2006 6:03 pm Post subject: |
|
|
// second try at IR reading/displaying correctly...doesnt work tho agian/
// using glovepie 0.23
// x is backwards x.x
// kinda works but doesnt :/
// blackfrog
debug = "d1x="+wiimote.dot1x+" d2x="+wiimote.dot2x+" d1y="+wiimote.dot1y+" dot2y="+wiimote.dot2y+" inbyte8="+Wiimote.InByte8
if wiimote.inbyte8 = 50 then
//0,0
var.x= wiimote.dot1x
var.y= wiimote.dot1y
endif
if wiimote.inbyte8 = 34 then
//1,0
var.x= wiimote.dot1x+1024
var.y= wiimote.dot1y
endif
if wiimote.inbyte8 = 18 then
//2,0
var.x= wiimote.dot1x+2048
var.y= wiimote.dot1y
endif
if wiimote.inbyte8 = 2 then
//3,0
var.x= wiimote.dot1x+3072
var.y= wiimote.dot1y
endif
if wiimote.inbyte8 = 114 then
//0,1
var.x= wiimote.dot1x
var.y= wiimote.dot1y+1024
endif
if wiimote.inbyte8 = 98 then
//1,1
var.x= wiimote.dot1x+1024
var.y= wiimote.dot1y+1024
endif
if wiimote.inbyte8 = 82 then
//2,1
var.x= wiimote.dot1x+2048
var.y= wiimote.dot1y+1024
endif
if wiimote.inbyte8 = 66 then
//3,1
var.x= wiimote.dot1x+3072
var.y= wiimote.dot1y+1024
endif
if wiimote.inbyte8 = 178 then
//0,2
var.x= wiimote.dot1x
var.y= wiimote.dot1y+2048
endif
if wiimote.inbyte8 = 162 then
//1,2
var.x= wiimote.dot1x+1024
var.y= wiimote.dot1y+2048
endif
if wiimote.inbyte8 = 146 then
//2,2
var.x= wiimote.dot1x+2048
var.y= wiimote.dot1y+2048
endif
if wiimote.inbyte8 = 130 then
//3,2
var.x= wiimote.dot1x+3072
var.y= wiimote.dot1y+2048
endif
// phew
mouse.cursorposx= (var.x/4096)*screen.DesktopRight
mouse.cursorposy= (var.y/3072)*screen.desktopBottom |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Tue Dec 05, 2006 10:07 pm Post subject: |
|
|
| So are you saying GlovePIE 0.23 works???? |
|
| Back to top |
|
 |
Kasten
Joined: 03 Dec 2006 Posts: 14
Digg It |
Posted: Tue Dec 05, 2006 10:15 pm Post subject: |
|
|
| Wait WTF CarlKenner the person who made glovePIE says .23 doesn't work? But blackfrog said it did work? |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Tue Dec 05, 2006 10:22 pm Post subject: |
|
|
I guess 0.23 works for some people and not others. Probably due to my technique for filtering out the fake wiimotes that forced people to use wiimote2 instead of wiimote in TestPIE. Or possibly due to the Wiimote initialization code failing intermittently (perhaps it needs delays?).
It looks like the specs on the wiki are wrong. I'll change them to indicate that byte 8 of the report payload contains the MSB rather than the LSB.
In the mean time, try this code:
var.dot1x = wiimote.InByte6 + ((wiimote.InByte8 & 4 shl 4)
var.dot1y = wiimote.InByte7 + ((wiimote.InByte8 & 192) shl 2)
var.dot2x = wiimote.InByte8 + ((wiimote.InByte10 & 4 shl 4)
etc.
I'll just update the Wiki, and hopefully fix it in the next version. |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Mon Dec 11, 2006 3:22 am Post subject: |
|
|
| Try 0.24 now. It should fix these problems, and make wiimote.dot1x and wiimote.dot1y work perfectly. |
|
| 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
|