Gyroscope Initialization

Robot is running even it is suppose to stay put for initialization of gyroscope. Is there a way to initialize the gyroscope without spending precious time of 2 seconds in pre Auton? But the main problem really is that the robot is moving ahead even if it is suppose to wait until gyroscope is done calibrating.

void vexcodeInit( void ) {
Brain.Screen.print(“Device initialization…”);
Brain.Screen.setCursor(2, 1);
// calibrate the drivetrain gyro
wait(200, msec);
Brain.Screen.print(“Calibrating Gyro for Drivetrain”);
// wait for the gyro calibration process to finish
while (TurnGyroSmart.isCalibrating()) {
wait(25, msec);
// reset the screen now that the calibration is complete
wait(50, msec);

void pre_auton(void) {
// Initializing Robot Configuration. DO NOT REMOVE!

// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, …

int main() {
// Run the pre-autonomous function.
// Set up callbacks for autonomous and driver control periods.

// Prevent main from exiting with an infinite loop.
while (true) {
wait(50, msec);

I don’t really see how waiting 2 seconds in preAuton would be a problem. You could try using a competition switch to allow for a longer preauton so it calibrates properly


Thanks, that might be the problem. I don’t have the competition switch. Will let you know later. Thanks again.

If you’re using the inertial sensor you don’t need to manually calibrate in the code. According to @jpearman the cortex already does the calibration when turned on. If you can calibrate you should but it’s not required.

Link for proof:


When not using a competition switch, the driver control task begins almost immediately after starting the code. This means that if you have longer waits in preAuton, then driver control will begin before preAuton has completed and both will run at the same time. You could either use a competition switch, like @thorstenl312 suggested, or use a flag to make sure that driver begins only after preAuton has completed.


I’m using Jpearman’s inertial sensor initialization. Catzilla exactly described my situation. In RobotC, we used to have a way to test autonomous without having to use a competition switch. I guess Vexcode V5 text don’t have that capability yet. My setup during autonomous testing is: my controller USB wired to computer then I run my autonomous wirelessly using the controller. I guess I should use a competition switch to simulate on field runs. I will test it as soon as I get the competition switch.