Blitz3D now can control a WiiMote! (I hope)

Blitz3D Forums/Blitz3D Programming/Blitz3D now can control a WiiMote! (I hope)

Charrua(Posted 2008) [#1]
That's my weekend work about WiiMote's

Hope some one found that interesting

First some .decls

file wii_kernel32.decls


file wii_hid.decls


file wii_setupapi.decls


and finally, one .bb: Wimote1.bb




Uncle(Posted 2008) [#2]
Cool, Ive been also wanting this for B3D so thanks for your effort. Unfortunately I can't test it until I back home in a few days. Have you managed to map all the features, including IR Dot Size?


Charrua(Posted 2008) [#3]
it's still in beta stage

only detect, read and write and in the example some way's to do some specific tasks: read buttons, set led's, read accel's etc.

Init IR, I saw is not easy, the rest seem's to be simple.

Feedback will be appreciated!

Juan


Panno(Posted 2008) [#4]
cool


Charrua(Posted 2009) [#5]
hi

time to update

now manages the IR dots (all three modes: basic, extenden and full)
now can set the IR sensibility
and some other details were added

still hope that this should be useful for someone!
part of this work is in spanish, sorry, request translation as needed.

have fun

the .decls are still the same as avobe

wii_lib.bb mus be included



and an example of usage: wiimote.bb:



ZJP(Posted 2009) [#6]
Yessss. Thx
Time to post here http://www.blitzbasic.com/Community/topics.php?forum=94 ;-)

JP


ZJP(Posted 2009) [#7]
Hi,

Have you got an example with the IR sensor?

JP


Charrua(Posted 2009) [#8]
hi

the wiimote has a camera that has some recogn software that detects up to 4 ir dots, it has an ir filter to block normal sun ligth but any strong light should make the software fail.
The wiimote only report the x,y position of the dots detected (if any) and some other information like size. It depend on the ir mode: Basic, extenden or full.

the sensor bar (bad name!) is not a sensor, it is composed of IR emiters (leds) that are seen by the wiimote camera (the real sensor!), knowing the position of the sensor bar and the distance between the 2 ir emiter that the sensor bar has and some trigonometric calculus and some asumptions and simplifications is it pósible to estimate the wiimote position in the 3d space, or at least to where is heading or facing....

i don't have a "sensor bar" i use ir emiters home made so i place each one where i want. To do so, you only have to get some ir leds (940 nm recommended) a battery and a resistor to limit the current throug the led.

if you want to make one, tell me and i post a simple diagram with some equations to get the value of the resistor and some precautions to not blow the led.

Juan


ZJP(Posted 2009) [#9]
Hi,
Thx. IR cam tested with GlovePIE. Can you post a Blitz3D example?

JP


Charrua(Posted 2009) [#10]
in the update (post #5), the second codebox has an example, on it, it show the status of the buttons, you could toggle the 4 leds with the number key 1..4 and turn off all with 5. Puls, read the accelerometers and rotate the blitz blue cube on the center of the screen acordingly and show (if any) the reported IR dots.

At initialization the code sets ir mode to extended and an intermediate sensibilit of the ir camera.

I'm having troubles to make the code work under Vista. Under xp i have no problems. Before run the app you have to connect the wiimote with BlueSolei or the bluetooth stack you use. But i supose you know how to do it if you are using GlobePie.

you have to constantly call Leer (read) and if Leer=True then you can call
EvaluoRecepcion (EvaluateReception) that routine set all the variables on the WiiMote variable (type Controller) so after calling EvaluoRecepcion you can use any variable inside WiiMote, particullary the fields P1, P2, P3 and P4 are type PuntoIR:

Type PuntoIR
Field x ; en el rango 0..1023
Field y ; en el rango 0..767
Field t ;Tamaño relevante si IRMode = Extended o Full, si -1 no detectado en todos los modos
;relevantes solo si IRMode = Full
Field i ;intensidad
Field xMax
Field xMin
Field yMax
Field yMin
Field Indice
End Type

the fields x,y are self explanatories (hope)
the field t = -1 signals ir dot not seen, but if it is 1 or more signal the size reported by the wiimote, the field i signals the intensity. xMax, etc are a rectangle that surounds the dot seeing by the camera and are reading only if the mode of operation is Full.

i have no code or equations for the sensor bar because first i don't have one, and second i don't need one. I'm working with four dots at the same time but not only 4 ir emiters, i'm switching on more than 4 dots (microcontroller based) and knowing wich are on at any time i can read and keep track of more than the four that read the camera. Of course time multiplexed so i have less samples per second of each dot. I know my app is particular so my interest in the sensor bar is 0. I use the wiimote only for the ir dots and to have a first tool to work on. In the middle proces i'been developing my own ir camera analyzing the video signal. The wiimote gives me the chance to test some code/hardware before my ir camera get's ready.

Juan


ZJP(Posted 2009) [#11]
Thx. I'm testing this. ;)

JP