0

Which is the inclination of the moving angle to an angle 0 which corresponds to mobile laid flat. I want exactly measure angle on the corner walls (between 2 walls)

I already use this code, and the results obtained:

public void onAccuracyChanged(Sensor sensor, int accuracy) {

    float[] mGravity;
    float[] mGeomagnetic;
    public void onSensorChanged(SensorEvent event){
      if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
           mGravity = event.values.clone();
      }
      if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
          mGeomagnetic = event.values.clone();
      if (mGravity != null && mGeomagnetic != null) {
        float R[] = new float[9];
        float I[] = new float[9];
        boolean success = SensorManager.getRotationMatrix(R, I, mGravity, mGeomagnetic);
        if (success) {
          float orientation[] = new float[3];
          SensorManager.getOrientation(R, orientation);
          azimut = orientation[0]; 
          mAzimuthView.setText(String.format("%.2f",Math.toDegrees(azimut)) + '°');
          tv.setText(String.format("%.2f", Math.toDegrees(azimut-angle_reset)) + '°');
        }
    }

}

1 - GSM is a flat vertical -> azimuth = 37 ° . 2 - Turn GSM Horizontally 90 ° -> = -111 ° azimuth . So the difference ( 111-37 ) is 74 ° !!!! ( But normally I have to get 90 °)

Victor
  • 3,669
  • 3
  • 37
  • 42
brayan
  • 1
  • 3

0 Answers0