Unity-Wiimote
Unity-Wiimote copied to clipboard
IR Pointer
I noticed that the green dot pointer in the demo jumps to a random location during a swing. Is there a remedy to this? I am trying to analyze a swing, but unfortunately this jumps makes it inaccurate.
The green dot calculation uses the accelerometer to account for rotation of the remote (you may notice that if you rotate the remote the white IR dots turn as well in the viewer, this is because the onboard IR camera is being turned). The actual calculation can be found here. This means that if you shake the remote, the pointer will go all over the place due to this rotation calculation - it assumes that the accelerometer is pointing in the direction of gravity (down). This issue is also present on the actual console, by the way.
If you want to have accurate IR while swinging, here are a few things you can try (you will have to make some changes to GetPointingPosition() in any case):
- Have some sort of calculation that determines whether or not the remote is still. Record the most recent "still" pointing position, and only use that in GetPointingPosition(). To determine stillness, you can take the standard deviation of the readings over the last half second or so. I did something similar for my experimental DS4 API - check that out for reference.
- Use the Wii Motion Plus for the rotation reading instead of GetPointingPosition() - in this case of course you need to make sure you are using a Wii Motion Plus.
- Remove the rotational correction entirely (this only works if you can guarantee that the controller is level with the ground, which it sounds like you can't).
@Flafla2 I have the Motion Plus extension added to the Wiimote. How would you integrate the motion plus rotation data with the IR points? Would I combine PitchSpeed and RollSpeed with IR Midpoint? Any guidance with this would be helpful. Thank you!
@andreierdoss I've been tackling this problem for the past week or so... I am getting closer to a solution but I still need to work out some glitches in the rotation solver.
The basic idea is to treat the Wiimote as a rudimentary IMU when the Wii Motion Plus is attached. So the accelerometer can be used for an absolute frame of reference (when the Wiimote is still) and the Wii Motion Plus can be used for more precise adjustments (but it has the issue of falling out of sync over time). It is also worth noting that the accelerometer only gives pitch and roll data, not yaw. You can use the Wii motion plus alone to solve for yaw, and you can "zero out" the yaw when the player points the remote at the screen.
@Flafla2 any luck putting a solution together? Please let me know how I could help.