Giter VIP home page Giter VIP logo

wiimotelib's Introduction

Managed Library for Nintendo's Wiimote v1.7.0.0

by Brian Peek

A library for using a Nintendo Wii Remote (Wiimote) from .NET.

This project started life as an article for Microsoft's Coding4Fun website. A full set of API docs can be found in the release package.

Changes

v1.7.0.0

o Writing registers is now properly waiting for the Wiimote to reply
  before continuing...this removes all of the Thread.Sleep() calls and
  should *greatly* improve performance when setting LEDs and rumble
  (Serial Nightmare & wwibrew.org)
o Guitar Hero: World Tour Guitar and Drums now properly recognized and
  used (wiibrew.org, tested by Tyler Tolley and Mauro Milazzo)
o Guitar whammy bar is now a 5-bit value instead of 4 (wiibrew.org)
o Position of 4 IRs now properly reported in Basic reporting mode
  (Dan Carter)
o Found1/2 now properly reported in MSRS (reported by akka243)
o MSRS project updated to Microsoft Robotics Developer Studio 2008

v1.6.0.0

o Added "center of gravity" calculation to the Wii Fit Balance Board
  (thanks to Steven Battersby)
o Structs are now marked [Serializable] (suggested by Caio)
o Battery property is now a float containing the calculated percentage
  of battery remaining
o BatteryRaw is the byte value that used to be stored in the Battery
  property
o WiimoteTest app now reads extensions properly when inserted at startup
o Exposed HID device path in new HIDDevicePath property on Wiimote object
o Changed the time delay on writes to 50ms from 100ms...this should
  improve responsiveness of setting LEDs and rumble

v1.5.2.0

o Ok, Balance Board support is *really* fixed this time
  (thanks to Manuel Schroeder, Eduard Kujit and Alex Wilkinson for testing)
o LED checkboxes are properly set on the WiimoteTest tabs

v1.5.1.0

o Oops...a last minute change broke the one thing I was adding:  Balance
  Board support.  Should be working now...(identified by Manuel Schroeder)

v1.5.0.0

o Wii Fit Balance Board support
o The GetStatus() method now waits for a response from the Wiimote before
  continuing
o Bug fix for ButtonsExtension report type (0x34)

v1.4.0.0

o Multiple Wiimotes supported!
o Slight change to ExtensionType enum for better extension detection
o Decided I didn't like the dependency on System.Drawing for the 2D point
  so am now using my own Point structs.  Sorry...
o WiimoteTest app updated to show multiple Wiimotes working

v1.3.0.0

o SetReportType contains an overload taking a new IRSensitivity parameter
  which will set the IR camera sensitivity when using an IR report type
o Created new WiimoteException type which is now thrown by the library
o Moved InputReport enum to namespace level
o Events now using the generic EventHandler class instead of custom
  delegates
o Refactored the state structures to use Point/PointF and my own
  Point3/Point3F
o Refactored IR sensors to be an array
o Added support for the Guitar Hero controller
  (tested by Matthias Shapiro, Evan Jacovier)
o Test app will run without Wiimote connected (Andrea Leganza)
o ReadData now returns the proper amount of data for requests of more than
  16 bytes (reported by David Hawley)
o Test application updated with above changes
o Lots of breaking changes, but the survey on my site said most didn't care
  about backwards compatibility...  :)

v1.2.1.0

o Added support for IR 3 and 4 (Johnny Lee)

v1.2.0.0

