LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a wiimote with LabVIEW

 Yes, those exact examples gave me the idea that calculating yaw might just be around the corner.

 I had a hard time finding the formula though, but with someone giving me the code-

 

float calc_yaw(struct ir_t* ir) { float x; x = ir->ax - 512; x *= WIIMOTE_FOV_COEFFICIENT / 512.0; return RAD_TO_DEGREE( atanf(x) ); }

 -along with a good explanation (since I can hardly read code) I managed to put this into LabVIEW.. I even got the 3D graph to work with it.

 

 

 Here's what it looks like:

 

 

I had to divide the yaw data by 50 (which was chosen arbitrarily really) so the 3D graph would respond more accurately.

It's a bit messy I know.. but does it look okay?

 

I've attached the vi in case of interest.

0 Kudos
Message 131 of 220
(4,231 Views)

 I found an article which explains how to acquire the 3D position of the wiimote using only a 2 LED (sensor) bar.

 

z-distance (distance between wiimote and LEDs) =

ledDistanceInMM

------------------------------------------------

2 × tan (angle) × screenHeightInMM

 

angle =

radiansPerPixel × pointDist

------------------------------------

2

 

x-distance = sin (radiansPerPixel × (avgX 0.5 × screenWidthInPixels))×z-distance

 

relativeVerticalAngle = (avgY 0.5 × screenHeightInPixels) × radiansPerPixel

 

 

y-distance = 0.5 sin (relativeVerticalAngle + cameraVerticalAngle) × z-distance

 

(If the sensor bar was placed above the screen it would have been +0.5 instead of -0.5)

 

Message Edited by Kovacs on 02-20-2010 09:27 AM
Message Edited by Kovacs on 02-20-2010 09:35 AM
0 Kudos
Message 132 of 220
(4,164 Views)

As you can see I tried to recreate these formulas in LabVIEW:

 

 

The thing is, when I bring my wiimote closer to the screen, the values of x- and y-distance change along with it.. something tells me that isn't right.

I've attached the vi in in case of interest.

 

Interactive 3D Design Using Nintendo Wii Remote

(I tried to put this in one post, but I got >10000 characters errors.)
Message Edited by Kovacs on 02-20-2010 09:34 AM
0 Kudos
Message 133 of 220
(4,160 Views)

Why in your calculation for Z distance do you have a calculation of 194 divided by the array?  Everything before that matches you typed in formula for Z distance, but I don't see a number divided by anything in that formula.

 

Never mind, I just realized your line of dashes is supposed to represent a division bar.  I thought it was just a separator between your different formulas.

Message Edited by Ravens Fan on 02-20-2010 10:53 AM
0 Kudos
Message 134 of 220
(4,146 Views)

Yeah that's right, didn't mean to confuse.

So for z-distance it looks like this:

 

194 (mm)

----------------

2 x tan (angle) x 327.3(mm)

 

Where angle is

 

((Pi/4) / 1024)× pointDist

--------------------------------

2

 

pointDist = Sqrt(dx * dx + dy * dy) 

 

dx = firstPoint.x - secondPoint.x

dy = firstPoint.y - secondPoint.y 

 

(I did some creative programming here I guess since I didn't have the second points, but I did have the Midpoints. So I subtracted the Midpoints from the First points, multiplied the answers by 2 and then squared those numbers.)

Message Edited by Kovacs on 02-21-2010 08:56 AM
0 Kudos
Message 135 of 220
(4,123 Views)
Using Johanns or Shearman's VI, is there a way to change the sensitivity of the IR camera (threshold). Also is there a boolean data that sends info whether an IR is being detected or not?
0 Kudos
Message 136 of 220
(4,085 Views)

I'm trying to communicate with the Wiimote in LabVIEW 7.1 using this library:

http://wiimotelib.codeplex.com/releases/view/21997

 

When calling the property "WiimoteState" LabVIEW says that WiimoteState doesn't have any properties:

 

wiimote in labview 7.1.JPG 

Whem I'm doing exact the same in LabVIEW 8.6, I can see its properties. 

Am I doing something wrong in LabView 7.1 or is it just not possible to use this dll in Labview 7.1? 

 

 

0 Kudos
Message 137 of 220
(4,046 Views)

Hello,

 

I wonder if this information applies to your situation: http://digital.ni.com/public.nsf/allkb/D71B8CC03F39872B862571060071130B?OpenDocument . Make sure that your conditions are met that are listed in that knowledgebase. It might also be useful to check the versions of the .NET framework that you have installed.

 

-Zach

0 Kudos
Message 138 of 220
(4,022 Views)

Hi,

 

Does anyone know if it is possible to read the battery status of the wiimote using the VI's created by Sam Shearman?

0 Kudos
Message 139 of 220
(4,019 Views)

I believe I have been through all of them and I haven't found an application like that.

The WiimoteTest.exe file which is part of Brian Peek's library I think shows your battery status if that's any use to you.

0 Kudos
Message 140 of 220
(3,978 Views)