user2080041
user2080041

Reputation: 85

The result of gyroscope sensor Android

I just did my project for getting data gyroscope sensor. If I put my handphone on the table horizontally, the result of gyroscope sensor are : Roll (X) : 5.326322E-7 Pitch (Y) : 5.326322E-7 Yaw (Z) : 5.326322E-7

Logically, the result should be 0, because the handphone lay on the table. So,anybody can help me? I give my code below. Thank you very much for the response in advance :).

public void onSensorChanged(SensorEvent event) {
if(event.sensor.getType()==Sensor.TYPE_GYROSCOPE)
    {


        float roolX = event.values[0];
        float pitchY = event.values[1];
        float yawZ = event.values[2];

        koordinatrollX.setText("Orientation X (Roll) :" + Float.toString(event.values[0]));
        koordinatpitchY.setText("Orientation Y (Pitch) :" + Float.toString(event.values[1]));
        koordinatyawZ.setText("Orientation Z (Yaw):" + Float.toString(event.values[2]));
    }

Upvotes: 0

Views: 1790

Answers (1)

Warpzit
Warpzit

Reputation: 28152

E-7 = 10^-7 so it's very close to 0. You can't expect the hardware to be perfect calibrated or the table to be perfect flat. You could let the user recalibrate based on the surface the phone is at but the result you get is already very close to zero.

Upvotes: 1

Related Questions