Configuring a head tracker for your head-mounted display using your Android mobile phone

My goal is to encode a headtracker for my display mounted on my head using my Android phone. The movement is transferred to the movement of the mouse, which, in turn, is used inside computer games. I want to install my Android phone on the back of the tracker, so it will be fixed on the back of the head. The Y axis is up, the x axis is pointing to the right, when looking straight ahead, this means that when you look at my rear head, you see the display of the mobile phone.

mobile phone image

- Y , , . z z 5 10 °.

.

public void onSensorChanged(SensorEvent event)
{
  // alpha is calculated as t / (t + dT)
  // with t, the low-pass filter time-constant
  // and dT, the event delivery rate

  final float alpha = 0.8;

  gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
  gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
  gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];

  linear_acceleration[0] = event.values[0] - gravity[0];
  linear_acceleration[1] = event.values[1] - gravity[1];
  linear_acceleration[2] = event.values[2] - gravity[2];
}

, . 0,8 , t/(t + dT)? , t dT ?

, - - .

. . .

, , ?

+3

All Articles