Need A Little Help On How To Make Autonomous Switcher

So in this video by Ri3D (https://www.youtube.com/watch?v=WbSfOFmx8LI&t=39) the guy mentions how the thing attached to the RoboRIO can switch between different autonomous for when they’re needed. I was wondering how could I assemble and program one? I’m a rookie programmer from a rookie team and one thing I learned from my first regional event (which we surprisingly ended up in 14th) is that the majority of the time between matches I’m recoding the autonomous and uploading it to my robot which reduced my time to talk with my alliance members and make a strategy as I’m also the team’s driver.

Most of the time I’m either switching my autonomous to move forward to a tote pick-up and move forward and vice versa with little tweaks here and there. So having this would have pretty much been a life saver in my last event. If only I had seen this earlier.

Being a rookie programmer with knowledge only on basic Java, I was wondering how I could make something similar to what was shown in the video. I know he’s using a screen with buttons on the RIOdunio, but Andy Mark is selling a whole kit with a touch screen. So what I’m asking for is pretty much a full tutorial on how to assemble and code an interface that would let me switch between different autonomous.

I’m potentially leaving for uni next year and I want to put my team’s next year coder in the best possible position because learning to code a robot is a little overwhelming. This would help out tremendously.

TL : DR) What I’m asking for is pretty much a full tutorial on how to assemble and code an interface that would let me switch between different pre-coded autonomous like the one shown in here https://www.youtube.com/watch?v=WbSfOFmx8LI&t=39 rather than having to hooking up a laptop every time.

This can be done on the robot, but a lot of teams find it even easier to put on their driver station (perfectly legal, as long as it isn’t touched or intereacted with during the actual autonomous period). Simply use a device which can pass a signal to the roboRIO, or to the TI breakout board you got in your kit of parts for custom driver station components. (could be any of a number of things…a potentiometer hooked to an analog input, a series of dip switches or jumpers on digital inputs, etc.)

In your code, you would load all possible autonomous modes on to the roboRIO. When autonomous starts, the first thing you do is read the value of this device. Using if-else statements, or a case structure, you would tell your robot to do one of any number of possible autonomous modes.

I would use SmartDashboard/SendableChooser, it’ll be easier.

On the RoboRio, you can use the Digital IO and/or the Analog IO ports.

You set up a switch (single pole, double throw), with the outside posts going to +5 and ground (red and black wires), and the middle post connected to signal (white). You then see whether the switch is on/off for DIO, or above or below 2.5 volts for AIO.

The easier way is to use smart dashboard. I prefer writing a variable to the smart dashboard, and reading it back. The variable can be changed at any time, up to the time when autonomous starts. You then read the value during Autonomous Init to determine which autonomous program to run.

I didn’t think of that until now. But making the autonomous switcher seems like a cool project to work on now that my season is over.

i usually use a DIO switch on the bot.

I read the value in the robot init method so when i place the bot on the field
I have to select the auto mode before turning on the power.

Works well :slight_smile:

You can also use this board https://www.estoprobotics.com/estore/index.php?_a=viewProd&productId=33 which plugs into your DS laptop via usb and enumerates like a joystick with analog and digital inputs. You can then build a box on your DS that has switches which you can read in your auton code to determine which auton routine to run.

If you were using python, we provide an object that will automatically recognize all the modules in a package (directory) and add them to SmartDashboard for you. Reference.

It should be pretty easy to write an equivalent in Java using reflection/etc. I’m surprised I’ve never seen one.

If you’re using smart dashboard and the command based robot project its real simple.

There’s even a guide: http://tinyurl.com/autoChooser

Command Based seemed a little intimidating for a rookie team like us with little man power, so we just did what we could with Iterative and we stayed as far away as possible from smart dashboard only because we didn’t want to mess up anything that was already functional and not know how to fix it in time for the competition. But maybe now would be a good time to try these features out and learn how to use them to mentor the team for next year.

That’s ironic given command based is supposed to be “easier to use”.

In the past I know teams to have used the disabled routines in the C++/Java libraries in which they set autonomous state based on joystick button press. If joystick 1 is pressed then autonomous 1 is run and so on. Its simple and doesn’t require any new hardware. I do believe this is still legal because you would do this before the MC does the countdown, and autonomous actually starts. Make sure the robot is connected fully to the driver station in order for this to actually work.

We have used Sendable Chooser, but had issues with stability with SmartDashboard usage that year and quit using SmartDashboard all together.

Last year, I believe it was, we used the DigitalInput switches on the IO page the DriverStation software as switches to select an autonomous program. But those went away this year. Pity.

We are using Preferences this year, but are having problems with the preference values getting stored in the file when set in SmartDashboard. So… we’ve been editing the Preferences file on the DS computer, then copying to the Robot with FTP. I’m debating going back to a Sendable Chooser, or using a Sendable chooser to set the Preference.

Before SmartDashboard, et al, we would use a series of switches to select the number of the program we wanted to run.

Anyway, regardles of which of these mechanisms we’ve used, the chosen routine gets identified at RobotInit or AutonomousInit (depending on the actual mechanism), and executed at the appropriate time.

RE: Command Based robot vs Interative. If your robot needs to do two things at once, Command Based is the way to go. Otherwise, Iterative is okay.

So what do you think the people in the video that i attached in the original post were doing?