Auton Codes

As competitions are getting started in my area, it is time for my team to start programming autonomous programs for the comps. Being our second year, we are familiar with Robot C, but not experts.

For instance, we know how to program an auton, but we can only have one thing perform at a time (Flywheel, drivetrain, or lift)

Do you guys have any help or advice to offer? **If you know of any tutorials online which explain how to program an auton, that would be great.
**
Additionally, I have seen parts on robots which people use to select an autonomous program. Does anyone know what this is? How does it work? How do we program it?

Thanks, and good luck on your seasons.

Often times people will use a potentiometer which measures the rotation of an axle. basically they put an axle in there and then mark a spot on it for the “pointer” and then mark spots on the potentiometer to represent where the axle should be for a certain auto. the potentiometer reads the rotation of the axle and it selects the auto to use based on which marking its at. (you have to measure what the reading is for the axle at each of the markings beforehand)

Try using tasks to do multiple things at once. Basically, using


startTask(taskName);

will start a task but keep moving on, so say you had code like this:


task doThis () {
// does something
}

task main () {
startTask(doThis);
// robot starts doing something

// make your robot do something else cool
}

You will need to learn how to properly time things, but something like this you can get your robot to start multi-tasking.
EDIT: Here’s a nice resource that I found: http://www.robotc.net/wikiarchive/Multitasking_tips

some teams will also use an LCD to select different autonomous programs, the LCD has 3 buttons on the bottom which can be used to change a variable in the code

if (left_lcd_button_pressed) {
  auto_number = 1;
}
else if (right_lcd_button_pressed) {
 auto_number = 2;
}

then in the autonomous task you have a switch statement that will run a different autonomous for different auto_number values

kind of related but kind of not: how do you do tasks in VCS pro?


task* p = new vex::task(FLControl);

Where the method inside the parentheses is a function that returns an integer.

thenk

Use jumpers for autonomous selection. It’s a little orange tab that you plug into a v5 port. You can then read in the code whether it is in port one (auto one), two (auto two) etc. as for only running one thing at a time, I use a function that sets the speed of the nessessary motors. Once set ,the motors will continue to run until told to stop. This can allow you to run multiple things at once.