Note that there are some explanatory texts on larger screens.

plurals
  1. POGyroscope does not show any drift
    primarykey
    data
    text
    <p>I'm in a little bit weird situation. The situation I currently have is typically a good one - no gyro drift at all - but I have no clue why this is the case. I expected the gyroscope to drift a lot as reported everywhere. Therefore this question to find the reason why I do not see any drift.</p> <p>I use a Galaxy Nexus (Android 4.0.3) and its gyroscope to do some orientation change detection in the end. In the first place, I just wanted to log the sensor readings and expected to see large drifting values as for example <a href="https://stackoverflow.com/questions/1586658/combine-gyroscope-and-accelerometer-data">here</a>. Also on other websites I read of drifting of about 1 degree per second or similar measurements.</p> <p>My code to log the sensor data is very basic:</p> <pre><code>SensorManager sm = (SensorManager) getSystemService(SENSOR_SERVICE); LogSensorEventListener listener = new LogSensorEventListener( SensorLoggerActivity.this, Sensor.TYPE_GYROSCOPE); sm.registerListener(listener, sm.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_FASTEST); </code></pre> <p>LogSensorEventListener is also a very basic implementation of the SensorEventListenerInterface:</p> <pre><code>@Override public void onSensorChanged(SensorEvent event) { final float dT = (event.timestamp - mTimestamp) / 1000000000.f; if (dT &lt; 1) { // just a fix for the first step mRelZ += event.values[2] * dT; list.add(mRelZ); list2.add(event.timestamp); } mTimestamp = event.timestamp; </code></pre> <p>mRelZ is initially set to 0 and the two lists should keep track of time and measured value. If finished with my measurement (clicking a button) the values are written to file:</p> <pre><code> try { for (int i = 0; i &lt; list.size(); i++) { long time = list2.get(i); if (mStartTime &lt; 0) { mStartTime = time; time = 0; } else { time = time - mStartTime; } float timef = time / 1000000000.0f; sb.append(timef); sb.append(";"); sb.append(Math.toDegrees(list.get(i))); sb.append("\n"); } mOutFileStream.write(sb.toString().getBytes()); mOutFileStream.flush(); mOutFileStream.close(); } catch (IOException e) { } </code></pre> <p>Everything works fine but the only drift I can see (for example when having the device lying on a table and logging values for let's say 60 seconds) is about 0.2 degree. If I move the device to get something like in the screenshot above no drift can be observed at all...</p> <p>What I'm I doing wrong (or right?)??</p> <p>Thanks for any advice! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload