Gyro calibration in Blockly?

Is there a way to calibrate a gyro in Blockly? I don’t see a block for it.

It does a calibration at the start of the program when the gyro object is created. We did not create a block to calibrate during the body of the program for V5. We debated about adding one or not, but came down on the side of “not” for several reasons.

1 Like

OK, that makes sense for Blockly. It still takes a couple of seconds to calibrate the gyro, even without the block, right?

Is there any built in delay that would not allow the autonomous block to start until calibration is done?

Users need to be aware that if they are using a VexNet switch they shouldn’t start their program with the switch enabled.

U can just add a 3 second pause at the start of auton

Do not do this. This would cause it to wait for 3 seconds at the start of every auton, regardless of if the gyro had already had time to calibrate or not.

I know we had talked about adding one, but I don’t remember if we did. I’ll have to ask or test when I’m next in the office.

In case we didn’t, one solution to making sure it’s waited to calibrate would be to sleep for 2-3 seconds on the Start block, then set a variable to indicate that enough time has passed for the gyro to calibrate. At the start of autonomous, wait for that variable to be set, then begin when it has been.

The gyro calibration will be done on program start regardless of competition switch state. The only problem would be starting the program after autonomous has already started, at which point things have already gone wrong.

I just said that cuz if the bot gets jostled at all between calibration and start of auton it gets messed up, if u have any spare time after your auton just add a bit less than that to the delay at the start

Calibration will only be messed up if it was jostled during calibration. If you are referring to the actual readout of the heading, waiting a few seconds won’t do anything to it. Without recalibrating, the way to compensate would be to record what the gyro is reading at the start of autonomous and use the value to compensate.

1 Like

Good point. Most teams that get as far as programming a gyro will have already figured out how to program the LCD to select an auton program. That means they will be pressing the LCD on the brain while in pre-auton. Bad news if the gyro is calibrating at that moment. I’ll have to caution them to put a warning message on their LCD for the first two seconds of pre-auton.