Our team is just getting started in the VEx EDR Competitions and we have our first iteration robot just about built for the new In the Zone competitions.
We have the coding for our driver control written and working well using the competition template. The question that I have is how do we test our autonomous code that we have written in the competition template on the actual robot? Do I need a line of code under the autonomous section that tells the robot to run only this when started and not wait for driver control? Do I need the switch they sell on VEX Robotics site in order to switch back and forth? Any information you can provide would be really helpful.
You can use the debugger to run the autonomous code. The debugger window is called “competition control” Here’s a screenshot of the help for that debugger window:
If you’re not in RobotC and don’t have a competition switch, you can copy your entire autonomous code and paste it into the beginning of your tele-op code. I would follow it with a loop something like this:
boolean waitForTeleOp = true;
while(waitForTeleOp==true)
{
if() <------- insert a check for some button on your remote so pressing it will start tele-op
{
waitForTeleOp=false;
}
}
If you look at the competition includes file, you can see how task autonomous is activated and use a modified one for your own practice that allows a button to activate autonomous or whatever. Copying and pasting your code is easy to forget what’s updated and what’s not.
Thanks so much for all the responses. We are using RobotC and I have seen the VexNet Comp Control and do select Autonomous. We then upload to the Cortex but how do you get it to start running? Sorry I am still missing a step or something. I would like to test the code from within the template. If I do that do I need the switch then?
I will also take a look at the Competition includes files that OverlyOptimistic calls out and see if we can figure this out. Thanks again for all your help and support as we learn this!!
What I do is I make the auton control start and driver control stop when you press (EDIT)two buttons. Here’s an example of what I’m thinking of(when the auton is finished, you have to restart the robot to get back to driver control):
task autonomous(){ /*Basically just for example*/
}
task usercontrol(){
while(1==1){
if(vexRT[Btn7R]==1&&vexRT[Btn7U]==1){
StartTask(autonomous);
StopTask(usercontrol);
}
}
}
It should work like that, but if I’m wrong I apologize.