Skip to content

Orientation

Suraj Swarnapuri edited this page May 5, 2019 · 3 revisions

BNav uses the android.sensors package to gather orientation data

Global Variables

  • static SensorManager _sensorManager;
    • access sensor information
  • Sensor _accelerometer;
  • Sensor _magnetometer;
  • float[] _r = new float[9];
    • matrix to define orientation
  • float[] _orientation
    • stores x, y and z data
  • float[] _lastAccelerometer
  • float[] _lastMagnetometer
  • boolean _lastAccelerometerSet
  • boolean _lastMagnetometerSet
  • double heading
    • angle of current direction

Methods

  • String turnDirection(double heading, double bearing)
    • returns direction given heading and bearing
  • double convertRadiantoDegree(double rad)
    • convert radians to degrees (0,360]
  • void onSensorChanged(SensorEvent event)
    • reading orientation data and stores heading

References

Clone this wiki locally