edu.wpi.first.wpilibj.smartdashboard.SendableChooser Java Examples

The following examples show how to use edu.wpi.first.wpilibj.smartdashboard.SendableChooser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoModeSelector.java    From FRC-2019-Public with MIT License 6 votes vote down vote up
public AutoModeSelector() {
    mStartPositionChooser = new SendableChooser<>();
    mStartPositionChooser.setDefaultOption("Left HAB 2", StartingPosition.LEFT_HAB_2);
    mStartPositionChooser.addOption("Right HAB 2", StartingPosition.RIGHT_HAB_2);
    mStartPositionChooser.addOption("Right HAB 1", StartingPosition.RIGHT_HAB_1);
    mStartPositionChooser.addOption("Left HAB 1", StartingPosition.LEFT_HAB_1);
    mStartPositionChooser.addOption("Center HAB 1", StartingPosition.CENTER_HAB_1);

    SmartDashboard.putData("Starting Position", mStartPositionChooser);

    mModeChooser = new SendableChooser<>();
    mModeChooser.setDefaultOption("Drive By Camera", DesiredMode.DRIVE_BY_CAMERA);
    mModeChooser.addOption("Do Nothing", DesiredMode.DO_NOTHING);
    mModeChooser.addOption("Rocket 1", DesiredMode.LOW_ROCKET);
    mModeChooser.addOption("Rocket 2", DesiredMode.MIDDLE_ROCKET);
    mModeChooser.addOption("Cargo Ship 2 Hatch", DesiredMode.SIDE_CARGO_SHIP_HATCH);
    mModeChooser.addOption("Front Then Side Cargo Ship",
            DesiredMode.FRONT_THEN_SIDE_CARGO_SHIP);
    mModeChooser.addOption("Test control flow", DesiredMode.TEST_CONTROL_FLOW);
    mModeChooser.addOption("Drive Characterization - Straight Line", DesiredMode.DRIVE_CHARACTERIZATION_STRAIGHT);
    mModeChooser.addOption("Drive Characterization - TUrn in Place", DesiredMode.DRIVE_CHARACTERIZATION_TURN);
    SmartDashboard.putData("Auto mode", mModeChooser);
}
 
Example #2
Source File: AutoModeSelector.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
public AutoModeSelector() {
    mModeChooser = new SendableChooser<>();
    mModeChooser.addDefault("Cross Auto Line", DesiredMode.CROSS_AUTO_LINE);
    mModeChooser.addObject("Do Nothing", DesiredMode.DO_NOTHING);
    mModeChooser.addObject("Simple switch", DesiredMode.SIMPLE_SWITCH);
    mModeChooser.addObject("Scale AND Switch", DesiredMode.SCALE_AND_SWITCH);
    mModeChooser.addObject("Only Scale", DesiredMode.ONLY_SCALE);
    SmartDashboard.putData("Auto mode", mModeChooser);

    mStartPositionChooser = new SendableChooser<>();
    mStartPositionChooser.addDefault("Right", StartingPosition.RIGHT);
    mStartPositionChooser.addObject("Center", StartingPosition.CENTER);
    mStartPositionChooser.addObject("Left", StartingPosition.LEFT);
    SmartDashboard.putData("Starting Position", mStartPositionChooser);

    mSwitchScalePositionChooser = new SendableChooser<>();
    mSwitchScalePositionChooser.addDefault("Use FMS Data", SwitchScalePosition.USE_FMS_DATA);
    mSwitchScalePositionChooser.addObject("Left Switch Left Scale", SwitchScalePosition.LEFT_SWITCH_LEFT_SCALE);
    mSwitchScalePositionChooser.addObject("Left Switch Right Scale", SwitchScalePosition.LEFT_SWITCH_RIGHT_SCALE);
    mSwitchScalePositionChooser.addObject("Right Switch Left Scale", SwitchScalePosition.RIGHT_SWITCH_LEFT_SCALE);
    mSwitchScalePositionChooser.addObject("Right Switch Right Scale", SwitchScalePosition.RIGHT_SWITCH_RIGHT_SCALE);
    SmartDashboard.putData("Switch and Scale Position", mSwitchScalePositionChooser);

}
 
Example #3
Source File: Robot.java    From PowerUp-2018 with GNU General Public License v3.0 4 votes vote down vote up
/** runs when robot is turned on */
	public void robotInit() {
		/// instantiate bot chooser
		botChooser = new SendableChooser<>();
		botChooser.addDefault(Bot.TEUFELSKIND.toString(), Bot.TEUFELSKIND);
		botChooser.addObject(Bot.OOF.toString(), Bot.OOF);
		SmartDashboard.putData("Bot", botChooser);

		if (botChooser.getSelected() != null){
			bot = botChooser.getSelected();
		} else {
			bot = Bot.OOF;
		}

			DriverStation.reportWarning("ROBOT STARTED; GOOD LUCK", false);
		/// instantiate subsystems
//			SUB_ARDUINO = new SubsystemArduino();
			SUB_MANIPULATOR = new SubsystemManipulator();
			SUB_CLAMP = new SubsystemClamp();
			SUB_COMPRESSOR = new SubsystemCompressor();
			SUB_DRIVE = new SubsystemDrive();
			
			SUB_DRIVE.pid.setPIDF(.5, 0, 0, 0);
			
			SUB_HOOK = new SubsystemHook();
			SUB_MAST = new SubsystemMast();
			vision = new Vision();

		/// instantiate operator interface
			oi = new OI();

			
			
		/// instantiate drivetrain chooser
				driveChooser = new SendableChooser<>();
				driveChooser.addDefault(Drivetrain.ROCKET_LEAGUE.toString(), Drivetrain.ROCKET_LEAGUE); // set default to RL drive
				for(int i = 1; i < Drivetrain.values().length; i++) { 
					driveChooser.addObject(Drivetrain.values()[i].toString(), Drivetrain.values()[i]); } // add each drivetrain enum value to chooser
				SmartDashboard.putData("Drivetrain", driveChooser); //display the chooser on the dash
			
		/// instantiate position chooser
				positionChooser = new SendableChooser<>();
				positionChooser.addDefault(Position.CENTER.toString(), Position.CENTER); // set default to center
				for(int i = 1; i < Position.values().length; i++) { 
					positionChooser.addObject(Position.values()[i].toString(), Position.values()[i]); } // add each position enum value to chooser
				SmartDashboard.putData("Position", positionChooser); //display the chooser on the dash

		/// instantiate goal chooser
				goalChooser = new SendableChooser<>();
				goalChooser.addDefault(Goal.NOTHING.toString(), Goal.NOTHING); // set default to nothing
				for(int i = 1; i < Goal.values().length; i++) { 
					goalChooser.addObject(Goal.values()[i].toString(), Goal.values()[i]); } // add each autonomous goal to chooser
				SmartDashboard.putData("Goal", goalChooser); //display the chooser on the dash
			
		/// instantiate bot chooser
				botChooser = new SendableChooser<>();
				botChooser.addDefault(Bot.TEUFELSKIND.toString(), Bot.TEUFELSKIND);
					botChooser.addObject(Bot.OOF.toString(), Bot.OOF); 
				SmartDashboard.putData("Bot", botChooser);
				
				
				
		/// instantiate cameras
			vision.startScrewCameraThread();
			vision.startFrameCameraThread();

		SmartDashboard.putData("Sub_Drive", SUB_DRIVE);
		DriverStation.reportWarning("SUBSYSTEMS, CHOOSERS INSTANTIATED", false);
	}