v5 Autonomous Program


#1

How do you start an autonomous program with the new v5 system


#2

check out main{} in the competition template


#3

Do we have to use an autonomous switch?


#4

To start program in the v5 brain


#5

@Manager2.0

No you do not. When you turn on the brain there is a menu, click on the program folder and then click on your program. Then you will have the option to run, run timed or run competition. Pressing RUN TIMED should start the program starting will autonomous. Or you could use the RUN COMPETITION to run a programming skills run.


#6

When you first open up the VCS, go to the example program instead of choosing what language you are going to use. After that, scroll down and click on Competition option and press choose. After you’ve done that, select what language it should open up the template in.

If you want to start your own, make sure you include


vex::competition    Competition; 

Then when you make your user control and autonomous void (make sure user control*** of them have a loop in the end so it doesn’t quit the void)

In your main, plug the pre auton first if you have it, and then write

Competition.autonomous(ureautonvoidname);
    Competition.drivercontrol(ureusercontrolvoidname);

in the end, add a loop that sleeps for 20Msec so it doesn’t exit the main until turned off.


#7

Thanks that helps a lot


#8

When and why are you recommending a loop that sleeps for 20Msec so it doesn’t exit the main until turned off?


#9
int main() {
    
    pre_auton();

    Competition.autonomous(autonomous);
    baseEncoderReset();
    Competition.drivercontrol(usercontrol);

    while (1) {
        vex::task::sleep(20);
    }
}

#10

After compiling the program on to the brain, turn on your controller and click the right arrow go to the programs section. Make sure your controller is paired with the V5 brain on your robot. Then select the programs section by clicking A. Then select the program you downloaded by clicking the left and right arrows until you get to it, and then click A. Then select timed run, by scrolling right once and clicking A. It will show you that there is 15 seconds for autonomous and 1:45 for driver control. Click A, and then it will start the program. Don’t forget to position your robot first!