Line 131:
Line 131:
The correct way to measure orientation is to maintain a rotation matrix (or alternatively a quaternion) of the current orientation (relative to gravity), and update it each time you get a gyro reading. It will drift a little, so you should reset the matrix's pitch and roll (but not yaw) with the values from the accelerometers whenever the accelerometers and gyros indicate no movement. After significant rotation, you should reset the matrix's yaw to zero when the Wii Remote is pointing near the middle (horizontally) of the sensor bar.
The correct way to measure orientation is to maintain a rotation matrix (or alternatively a quaternion) of the current orientation (relative to gravity), and update it each time you get a gyro reading. It will drift a little, so you should reset the matrix's pitch and roll (but not yaw) with the values from the accelerometers whenever the accelerometers and gyros indicate no movement. After significant rotation, you should reset the matrix's yaw to zero when the Wii Remote is pointing near the middle (horizontally) of the sensor bar.
+
When not activated, the MotionPlus is detected by regular polling (every 8 seconds or so) of 0x(4)a600fe. Writing 0x55 to 0x4A400F0, then 0x00 to 0x4A400FB (the standard extension init, works fine even with no extension) re-activates the standard extension, if any, plugged into the MotionPlus pass-through port. The development version of the [[CWiid|CWiid driver]] currently implements this method (without automatic 8 second checks) on the [http://abstrakraft.org/cwiid/browser/branches/motionplus/ motionplus branch]. Additional information on MotionPlus workings and implementation requirements are at http://abstrakraft.org/cwiid/wiki/MotionPlus.
+
+
The combination of 3 linear accelerations with 3 angular rates allows what Nintendo refers to as 1:1 motion tracking, which is another way of saying 6DOF (degrees of freedom) over a short time. It's only valid over short times because of the integration involved to convert accelerations and rates into positions (input errors, when integrated, blow up over time).
+
+
In addition to providing yaw, the gyros also allow the software to tell the difference between orientation and acceleration, which are difficult to tell apart from the accelerometers which measure a mixture of both.
+
+
[http://www.ailive.net/lm2.html Wii Motion Plus Documentation at AiLive]
=== Nunchuck pass-through mode ===
=== Nunchuck pass-through mode ===
Line 245:
Line 252:
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd; color:#888;" | 0
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd; color:#888;" | 0
|}
|}
β
Note that BDL and BDU are moved, and each axis of the left joystick loses its least significant bit. Extension connected is usually 1.
Note that BDL and BDU are moved, and each axis of the left joystick loses its least significant bit. Extension connected is usually 1.