How can you use data from the gyroscope to work out the angle of rotation in x,y and z. I am using the gyroscope in the WiiMotion plus amd Brian Peek's Wiimotelib 1.8 beta library.
Any help is greatl开发者_开发百科y appreciated.
Refer to Deriving Angle Of Rotation From A MEMS Gyroscope which includes sample code snippets. You could also take a look at the general formula on Yahoo! Answers: How do I determine the angle of rotation using a rate gyro?
Content from Yahoo Answers post:
Rate multiplied by time equals distance. If you travel at a rate of 50MPH how far did you travel in 1/2 hour. (25 miles)
Same type of problem. if you move at a rate of 10 deg/sec for three seconds you should have moved a total of 30 degrees. This of course assumes that you kept a uniform rate for the entire three second period. Now suppose that you measured 30 readings at 1/10th of a second intervals and each reading indicated the same 10deg/sec rate. The answer would be the same 30 degrees
The difference between these two methods is the ability to detect variations in rate across shorter periods of time. The faster you poll the rate information the more accurate the overall reading will be.
Rate readings should also have positive and negative values. Move left its negative , move right its positive for example. You would then add all of the readings and come up with a net result that should be very close to the actual overall angle moved from the initial position.
Problem with this method is that errors compound over time unless they are zeroed out against a known point or reference periodically. Polling rate information at a quicker pace minimizes the rate the error builds up by capturing rate information before the unit has experiences a large variation in rate. However variations still happen and ultimately build up to a point where the computed angle is erroneous. This is why the angle is periodically compared to a known reference point and zeroed to it before such total error grow large enough to become problematic.
精彩评论