Reputation: 10660
I am trying to adapt a low pass filter from this site: Low Pass Filter
My problem is that I do not know what is the goal of below line:
int rotation = Compatibility.getRotation(this);
I have googled a lot in order to search information about this but without no luck. Anyone knows what it does?
See below piece of code:
@Override
public void onSensorChanged(SensorEvent evt) {
if (evt.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
gravSensorVals = lowPass(evt.values.clone(), gravSensorVals);
} else if (evt.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
magSensorVals = lowPass(evt.values.clone(), magSensorVals);
}
if (gravSensorVals != null && magSensorVals != null) {
SensorManager.getRotationMatrix(RTmp, I, gravSensorVals, magSensorVals);
int rotation = Compatibility.getRotation(this);
if (rotation == 1) {
SensorManager.remapCoordinateSystem(RTmp, SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z, Rot);
} else {
SensorManager.remapCoordinateSystem(RTmp, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_Z, Rot);
}
SensorManager.getOrientation(Rot, results);
UIARView.azimuth = (float)(((results[0]*180)/Math.PI)+180);
UIARView.pitch = (float)(((results[1]*180/Math.PI))+90);
UIARView.roll = (float)(((results[2]*180/Math.PI)));
radarMarkerView.postInvalidate();
}
}
Upvotes: 0
Views: 774