Hey I’m having issues with my autonomous coding. I’ve used the VEX EDR template but when I try to run the program, it won’t recognize the autonomous portion of the code. Any help would be greatly appreciated. Thanks!
RRAutonRun1.docx (13.3 KB)
As of now, the code looks just fine. How are you turning on the autonomous portion of the code? Do you have a competition switch you are working with?
looks fine but you dont Need to use comp template im pretty sure as long as u have the right code
This is the code we have been running without the competition template
optic trial code.docx (14.1 KB)
To run the autonomous code with the competition switch, you need to connect your robot to a competition switch and set it to enable and autonomous. If you don’t have a competition switch, you can either buy one on the VEX store, or add the following two lines of code to your
usercontrol
task to temporarily bypass the driver control mode and immediately run the autonomous code when your robot connects (you would not want to use this except for testing):
startTask(autonomous); //start running autonomous code
stopTask(usercontrol); //stop running usercontrol task so driver control code doesn't conflict with autonomous code
A third option is to put the above code in an if statement to trigger it with a joystick button. This way, you won’t get any surprises when you connect your robot to a computer and the autonomous play starts running.
In a competition, whatever you have in your
autonomous
task is what will run during the autonomous period.
We don’t have a physical competition switch. Our team just ordered the basic kit so I guess the switch doesn’t come with that.
Going with your third option, by adding the if statement, will our drivers be able to press the button to trigger autonomous mode during competition? I was under the impression drivers were not allowed to touch the joysticks during the autonomous period.
You don’t need that if statement for actual competitions. The field control will automatically run the autonomous task during the autonomous period.
So by leaving my code the way it is, it should run the autonomous portion through field control? But there’s no way for me to test it without having a physical competition switch or adding the joystick button?
That’s correct. But you can always take out your joystick button to test it once you’ve gotten the code working.
Ok thank you so much!