I find this excerpt (from the knowledge base) a bit confusing:
Note: It is recommended using 2 seconds for a calibration time or start the sensor’s calibration within the pre-auton portion of the competition template. When using the sensor within the VEXcode V5/VEXcode Pro V5 drivetrain functions, the calibration is included within the function.
What is this pre-auton portion they’re taking about? Is is the “when autonomous” block? We’d like to use the sensor in both alliance and skills matches as part of the drivetrain device, and we want to make sure the calibration process does not take away from our run time, even if it takes only 2 seconds. When they say the calibration is included, does it happen automatically as soon as the start running, or is it deferred until the first motion block is executed? I don’t see any blocks to explicitly initialize the sensor.
If you’re programming in VEXcode blocks, “Pre-auton” is the code you put under a “When Started” hat block. That code will run when the program starts, whereas code under the “When Autonomous” hat will only start running when the field control system puts the robot into the autonomous mode at the beginning of the match.
This block will calibrate the inertial sensor for the recommended amount of time:
But as the text you quoted above notes, if you’re using the inertial sensor as part of a drivetrain object, the sensor will be calibrated automatically at the beginning of the program, no need to add in the calibrate block.
Actually the inertial sensor is calibrated when a program is launched, doesn’t matter if drivetrain object is used or not, or what the program type (ie. VEXcode, PROS etc.) is. If the robot is moving as the program is launched the calibration will fail, that’s why we have the additional command to cause it to calibrate at any point during program operation.