Calling more than one autonomous program


I was wondering if there was a way to call a certain autonomous program in v5 if we have more than one program?



Hello, to clear up what your asking, do you mean via the cortex LCD for testing purposes? Like, for example, testing multiple programs without reconnecting the brain to your VCS?



Yes. In the upper left of VCS you can choose which of 8 slots the code goes into. Place different codes in different slots instead of overwriting them by placing them in the same slot. Now on the brain you can select which of those up to 8 programs you want to use.

You can also make different versions of a single code that checks for input from the user, and that input can be done on the brain, too. That will require you to code buttons and accepting input from the brain. It’s not quite the same as what you asked, but it accomplishes similar things.



I’m not sure that these other responses fit what you’re asking. I take it you mean for competitions.
I would just use a potentiometer and “lock” it into certain angles to choose your autonomous. Then run If-Then statements in your code to check to see where the potentiometer is. For example, if the potentiometer has a value of 0-150, run the first code. If it has a value of 175-325, run another program. If it reads more, then don’t do anything.

Alternatively, you could use an array of bump switches you use rubber bands to hold down throughout the match. You would run the same type of code, checking to see which one is pressed.

If you want to get really fancy, then you could use a line follower, and have different colored cards you place in front of it. Each color would give it a different reading, and you use that reading to choose your code.

Mechanically, there are lots of ways to do it. If you wanted to actually use the V5 Brain to choose your code… well… I’m not sure. I suppose you could have 8 different autonomous codes all paired with an exact copy of your Driver Control code. You would just run the code that has your desired autonomous.



You definitely can. Since you are using V5, things are going to get much easier for you. You have several ways to do it:

  1. You can download up to 8 programs on V5. This method requires you to have each autonomous on its own program (which I don’t think is great way to do it but you definitely can).
  2. Use the Brain’s touch screen to create menu selections and you can create as many buttons/menu you like for autonomous. I would start with JPearman’s button example:


put all the autons into one file

use a potentiometer as a selector

use enum to define your steps

use if statement to define variable that selects beginning step for what auton you want to run

use switch and case to change between steps



If making your own menu system with the v5 touch screen scares you PROS has an Lcd screen emulator that acts identically to the old cortex Lcd so programming a menu is even easier.



The logic is fairly similar to the old method of loading different autonomous programs to the Cortex and selecting them with the LCD screen. Using case switching still works. Now you can do it with the controller buttons and print the selected program to the brain screen or controller screen instead of the LCD. This has been posted on many times so here’s a reference.



Don’t the controller buttons not work when the robot is disabled?



You set the selection up in your pre-autonomous.



@tabor473 Correct.

@Trobotics @536Mentor The V5 Brain cannot read joystick and button inputs from the handheld controller while in Disabled state. That is, when the handheld controller is receiving a Disabled (or Autonomous) competition signal it does not send out joystick or button information at all. I would steer clear of using the joysticks and buttons to set autonomous programs as it requires your robot not be hooked up to the match control while setting up the robot - which is exactly when you need to be hooking up to the match control.



This is why my original two suggestions were to use the V5 brain’s touch screen. You can set up multiple programs with the same user control. Or you can set up multiple cases within a single autonomous program and choose which cases. Both work, and you can clearly read your different options while choosing them. For example, you might make a red button and a blue button when marking which color you are among the multiple cases.



@John TYler That’s intriguing. I tested it with the competition switch and it worked fine. I take it the competition switch doesn’t work the same way as the actual field control system?



@Trobotics VEXos gives user programs the ability to know whether they are attached to a competition switch or field control tower, so it’s possible that VCS does not suppress while Disabled with a switch but we’re ignoring the switch vs. field difference in RMS. It’s also possible the firmware has changed since I last tested it. I suppose I’ll have to check next time I’m in the office whether this is a RMS/VCS difference or something changed in VEXos since I last tested it (which I’m thinking could be the case, as it was probably before 1.0.2).



I think it’s time we ask the big guy, @jpearman.



Could you share a sample code of how to select multiple programs on the V5 brain sreen?