Help with MotionPlus data oddities
July 29, 2009 10:01PM
I am currently use Wiiuse to make a c program and I am adding my own support for MotionPlus. I have it connecting, calibrating and receiving reports, but some of the data recieved is a bit odd. I was wondering if someone could shed some light on why what is happening. I have 2 motionPluses, one bought stand alone and one from Wii Sports Resort. I currently don't have access to my code, so I am writing from memory. I will correct anything a get wrong when I get home.

I am currently calibrating by getting the raw 14 bit data from each of the gyros then seeing if 50 events in a row return values within a threshold of 75 of those initial values. If so, that values then my calibration values, which I subtract from each input before dividing by 20 to get my degrees per second (it still seems to big for degrees per second, but I will refine this after I get proper data). If I get an input value which is within that 75 threshold of my calibration value, I set the input value to to the calibration values so I will get 0 in the end to eliminate noise. I then later also set to 0 if the degrees per second is less than 0.5 to compensate for a hand just not staying still.

I get the data in an array of bytes: byte data[6];

yaw = (data[0] ) | ((data[3]&0xFC)<<6);
roll = (data[1] ) | ((data[4]&0xFC)<<6);
pitch = (data[2] ) | ((data[5]&0xFC)<<6);

slowyaw = (data[3] & 0x02)>>1;
slowroll = (data[4] & 0x02)>>1;
slowpitch = (data[3] & 0x01);
extension = (data[4] & 0x01);

I just have on odd problem where slowly turning any gyro in the negative direction slowly will first cause it to give back a low positive number then it will become negative as the rotation speeds up. Also the positive turning values are a bit higher then the absolute negative turning values. It is as if the 0 values for being still is lower than the 0 values for moving. The slowyaw/roll/pitch do not change during the point when the small positive values become negative, I have to rotate a lot faster for those bits to change.

Also, for some reason both my MotionPluses always returns a 1 for slow rotate on 2 of the gyros when still, but a 0 for the other. I it was roll that was giving the wrong value, but it might have been pitch. I noticed yaw was the one that was on it's own gyro sensor, and pitch and roll shared a gyro sensor, so I double checked that it wasn't yaw that had the 0. The 0 actually changes to 1 at about the same rotation speeds that that the other 2 gyros change to 0.

If anybody has come across this either of these and found a solution, or is getting the same thing, I would appreciate it if you would let me know.

Thanks,
Neil
Re: Help with MotionPlus data oddities
July 29, 2009 10:03PM
Connect to #wiidev on EFNET. There are a lot of people over there working on the same thing who could collaborate with you.
Sorry, only registered users may post in this forum.

Click here to login