Improve gravity-based roll correction #1

Closed
opened 2026-03-01 22:43:37 +01:00 by nikrozman · 0 comments
Owner

Replaced the old roll angle tracking (complementary filter / decay integrator) with gravity-vector axis decomposition. Angular velocity is now projected onto world-aligned axes using a low-pass filtered accelerometer gravity estimate, so cursor movement stays screen-aligned regardless of device roll.

Horizontal tracking works well. Vertical (pitch/nod) feels slightly less responsive... currently using a hardcoded 1.3x pitch scale factor as a workaround. I think the root cause is that the yaw projection picks up incidental GY (wrist roll) via the gy*gny dot product term when the device is tilted, making horizontal feel relatively more sensitive. Pitch has no equivalent boost since the screen-right vector always has ry=0.

TODO:

  • Consider making pitch scale a configurable slider in the web UI
  • Test at various holding angles (flat, 30°, 60° tilt)
Replaced the old roll angle tracking (complementary filter / decay integrator) with gravity-vector axis decomposition. Angular velocity is now projected onto world-aligned axes using a low-pass filtered accelerometer gravity estimate, so cursor movement stays screen-aligned regardless of device roll. Horizontal tracking works well. Vertical (pitch/nod) feels slightly less responsive... currently using a hardcoded 1.3x pitch scale factor as a workaround. I think the root cause is that the yaw projection picks up incidental GY (wrist roll) via the gy*gny dot product term when the device is tilted, making horizontal feel relatively more sensitive. Pitch has no equivalent boost since the screen-right vector always has ry=0. TODO: - [ ] Consider making pitch scale a configurable slider in the web UI - [ ] Test at various holding angles (flat, 30°, 60° tilt)
nikrozman added this to the Software project 2026-03-03 00:06:59 +01:00
nikrozman added this to the v1 release milestone 2026-03-03 00:07:00 +01:00
nikrozman moved this to Done in Software on 2026-03-03 00:07:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nikrozman/air-mouse#1