Gyro tutorials (#930)

* gyro tutorials

* tutorials

* fix gyro simulator

* images

* updated image

* fix svg errors
This commit is contained in:
Peli de Halleux
2019-09-30 22:43:50 -07:00
committed by GitHub
parent cb816c91ad
commit 80b9c715b2
12 changed files with 175 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# calibrate
Reset the zero reference for the gyro to current position of the brick.
Detects if the gyro is drifting and performs a full reset if needed.
```sig
sensors.gyro2.calibrate()

View File

@ -73,7 +73,7 @@ namespace sensors {
}
/**
* Forces a calibration of the with light progress indicators.
* Detects if calibration is necessary and performs a full reset, drift computation.
* Must be called when the sensor is completely still.
*/
//% help=sensors/gyro/calibrate
@ -95,6 +95,19 @@ namespace sensors {
// give time for robot to settle
pause(700);
// compute drift
this.computeDriftNoCalibration();
if (Math.abs(this.drift()) < 0.1) {
// no drift, skipping calibration
brick.setStatusLight(StatusLight.Green); // success
pause(1000);
brick.setStatusLight(statusLight); // resture previous light
// and we're done
this.calibrating = false;
return;
}
// calibrating
brick.setStatusLight(StatusLight.OrangePulse);