LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a wiimote with LabVIEW

Hi Kovacs,

 

A great tutorial to look at is the Learn LabVIEW in 3 Hours, found here:

 

http://www.ni.com/academic/labview_training/ 

 

It looks like you could use the Simple Polled Acquisition (IR) Example as a starting point.  It polls the accelerometer data every 100 ms and you could use this to graph and log the data.

0 Kudos
Message 101 of 220
(3,354 Views)

Thank you, Kyle.

 

Learn it in 3 hours.. sounds promising, heh.

 

I'll start with the example you mentioned then, but I was curious if there's a huge difference between the "polled" and the "event" ones?

0 Kudos
Message 102 of 220
(3,331 Views)

The polled examples rely on a loop that periodically checks for new information / changes from the Wiimote, while the event driven examples rely on the driver to notify the code that there is new info / changes from the wiimote.

 

  • The Event driven code may be more efficient and capable of higher sampling rates, in that your code isn't waisting cycles looking for changes / new info from the wiimote.  In addition, the event driven code is less likely to miss new information / changes from the wiimote.
  • The polled code is arguably more straightforward / easier to understand, especially for the new LabVIEW user. 
Sam Shearman
0 Kudos
Message 103 of 220
(3,305 Views)

I am using LabView 8.0. I can only read the bottons of the wii remote. Can anyone help me understanding wy I can't read the accelerometer and the IR?

 

Thanks,

 Andrew

0 Kudos
Message 104 of 220
(3,270 Views)

Things are going more and more strange...

I am using LabView 8.0, a Samsung minidesktop with embedded bluetooth-widcomm...

At first time I could read the wii-remote buttons but not the accelerometer and the IR.

I have updated the widcomm software to 5.0.... impossible to get pairing because the new version does not permit to skip the security code...

I have installed blusoleil and it works perfectly with wiinremote... but now I can't read anything from thw wii-remote with Labview...

Any suggestion?

 

Thanks,

 Andrew

0 Kudos
Message 105 of 220
(3,231 Views)

....now I am trying to start from the low level following the details described in http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx

 

 

I am still at the beginning because the setupai.dll_stetupdienumdeviceinterface gives a 0 value in return parameter (meaning not succesful) and does not return information on any device.

 

I have attached the vi if someone would help me to understand the problem and to go forward....

 

Andrew

0 Kudos
Message 106 of 220
(3,215 Views)

Hi glogloglo,

 

What happens when you use the WiimoteTest.exe?  I believe it's not written using LabVIEW, so you can test the Wiimote connection. 

0 Kudos
Message 107 of 220
(3,179 Views)

Dear Kyle ST,

 thank you for the suggestion. I have resolved by reactivating the Microsoft bluetooth stack. Now the .vi library works cery well.

But here is anothe issue:

I have read that the wiimote shoud send data at 100Hz, but it seems to me that some samples are read twice and some are missing, so the actual number of real samples that I receive in a while loop is about 80/sec. Could you help me understanding why? I guess that it could be due to how the hidD_GetInputReport works?

 

Thank you,

 Andrew

0 Kudos
Message 108 of 220
(3,156 Views)

Hi Andrew,

 

How are you requesting the data?  If your while loop is running faster than the Wiimote can send data, you're probably seeing duplicate samples.  What is the code you are using?

0 Kudos
Message 109 of 220
(3,118 Views)

Dear Kyle,

 thank you again for your suggestion. I have found on the microsoft web site that the hidd_getreport (used in the .vi posted on the beginning of this tread) is not the best chioce to acquire data over time because indeed it can lost data!

The best chioce is to use the kernel32_readfile function that works with buffering capability. The trick is to use a read buffer with a dimension that is a multiple of 22 (the basic report sent by the wiimote). I have successfuly used an initialized array of dimension 17x22 to pass to the kernel32_readfile function; this permits to acquire data at 100samples/sec without any lost.

 

I post the library that I have modified and an example to whom it may concern.

 

Best regard,

 Andrew

Message 110 of 220
(3,092 Views)