We’re running the competition template in vex v5, and for some reason, the pre auton just refuses to calibrate our inertial sensor, meaning we’re forced to calibrate it during the auton, which takes wayyy too long. Any idea on how to get the pre_auton(void); function to calibrate the sensors?
Can you share the code in your preauton function?
yes, you have to use a competition switch. We have ours calibrate in pre-auton as well, and it works every time for us. You plug it into the comp switch with the autonomous mode disabled, select the program, wait 3 seconds, and then switch it to enable.
When you are testing your auton code yourselves, you need to give your inertial sensor time to calibrate before beginning the autonomous program. You can do this a few ways:
-
Use a competition switch exactly as @squiddy_slapper recommended.
-
You can also use the controller to operate the code. When selecting a program on your controller, instead of selecting “Run”, select “Timed Run”. When you press A to start a match, it should give a countdown from 3, and it should be running your pre-autonomous program at that time. It should be long enough to calibrate your inertial sensor.
(Quick note on the second method. My students have been using the controller for their programming skills; so they have been selecting the “Competition” option to run their program, and it does calibrate their inertial sensor just fine during that period. However, I can’t verify whether or not they have tried the “Timed Run” option with the same success.)
The auton does not calibrate in the timed run, or at least it hasn’t when I have tried it.
Can confirm, the pre auton doesn’t excecute when doing the timed run
Can also confirm, timed run does not do pre_auton.
is there any way to do this for LRT (without the competition switch)? we don’t really have the competition switch
Just to explain what is happening.
The controller is counting down from 3 but does not start the user program until it reaches 0. This means that it runs the user program and essentially starts autonomous or driver control immediately. So technically pre-auton will run (main has to run and it usually just calls pre-auton), but the autonomous task will start straight away so you do not have enough time to finish calibration of the IMU. We know this is an issue and it’s on our list of features to improve.
Thank you. We constantly run into the issue of not being able to use the controller for competition control because we need to give it time to calibrate in pre-auto.
Thank you for clarifying. Out of curiosity, what about the “Competition” option? Namely, the Programming one - it seems like it’s running pre-auton before starting the 1:00 timer, as my students have been able to calibrate their inertial sensor using that option. Does it do that during the countdown, while the trophy is on screen, or what? It seems odd that it would do so for “Competition” but not the “Timed run.”
I’m pretty sure it works the same way.
You can tell if the student program is running by checking to see if the top status bar on the V5 brain has turned blue.
another alternative, if you have a spare V5 brain around with at least one functional smartport, is to use the skills field control software we have.
Take note about how to reset all smartports back to normal after using this code as it switches them into an alternate mode of operation.