xwiimote / xf86-input-xwiimote

X.org XInput2 Wii Remote driver based on XWiimote
Other
37 stars 14 forks source link

IR improvements #15

Closed dnschneid closed 10 years ago

dnschneid commented 10 years ago

It's not the prettiest code, but I figure I'd alert you to the IR-related improvements I've been making, in case you'd like to incorporate them (probably with parameterization and cleanups):

  1. Ignore (0, 0) points. I don't know why (nor if this is normal), but my RVL-CNT-01-TR always has one.
  2. Average the two lightbar points. At the extrema, extrapolate the second point based on previous knowledge. This fixes the edge behavior which the old heuristic was pretty abysmal at.
  3. Perform some averaging of the resulting location when it seems like the wiimote is being held steady. I've tried to balance jerkiness and accuracy, but the values really should be parameterized since people's hand steadiness/display size will vary.
  4. Use two separate keymaps, one for when the wiimote is pointed at the display, and one for when it has lost sight of the IR bar for at least a second. This is handy for mouse control vs. gamepad usage.

I do plan to implement proper tilt compensation (probably something like rotate the points around the center so that the lightbar is level, then disambiguate 180 degrees via the accelerometer), but since this is such an improvement over the current behavior I figure I'd volunteer what I have already.

dvdhrm commented 10 years ago

This looks really good! I haven't done a thorough review, but I like the overall design. The only thing that bothers me is the coding-style (hard-coding the '0' and '1' offsets of 'map_key', 'int' instead of 'bool', ...). However, I haven't worked on that driver for a while and it seems overly didactic to reject it due to those minor issues. Hence, I think I will merge this as-is.

Cleanup patches and further improvements are always welcome, obviously!

dnschneid commented 10 years ago

A bit of cleanup there, hopefully that improves things somewhat.

dnschneid commented 10 years ago

OK I think that's it for this round. Once you give the OK and merge it I'll start looking into rotation compensation and whatnot.

dvdhrm commented 10 years ago

I picked this up but dropped the first average-calc patch. It was entirely replaced by the second one.

Thanks a lot for these improvements!