Gyro tutorials (#930)
* gyro tutorials * tutorials * fix gyro simulator * images * updated image * fix svg errors
This commit is contained in:
		@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user