o Moved to CodePlex! (http://www.codeplex.com/WiimoteLib)
o New license!  Please read the included license.txt/copyright.txt for more
  info.  This likely doesn't change anything for anyone, but at least now
  it's official.
o AltWriteMethod deprecated.  Connect will now determine which write method
  to use at runtime.  It remains in case someone needs to override the
  write method for some reason. (gl.tter)
o WiimoteState.LEDState is now filled with proper values.
  (identified by gl.tter/Leif902)
o Extensions that are attached at startup are now recognized properly.
  (identified by Will Pressly)
o "Partially inserted" extensions now handled properly (Michael Dorman)
o SetRumble method now does this via the SetLEDs method instead of using the
  status report to avoid a needless response from the Wiimote. (Michael Dorman)
o IRState now contains RawMidX/Y and MidX/Y containing the value of the
  midpoint between the IR points.
o Async reads now begin after the data parsing and event has been raised.
  This should lead to non-overlapping events.
o Updated the test application with the above changes and cleaned up the UI
  updates by using delegates a bit more effeciently.

Breaking Changes (may not be a complete list)
----------------------------------------------
o LEDs renamed to LEDState
o GetBatteryLevel renamed to GetStatus
o OnWiimoteChanged renamed to WiimoteChanged
o OnWiimoteExtensionChanged renamed to WiimoteExtensionChanged
o CalibrationInfo renamed to AccelCalibrationInfo
o Event handlers renamed to WiimoteChangedEventHandler and
  WiimoteExtensionChangedEventHandler

v1.1.0.0

o Support for XP and Vista x64 (Paul Miller)
o VB fix in ParseExtension (Evan Merz)
o New "AltWriteMethod" property which will try a secondary approach to writing
  to the Wiimote.  If you get an error when connecting, set this property and
  try again to see if it fixes the issue.
o Microsoft Robotics Studio project
  Open the WiimoteMSRS directory and start the Wiimote.sln solution to take a
  look! (David Lee)

v1.0.1.0

o Calibration copy/paste error (James Darpinian)

wiimotelib's People

Contributors

brianpeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wiimotelib's Issues

.Net Standard support

Because wiimotelib uses Win32 interops, it can only be used on Windows Desktop projects.

In order to use it on UWP, instead of using Win32 P/Invokes, on UWP there's this new API:

Windows.Devices.HumanInterfaceDevice.HidDevice

I guess with some tinkering, you could abstract the core of wiimotelib, and then have specific DLL variants for desktop, UWP, and why not, xamarin

Measurements of the four weight sensors on the Nintendo Balance board are exactly 4 times too big

Back in December of 2007, Mr Hiroyuki Ogasawar (Oga) from Japan, hacked the Wii Balance board, and figured out the formula to get weight values from the 4 weight sensors.

He posted the formula for the calculation, and wrote: (Google translate)
"I calculated this for 4 sensors of A, B, C, and D and took the average,
it matched my weight by itself."

...emphasis on the word "average".
Each weight sensor should return the proper portion of the person's weight that is currently standing on the device...
and the entire person weight will be given by the total of the 4 sensor weight values, not by averaging them!
I.E, a person that is standing so that his balance is a little to the heels of his left foot: BottomLeft:30kg , TopLeft:20kg, BottomRight:10kg, Top Right:5kg.
This guy weighs 30+20+10+5 = 65kg,
This guy does not weigh (30+20+10+5)/4 = 16.25kg!

The bug can be seen with the wiimoteTest program, and also with willBalanceWalker program, etc. all of the 4 sensor values are exactly 4 time too big. and the library divides the overall weight value by 4 (averaging), that's why the overall weight is still correct.

The bug was created when Oga used 68 (kg) in his formulas, instead of 17. I don't know how or who figured out that Nintendo used 17kg and 34kg weights as the calibration values on the wii balance board, but these are the correct numbers (17 / 34), wheres 68 is 4 times 17, or 4 times too big, hence explaining the error.
(If anyone has any internal nintendo documents that they would like to share with me... It might answer some serious questions I got, posted in #8 )

(please see Pull request #7 )

System.ArgumentException in version 1.7.0 and 1.8.0

I got an Exception while using Wii Balance Walker and trying to connect to the Wii Balance Board.

Additional Informations:

The destination array is not big enough. Check destIndex, length and lower bound of the array.
(freely translated from german)

OS: Win 10 64bit
App: Wii Balance Walker v0.4
DLL: WiimoteLib v1.8.0 (resp. v1.7.0)

Issues with connecting to Wii balance board (Error reading data from Wiimote...is it connected?)

Here is a copy and pasted message that I wrote a while ago for wii balance walker. Hopefully there is a better answer here:

Error message reads as such: "Error reading data from Wiimote...is it connected?"
Cannot find a single troubleshooting step that works, both vjoy and Julian Löhr HID have been reinstalled. (RVL-021 Wii Balance Board, C/RVL-BC-AUS)

Status reads as such:
vJoy Console�Æ¢]g¬
Vendor: Shaul Eizikovich
Product :vJoy - Virtual Joystick
Version Number:2.1.8
vJoy Device 1 is free
vJoy Device 1 capabilities:
Number of buttons 16
Number of Continuous POVs 0
Number of Descrete POVs 0
Axis X Yes
Axis Y Yes
Axis Z Yes
Axis Rx Yes
Axis Ry Yes
Axis Rz Yes
Version of Driver Matches DLL Version (218)
Acquired: vJoy device number 1.

vJoyList also lists #1 as red, not sure if normal.

Current computer has also had many problems in past with wiimote.

OS: Windows10
CPU: AMD Ryzen 5 2600x
Motherboard: B450 Aorus M
Bluetooth adapter is PCIE, lowest slot, name is GC-WBAX200. May be a similar model.

All drivers up to date.

Current HID list is as follows
Ca24pture

I cannot think of anything else I can provide for information, hopefully this is everything needed.

Wrong product ID for Wiimote with integrated WiiMotion plus

When working with a newer Wiimote (Nintendo RVL-CNT-01-TR) the PID in the Wiimote.cs has to be changed. Maybe qualifying by the -TR postfix or a selection via the correct PID could be a solution.

private const int PID = 0x0306; // classic wiimote
or
private const int PID = 0x0330; // wiimote with integrated wii motion plus

After connection all buttons worked, but unfortunately there was no chance to get the accelerometer data.

Communication with wii balance board clone

I have a Wii balance board clone and tried to use this dll to communicate with the Wii balance board, however, the communication doesn't work.
Any suggestions on how to put it work?
Thanks for your help,
André Dias

Rumble support is only 0 or 1?

Hi. Was wondering since I cant get different types or rumble. And continous rumble is way too powerful. Tried external software to lower rumble, but didnt work. Any chance to add different levels?

Set zero point / Temperature calibration / Latitude calibration

I became very interested in this bug, since for my use I needed to have accurate weight values from the balance board.
however, I still seem to be having a few problems and would really appreciate some help!
This is regardless to the aforementioned bug.
I bought my balance board second hand only recently.
When I have nothing on it, The values I'm getting are: (TL:-12kg, BL:-0.2,TR:-2.9,BR:-6.0kg), an overall weight of -20kg. (again, with the aforementioned bug already resolved!)

First, I'm wondering if I have a bad unit. I'd really like to see what kind of weight values (not raw values) do other people read when you're off your wii board? Anybody sees any large numbers? that differ much from zero, either positive or negative?

**Second
**, I read the 'Wii Balance Board Accessory Programming Manual', a very interesting read. It talks about several key components that are currently not implemented in Wiimote library, could it be because nobody hacked around this area?

  1. On the actual nintendo Wii, there was a way to recalibrate the balance board to the current zero point (that is, dismount the balance board, hit 'tare', and voila, you got your zero point set.) (the lack of this feature is probably why I get the large error I'm getting in weight value. So I assume.)
  2. While setting the zero point, a temperature reading is also taken. That reading along with the preconfigured calibration temperature value (and a formula which we do not have), compensates for the current temperature while using the device. (I'm in air conditioned environment so it's unlikely that this is a cause for any major error on my device)
  3. There is also an algorithm for latitude correction. (This should be simple enough for a horrible programmer like myself to write, but the difference in weight value between being at the equator or the poles is so small that I don't care much for this error either!)

I would like to (try to) implement the zero point set (tare) function. I wonder how it's implemented on nintendo's SDK. I am sure that raw sensor values are read by the application (with no weight on the balance board) for 2 seconds to calculate an average. (see top of page 15 in the manual). And then that raw value is used to set the zero point.
Here's what I don't know. Either:

A. you can take the weight in KG (that is calculated using the 3 calibration parameters, I.E -12KG for my Top Left sensor,) and call that value 0KG. (Add 12kg to the result per my example) Then. always compensate by adding +12kg for that sensor.
B. you can take the current RAW value, (I.E 14,265 for my RAW top left sensor value), remember the difference to the pre-set calibration value for 0KG (15,501 for this sensor), and then always compensate by adding the RAW difference (15,501-14,265 = 1,236, so in my case add 1,236 to whatever is the current RAW value for that sensor), and only then do the conversion from RAW to KG.
C. Is there a third possibility to program the set zero function? that I'm missing completely?

The difference isn't huge, but I'm not sure which of these two ways is the correct way to do it.
note that the 1st way is linear throughout the range (but possibly in an incorrect way), whereas the 2nd way offsets the linear interpolation between 0kg to 17kg, and keeps the same linear interpolation as before the calibration, once over 17kg. (possibly this is also wrong!)

...Is anybody still here? thanks for reading the entire darn thing... :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.