Autonomous Chooser

Oh geese I’m trying 6😂. Do you think 6 is too much?

Yeah, it could be as simple as a switch statement that reads the value of the analoginput and does something different based on the value. I’d still do Commands and CommandGroups and it would still be similar to the code shown earlier in the thread.

Here’s how my team did it in 2017. I had to reach back that far because we didn’t really have autos last year (sandstorm) and in 2018 it was complicated because of the switch/scale randomization.

The autonomous command list is defined in Robot.java:

2 Likes

Considering that Einstein teams probably have more than 6, it should be perfectly fine

1 Like

It’s good to have multiple autos, but keep in mind that your drive team will almost never try an untested autonomous in a finals match or late in qualifiers. 6 well tested autos is good, but if some are untested, they won’t be used when you need a win.

I plan to make many autos, but my first goal will be to refine one or two autonomous routines.

I would use command groups. The idea would be to create your commands beforehand, add them to a chooser, then run the selected command when autonomous starts.

Some teams will also create complex selectors to make choosing autonomous modes easier. However, this late in the season, I recommend making a very simple chooser by only using one SendableChooser instead of multiple.

If you’re only having two then a toggle switch into a digital input would be even simpler.

We’ve used SendableChooser with SmartDashboard and that works fine. Our 2018 Robot code has an example.

		// Autonomous mode selector
	chooser.addDefault("Right", new AutoRight());
	chooser.addObject("Left", new AutoLeft());
	chooser.addObject("Left OOW", new AutoLeftOutOfWay());
	chooser.addObject("Center", new AutoCenter());
	chooser.addObject("Cross the Line", new AutoCrossTheLine());

	SmartDashboard.putData("Auto mode", chooser);

We have found it useful to echo back the chosen command in disabledPeriodic to give the drive team confidence that the correct autonomous has been selected.

SmartDashboard.putString("Auto Command", chooser.getSelected().getName());

Then, in autonomousInit, get the command and schedule it…which is what the Command based robot template does.

		autonomousCommand = chooser.getSelected();

	// schedule the autonomous command (example)
	if (autonomousCommand != null) {
		autonomousCommand.start();
	}

For a Regional or first District event, I like to start with 2 primary routines and switch between those if necessary. This allows us to perfect those two routines on a real field. This means that even on Einstein we would have 2 “perfect” routines, and however many other options that are “good”.

So from that perspective, a simple switch is perfect.

Number of autos also depends on the game. I suspect most teams settle on one or two that they refine and become known for.

In Stronghold, we had a different auto to tackle the different defenses, some just to reach them, some to breach them. Our “fancy” one was the low bar auto, that would then drive to the batter and shoot a boulder into the low goal. We had two variations of that, one using vision, and one without. So right there, that was 6-8 different auto modes.

In Power Up, we had 2 or 3 that we focused on: one was a center position that would dump a cube into the switch (left or right depending on the field data) that evolved into a 2-cube switch auto. We also had a “start left” and “start right” setting that would attempt to do a scale auto if the field randomness worked in our favour, but fall back to a switch if it didn’t.

With the 12-position selector we also usually build a mode that does nothing and one that just drives forward. We don’t plan to use them in competition, of course.

My shuffle is 2019.4.1 Do i need to update this? And where? I’m not seeing it on the docs.wpilib.org

Is your control system updated? I’m not sure if mine is the same. You can always download the update here. I usually check the github once a day for updates.

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