Resetting a Gyro to 0

So to reset a gyro sensor back to 0, you would do

SensorValue[gyro] = 0;

My question is if every time I do this, do I have to make the robot sit still for 1.1 sec like it would normally do for the beginning calibration? Or will it just quickly reset to 0 and then continue like a quad encoder would?


Yes to sit still for 1.1 sec or yes to it will just continue?

the 1.1 is for initializing not resetting
you only need the wait during pre-auton

Thank you for the clarification!

yay my first answer!!!

I’m confused. Mid way through the autonomous does the program need to wait the 1.1 seconds to reset or is it nearly instantaneous ?

Since I was not clear before: the wait is only needed in your pre-auton not auton
For resetting a sensor, there is no wait necessary

I know this is off topic, but that may be the first time I have seen a quote in a quote on these forums.

But, the wait is just to initialize. Reseting just sets the number to 0 and goes from there.

Do other sensors such as encoders need to be cleared during pre-auton?

You can clear encoders in pre-autonomous but there’s no real advantage to doing so, and on other sensor benefits from a reset.

The reason for calibrating the gyro in pre-autonomous is because it takes about 2 seconds, and you don’t want to give up that precious time. But a statement like:

// clear right encoder
SensorValue[rightEncoder] = 0;

is essentially instantaneous. So you can just do that in your autonomous routines at no real cost.