Java Code Examples for edu.wpi.first.wpilibj.smartdashboard.SmartDashboard#putData()
The following examples show how to use
edu.wpi.first.wpilibj.smartdashboard.SmartDashboard#putData() .
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 |
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 |
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: OI.java From PowerUp-2018 with GNU General Public License v3.0 | 4 votes |
/** assigns what every SmartDash and controller button does */ public OI() { /// manipulator wheels Button spinIn = new JoystickButton(OPERATOR, Xbox.RB); spinIn.whileHeld(new ButtonCommandEat()); Button spinOut = new JoystickButton(OPERATOR, Xbox.LB); spinOut.whileHeld(new ButtonCommandSpit()); /// manipulator clamp Button toggleClamp = new JoystickButton(OPERATOR, Xbox.A); toggleClamp.toggleWhenActive(new ToggleCommandClamp()); /// candy cane Button toggleHook = new JoystickButton(OPERATOR, Xbox.B); toggleHook.toggleWhenActive(new ToggleCommandHook()); /// drop the mast Button dropIt = new JoystickButton(OPERATOR, Xbox.X); dropIt.toggleWhenPressed(new ButtonCommandHitTheDeck()); /// Reversing mode Button toggleReverse = new JoystickButton(DRIVER, Xbox.Y); toggleReverse.toggleWhenPressed(new ToggleCommandReverse()); /// Docking mode Button toggleDock = new JoystickButton(DRIVER, Xbox.X); toggleDock.toggleWhenPressed(new ToggleCommandDock()); /// To Compress, or Not To Compress. It is now an option. SmartDashboard.putData("Disable Compressor", new ToggleCommandKillCompressor()); /// PID SmartDashboard.putData("Kill PID", new ToggleCommandKillPID()); SmartDashboard.putNumber("Right Encoder Position", 0); SmartDashboard.putNumber("Left Encoder Position", 0); /// limit switch displays SmartDashboard.putBoolean("Lower Screw", true); SmartDashboard.putBoolean("Upper Screw", false); SmartDashboard.putBoolean("Lower Pinion", true); SmartDashboard.putBoolean("Upper Pinion", false); SmartDashboard.putNumber("Left inches", 0); SmartDashboard.putNumber("Right inches", 0); DriverStation.reportWarning("OI IS INSTANTIATED", false); /// Cyborg command testers SmartDashboard.putData("Drive Direct", new CyborgCommandDriveDirect(Util.getAndSetDouble("Drive Direct Power", 0))); SmartDashboard.putData("Drive Distance", new CyborgCommandDriveDistance(Util.getAndSetDouble("Drive Distance Inches", 0))); SmartDashboard.putData("Drive Until Error", new CyborgCommandDriveUntilError()); SmartDashboard.putData("Rotate Degree", new CyborgCommandRotateDegrees(Util.getAndSetDouble("Rotate Degrees", 0))); SmartDashboard.putData("Spit", new CyborgCommandSpit((long)Util.getAndSetDouble("Spit Time", 500))); SmartDashboard.putData("Raise to Position: Pinion Up", new CyborgCommandGrow(Mast.PINION_UP)); SmartDashboard.putData("Raise to Position: Pinion Down", new CyborgCommandGrow(Mast.PINION_DOWN)); SmartDashboard.putData("Raise to Position: Screw Up", new CyborgCommandGrow(Mast.SCREW_UP)); SmartDashboard.putData("Raise to Position: Screw Down", new CyborgCommandGrow(Mast.SCREW_DOWN)); }
Example 4
Source File: Robot.java From PowerUp-2018 with GNU General Public License v3.0 | 4 votes |
/** 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); }