取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
101 条消息(共 220 条)
3,777 次查看

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 项奖励
102 条消息(共 220 条)
3,754 次查看

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 项奖励
103 条消息(共 220 条)
3,728 次查看

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 项奖励
104 条消息(共 220 条)
3,693 次查看

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 项奖励
105 条消息(共 220 条)
3,654 次查看

....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 项奖励
106 条消息(共 220 条)
3,638 次查看

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 项奖励
107 条消息(共 220 条)
3,602 次查看

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 项奖励
108 条消息(共 220 条)
3,579 次查看

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 项奖励
109 条消息(共 220 条)
3,541 次查看

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

110 条消息(共 220 条)
3,515 次查看