Robot
There are only few changes required in the main Robot class.
1import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
2import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
3import frc.robot.commands.auto.DriveMotor;
4
5/**
6 * This function is called once each time the robot enters Disabled mode.
7 */
8@Override
9public void disabledInit()
10{
11 //Check to see if autoChooser has been created
12 if(null == RobotContainer.autoChooser)
13 {
14 RobotContainer.autoChooser = new SendableChooser<>();
15 }
16 //Add the default auto to the auto chooser
17 RobotContainer.autoChooser.setDefaultOption("Drive Motor", "Drive Motor");
18 RobotContainer.autoMode.put("Drive Motor", new DriveMotor());
19 SmartDashboard.putData(RobotContainer.autoChooser);
20}
Lines
1-3are the required imports.Lines
8-20are the modifications made to the previously emptydisabledInit().Lines
12-15check if autoChooser has beend created yet. If not then it creates autoChooser as a new SendableChooser.Lines
17-19add the default option to autoChooser and add autoChooser to the smartdashboard.