Class HeadTracker

java.lang.Object
eu.svjatoslav.aukio.e3d.gui.headtrack.HeadTracker

public final class HeadTracker extends Object
Head orientation tracker built on the RayNeo glasses IMU.

A daemon thread reads 500 Hz IMU frames and fuses them into yaw, pitch and roll angles with a complementary filter: gyroscope integration for responsiveness, accelerometer gravity as the long-term pitch/roll reference. Yaw has no absolute reference (the magnetometer is too noisy indoors near a laptop), so it drifts slowly — call recenter() (Scroll Lock in HeadLookController) whenever the view feels off-center.

Sensor axes, established by calibration capture: gyro[0]/X = pitch (nod), gyro[1]/Y = yaw (left/right turn), gyro[2]/Z = roll (ear-to-shoulder tilt).

Drift control ("standstill perceived as slow motion"):

  • Startup calibration only accepts samples taken while the glasses are stationary — moving samples would poison the bias estimate with phantom rotation. Putting the glasses on a desk for the first second gives the cleanest estimate, but a held head passes the stillness gate too.
  • While running, the bias is continuously re-estimated whenever the head is stationary (fast EMA, ~0.5s time constant).
  • Residual rates below 0.07 dps after bias subtraction are integrated as exactly zero — sensor noise can never accumulate into visible rotation.
  • Constructor Details

    • HeadTracker

      public HeadTracker(RayNeoHid device)
  • Method Details

    • start

      public void start()
    • getDebugString

      public String getDebugString()
      One-line diagnostic snapshot: frame flow, tick, integration health.
    • recenter

      public void recenter()
      Makes the current head orientation the new "straight ahead".
    • getLookYaw

      public double getLookYaw()
      Head yaw relative to the last recenter, radians.
    • getLookPitch

      public double getLookPitch()
      Head pitch relative to the last recenter, radians.
    • isCalibrated

      public boolean isCalibrated()
      False until the initial gyro bias calibration has finished.
    • isRunning

      public boolean isRunning()
      True while the reader thread is alive and frames may be flowing.
    • stop

      public void stop()