public OI() { leftController.setDeadband(0.2); rightController.setDeadband(0.2); //Catapult Button launch = new JoystickButton(leftController, XboxController.RightBumper); //Button autoAim = new JoystickButton(driveController, XboxController.Start); Button lockLatch = new JoystickButton(leftController, XboxController.LeftBumper); Button LaunchGroup = new JoystickButton(leftController, XboxController.Back); launch.whenPressed(new Launch()); lockLatch.whenPressed(new LockLatch()); //autoAim.whenPressed(new AutoAim()); LaunchGroup.whenPressed(new LaunchGroup()); //Intake Button lowerIntake = new JoystickButton(leftController, XboxController.X); Button raiseIntake = new JoystickButton(leftController, XboxController.Y); Button posCatForLoad = new JoystickButton(leftController, XboxController.B); Button posCatForLaunch = new JoystickButton(leftController, XboxController.A); lowerIntake.whenPressed(new LowerIntake()); raiseIntake.whenPressed(new RaiseIntake()); posCatForLoad.whenPressed(new PosCatForLoad()); posCatForLaunch.whenPressed(new PosCatForLaunch()) ; // //Driving // Button switchDirection = new JoystickButton(driveController, XboxController.Start); // switchDirection.whenPressed(new SwitchDirection()); }
public OI() { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS functionJoystick = new Joystick(1); driverJoystick = new Joystick(0); // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS SmartDashboard.putData("Reset encoder", new ResetEncoder()); SmartDashboard.putData("Reset encoder", new ResetGyro()); Button armsMoveIn = new JoystickButton(functionJoystick, 1); // A button Button armsMoveOut = new JoystickButton(functionJoystick, 2); // B button Button boomUp = new JoystickButton(functionJoystick, 3); Button boomDown = new JoystickButton(functionJoystick, 4); Button rcUp = new JoystickButton(functionJoystick, 6); Button rcDown = new JoystickButton(functionJoystick, 5); armsMoveIn.whileHeld(new ArmCommand(true)); armsMoveOut.whileHeld(new ArmCommand(false)); boomUp.whileHeld(new ElevatorCommand(true, false)); boomUp.whenReleased(new ElevatorCommand(true, true)); boomDown.whileHeld(new ElevatorCommand(false, false)); boomDown.whenReleased(new ElevatorCommand(false, true)); rcUp.whileHeld(new RecycleContainerCommand(true, false)); rcUp.whenReleased(new RecycleContainerCommand(true, true)); rcDown.whileHeld(new RecycleContainerCommand(false, false)); rcDown.whenReleased(new RecycleContainerCommand(false, true)); }
public Button getLT() { return new Button() { @Override public boolean get() { return getLeftTriggerAxis() > .5; } }; }
public Button getRT() { return new Button() { @Override public boolean get() { return getRightTriggerAxis() > .5; } }; }
public Button getUp() { return new Button() { @Override public boolean get() { return getPOV() == 0; } }; }
public Button getRight() { return new Button() { @Override public boolean get() { return getPOV() == 90; } }; }
public Button getDown() { return new Button() { @Override public boolean get() { return getPOV() == 180; } }; }
public Button getLeft() { return new Button() { @Override public boolean get() { return getPOV() == 270; } }; }
public OI(){ leftStick = new Joystick(1); rightStick = new Joystick(2); Button leftShift = new JoystickButton(leftStick, 1); Button rightShift = new JoystickButton(rightStick, 1); leftShift.whenPressed(new Shift()); rightShift.whenPressed(new Shift()); }
public OI() { xbox = new Joystick(JOYSTICK_PORT); Button a = new JoystickButton(xbox, BUTTON_A); Button rb = new JoystickButton(xbox, BUTTON_RB); a.whenPressed(new FireCommand()); rb.whenPressed(new ReloadCommand()); }
public CommandWaitForButton(Button button) { super(null); b = button; }
public final Command5800 setCancelWhenReleased(Button button) { isWhileHeld = true; this.button = button; return this; }
public Button getX2() { return new JoystickButton(this, x); }
public Button getY2() { return new JoystickButton(this, y); }
public Button getA() { return new JoystickButton(this, a); }
public Button getB() { return new JoystickButton(this, b); }
public Button getLB() { return new JoystickButton(this, lb); }
public Button getRB() { return new JoystickButton(this, rb); }
public Button getBack() { return new JoystickButton(this, back); }
public Button getStart() { return new JoystickButton(this, start); }
public Button getLeftStick() { return new JoystickButton(this, leftStick); }
public Button getRightStick() { return new JoystickButton(this, rightStick); }
public OI() { xbox = new Joystick(JOYSTICK_PORT); Button a = new JoystickButton(xbox, BUTTON_A); a.whenPressed(new TurnToFaceTapeCommand()); }
public ReverseButton(Button btn) { this.btn = btn; }
public ToggleButton(Button newButton) { btn = newButton; }
public void init() { primaryXboxController = new Joystick(PRIMARY_JOY); secondaryXboxController = new Joystick(SECONDARY_JOY); ALLIANCE_COLOR = DriverStation.getInstance().getAlliance().value; SmartDashboard.putBoolean("Alliance", ALLIANCE_COLOR == DriverStation.Alliance.kBlue_val); preferencesManagers = BadPreferences.getInstance(); //button that senses seconadry Right bumper press for shooter injection /*if (CommandBase.frisbeePusher != null) { Button injectFrisbee = new Button() { public boolean get() { return (secondaryXboxController.getRawButton(RB)); } }; injectFrisbee.whenPressed(new InjectFrisbee()); }*/ //press A to climb //if (CommandBase.climberArticulator != null) { Button climb = new Button() { public boolean get() { return (OI.getPrimaryRightTrigger() > 0); } }; climb.whenPressed(new ClimbForTenPoints()); //} if (CommandBase.shooterArticulator != null) { Button aim = new Button() { public boolean get() { return (isPrimaryYButtonPressed()); } }; aim.whenPressed(new AimWithCamera()); } if (!this.CONSOLE_OUTPUT_ENABLED) { System.out.println("Console output has been disabled from OI"); } }
public static Button getTriggerButton() { return triggerButton; }
public static Button getGyroResetButton() { return gyroReset; }
/** * Creates a 'button' holding a list of buttons that must all be pressed to trigger a command. * * @param buttons * The list of buttons. */ public JoystickButtonList(Button... buttons) { buttonList = buttons; }
/** * Register button to command * * @param b * button to register command to * * @param c * command to register to button */ public static void registerWhenPressedCommand(Button b, Command c) { b.whenPressed(c); }
/** * Get the controller's button that is labeled "X". * * @return the button; never null */ public Button getXButton() { return this.xButton; }
/** * Get the controller's button that is labeled "Y". * * @return the button; never null */ public Button getYButton() { return this.yButton; }
/** * Get the controller's button that is labeled "A". * * @return the button; never null */ public Button getAButton() { return this.aButton; }
/** * Get the controller's button that is labeled "B". * * @return the button; never null */ public Button getBButton() { return this.bButton; }
/** * Get the controller's button that is labeled "Back". * * @return the button; never null */ public Button getBackButton() { return this.backButton; }
/** * Get the controller's button that is labeled "Start". * * @return the button; never null */ public Button getStartButton() { return this.startButton; }
/** * Get the controller's button that is labeled "LB". * * @return the button; never null */ public Button getLBButton() { return this.lbButton; }
/** * Get the controller's button that is labeled "RB". * * @return the button; never null */ public Button getRBButton() { return this.rbButton; }
/** * Get the controller's button that is labeled "LT". * * @return the button; never null if {@link #getMode() mode} is {@link Mode#D}, or always null if {@link #getMode() mode} is * {@link Mode#X} */ public Button getLTButton() { return this.ltButton; }
/** * Get the controller's button that is labeled "RT". * * @return the button; never null if {@link #getMode() mode} is {@link Mode#D}, or always null if {@link #getMode() mode} is * {@link Mode#X} */ public Button getRTButton() { return this.rtButton; }