No announcement yet.

When is EV3 gyro calibrated?

  • Filter
  • Time
  • Show
Clear All
new posts

  • When is EV3 gyro calibrated?

    We and other people have noticed that the gyro sensor suffers from a "drift" problem. This is a massive problem if you are trying to write a simple "stay on course" program.

    The problem seems to stem from the fact the gyro reset block does what it says rather than what you would really want it to do. What you want to do at the start of the program is set a reference compass bearing of zero so that it maintains that heading when it runs. But there are two problems with what it actually does….

    1. All it does is reset the current angle to zero. It does not reset the rate of change of the angle. So if the sensor thought it was moving before the reset, it will still think it is moving after the reset, the only difference is the absolute angle is different.

    2. Reset does not calibrate the gyro sensor. I’m still not actually sure when it calibrates the gyro sensor but it calibrates at least when you first power it up and when you unplug and plug back in the gyro sensor. The critical things appears to be the robot must be stationary when you calibrate otherwise it will get the wrong idea of what zero rate of change is, i.e. it will think it is moving when it is not. More often than not I think our team were holding the robot in their hands when the gyro calibrated, thereby producing unreliable results.

    My question is when exactly does is calibrate? Because it seems we got drift between runs. One run it worked and the next it didn't, which suggests it calibrated at some point in between. Maybe downloading a new program recalibrates it?

    Some people have suggested that adding a gyro sensor block in measure rate mode, then a gyro sensor block in measure angle mode also causes a recalibrate. I'm not entirely sure why but empirically that does appear to be true.

  • #2
    Re: When is EV3 gyro calibrated?

    This topic has been discussed extensively in other threads like this one:
    FLL Mentor/Coach 2006-2015
    Founding Mentor for FRC 1759: 2006-2012
    Founding Mentor for FRC 4999: 2016
    FRC Field Supervisor, Los Angeles 2007-2016
    Manager, Software Development, EMC Corp.


    • #3
      Re: When is EV3 gyro calibrated?

      Originally posted by terbos View Post
      This topic has been discussed extensively in other threads like this one:
      I saw that thread. I didn't see anything specific that answers my question. So I'll start the ball rolling myself...

      I think it is calibrated (i.e. the process required to make a motionless sensor return a rate of zero and/or a constant angle) under the following conditions...
      1) The EV3 brick is booted up with the gyro sensor attached
      2) The gyro sensor is plugged into the EV3
      3) The mode is changed? (I'm not sure EXACTLTY what is require for this one)
      4) Others?


      • #4
        Re: When is EV3 gyro calibrated?

        Reading the help files is usually a good place to start when you have questions like this.

        From the Context Help for the Gyro Sensor block:

        "The Reset mode resets the rotation angle of the sensor to 0 (zero). Measurements of the rotation angle measure the motion relative to the last time the sensor was reset."

        The Reset mode for the gyro sensor block only resets the rotation angle. No mention is made of the angular rate.

        From the EV3 User Help : Using the Gyro Sensor

        "When connecting the Gyro Sensor to your EV3 Brick, you must hold it completely still in order to minimize “drifting”"

        Why must you hold the sensor still? It must be because this is the time when the angular rate reading is "zeroed" (Calibration implies a scale and offset. When only adjusting the offset so the zero value corresponds to some known condition it is common to use the terms "zero", "zeroed" or "zeroing"). I think the zeroing is something that happens automatically when power to the sensor is turned on so it also occurs automatically when the EV3 is turned on with the gyro sensor already attached. So the angular rate reading is zeroed when you turn the EV3 on and when you hot plug the sensor. If the gyro rate is not zero when the sensor is at rest you can zero the signal by unplugging and re-plugging the sensor.

        There was a lot of excitement about the gyro sensor and a lot of experiments were performed. It was noticed that changing the gyro sensor from reading "Angle" to "Rate" and back to "Angle" resulted in a long period of time where the sensor reported "---" for both the angle. Switching the block from "Angle + Rate" to "Rate" and back to "Angle + Rate" had the same behavior for both the rate and the angle. After a few seconds the angular rate changed from "---" to zero and stayed there until the sensor was moved. My guess is that the firmware running in the gyro sensor performs the same zeroing for a mode change that it does when first powering on. Lucky for us as this lets you zero the angular rate programmatically. This method is documented in the forum here: