Hi our team is new, how does the autonomous/driver control work in a Vex match. Do we keep both programs on the same file, and if so, how do we switch between the file? Also, how do we switch between different autonomous files?
you should use the “competition template” for code that you expect to use in competition.
to make a new competition template go to the top left corner of your screen, hit file, then hover over new in the drop down menu, and then select competition template.
this will two tasks one labeled “autonomous” and one labeled "driver Control.
all your direct auton code will go in the autonomous task, however some programs (the more professional ones) will separate out the actual functions into a separate file, I, being inherently lazy chose to keep everything in one stupidly long file.
in order to switch between auton code or tasks(not actual files) you have some control statements in your auton task. this is you would have some if statements if your code that says “if x is true, run these auton commands”, and you create separate sets of commands in different if statements, one way you could do this is have a variable, lets call it “autonNumber” and then say
if(autonNumber == 1){
do this stuff
}
and you could directly set “autonNumber” in your code by saying
autonNumber =1;
or
autonNumber = 2;
then you would re-download code to your robot every time you wanted to change modes
this is not very practical for use in changing modes every match, so you can use sensors, my team used to use a jumper clip, that we plugged into different sensor ports for each different mode.
so teams use potentiometers that they turn to different positions for different modes
the best way to do this is to use an LCD screen to chose auton modes, but this is fairly diffictul so maybe just start with the jumper clips, it’s fast and easy and works just as well
Athite,
In order for your robot to run at competition, you need to put your code in a competition template. The competition template allows you to have code that the field control system can run.
Which program are you using to program your robot? In RobotC, you can create a new file using a competition template by going to File…New…Competition template. Then you can put your existing driver control code in the usercontrol task, your autonomous code in the auton task, and code you want to run before autonomous the pre-auton task.
As for switching to a different autonomous file, you have a few options. You could simply change the code in the autonomous task before each match, or use a jumper, or, like most teams, use an LCD. You can search the forums for code.
Good Luck!
You should look at some of the beginner tutorials online. They can be really helpful when you are trying to figure something like this out.
Good luck
Besides the useful tips mentioned above, I would also suggest looking through the webinar series we (ROBOTC) held, cosponsored by RECF: http://robotc.net/recf/
These recorded webinars were created specifically for the VRC competition using ROBOTC, and one of the first things that is covered is the Competition Template, the different portions of the template, what code should go in each section, etc. I definitely recommend taking a look through it, even if you are an experienced ROBOTC programmer.
Just take the competition template if your a beginner at programming, it will let you get most of the basics and is really easy to quickly make a program for testing. However, you can make your own from scratch but it isn’t really worth it unless you have a lot of complete code involved.