Do you have to code 4 diffrent programs?

I am new to coding and I noticed watching scrims on YouTube that there are 4 different places you can be on the field. Do you get to choose what side you can be on? Do you have to do 4 different lines of code and if so how do you select the certain corner you are in during competition?

so if you want to (I recommend it) you should code 4 different autonomi, more if you want to. but 4 is a good number. one for each goal zone on the field. you can download each autonomous into a different code slot on your brain, that is if your using v5, with cortex its a bit trickier.

2 Likes

So in competition do you get to select which one that is corresponding to where you are ?

Yes

1 Like

on your controller when you run a program you can select the program that runs the auton you want yes.

1 Like

Oh ok thx for the help.

Clarification, though, you absolutely do not have to. It’s definitely a good idea but you don’t have to.

2 Likes

I have a couple months before my competition so might as well right .lol

5 Likes

Most teams have 4 different programs. But your robot can actually start anywhere along that wall.

If you are comfortable with coding - here is a different approach to autonomous selection - one program and 8 variables to enable or disable features. Last year this was used to select which alliance, which starting tile, deciding to park or not, and to shoot pre-load or not. It was written using VCS and ports to VEXcode:

5 Likes

you should at least have 4 coded.However, my coach recommends to make almost double that because “…you never know what your alliance has for autonomous…”.

1 Like

Hence why I advise my teams to have one program that you can handle many different scenarios - last season they used 32 of the 256 possibilities.

Having 4 different programs works but is very impractical. For me, I use the brain GUI and a custom button class I created to give me a GUI to switch between different autonomi. In essense, if a certain button is pressed, set an integer to a certain value. Then, in your autonomous void, use a switch block to run a set autonomous for each value of that int. I can share example code if needed.

2 Likes

The field is symmetric, so just adding in a …*dir… to your values when you need them to reverse will allow you to simply create int dir; and change it as needed.

To select an auton program during preauton, check which buttons you hit on the controller(easy), print a series of questions to the controller screen that you respond to sequentially (medium), or go ham with a GUI on the brain (why do you guys insist on touching the LCD screen every match when you can print to your controller). Use that to pick the alliance color and field side.

… then later on
if (side==red) {dir=1;}
else {dir = -1;}

Then replace a turn of 90 degrees with 90*dir and blammo.

Additionally you could have a few logical cases to differentiate near from far and then you won’t have to change much if you need to reprogram in the future.

1 Like

As a programmer, it is easier to manage a single program that allows for picking different autons. However, your driver needs to be in the loop or else they may not know how to use it,

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.