Java 类edu.wpi.first.wpilibj.buttons.Button 实例源码

项目:Stronghold    文件:OI.java   
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());
    }
项目:RecycleRush    文件:OI.java   
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));
}
项目:scorpion    文件:LogitechF310.java   
public Button getLT()
{
    return new Button() {

        @Override
        public boolean get() {
            return getLeftTriggerAxis() > .5;
        }
    };
}
项目:scorpion    文件:LogitechF310.java   
public Button getRT()
{
    return new Button() {

        @Override
        public boolean get() {
            return getRightTriggerAxis() > .5;
        }
    };
}
项目:scorpion    文件:LogitechF310.java   
public Button getUp()
{
    return new Button() {

        @Override
        public boolean get()
        {
            return getPOV() == 0;
        }
    };
}
项目:scorpion    文件:LogitechF310.java   
public Button getRight()
{
    return new Button() {

        @Override
        public boolean get()
        {
            return getPOV() == 90;
        }
    };
}
项目:scorpion    文件:LogitechF310.java   
public Button getDown()
{
    return new Button() {

        @Override
        public boolean get()
        {
            return getPOV() == 180;
        }
    };
}
项目:scorpion    文件:LogitechF310.java   
public Button getLeft()
{
    return new Button() {

        @Override
        public boolean get()
        {
            return getPOV() == 270;
        }
    };
}
项目:ProjectShifter    文件:OI.java   
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());
}
项目:TreeShirtCannon-2015    文件:OI.java   
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());
}
项目:FRC-5800-Stronghold    文件:CommandWaitForButton.java   
public CommandWaitForButton(Button button) {
    super(null);
    b = button;
}
项目:FRC-5800-Stronghold    文件:Command5800.java   
public final Command5800 setCancelWhenReleased(Button button) {
    isWhileHeld = true;
    this.button = button;
    return this;
}
项目:scorpion    文件:LogitechF310.java   
public Button getX2()
{
    return new JoystickButton(this, x);
}
项目:scorpion    文件:LogitechF310.java   
public Button getY2()
{
    return new JoystickButton(this, y);
}
项目:scorpion    文件:LogitechF310.java   
public Button getA()
{
    return new JoystickButton(this, a);
}
项目:scorpion    文件:LogitechF310.java   
public Button getB()
{
    return new JoystickButton(this, b);
}
项目:scorpion    文件:LogitechF310.java   
public Button getLB()
{
    return new JoystickButton(this, lb);
}
项目:scorpion    文件:LogitechF310.java   
public Button getRB()
{
    return new JoystickButton(this, rb);
}
项目:scorpion    文件:LogitechF310.java   
public Button getBack()
{
    return new JoystickButton(this, back);
}
项目:scorpion    文件:LogitechF310.java   
public Button getStart()
{
    return new JoystickButton(this, start);
}
项目:scorpion    文件:LogitechF310.java   
public Button getLeftStick()
{
    return new JoystickButton(this, leftStick);
}
项目:scorpion    文件:LogitechF310.java   
public Button getRightStick()
{
    return new JoystickButton(this, rightStick);
}
项目:Vision    文件:OI.java   
public OI() {
    xbox = new Joystick(JOYSTICK_PORT);
    Button a = new JoystickButton(xbox, BUTTON_A);
    a.whenPressed(new TurnToFaceTapeCommand());
}
项目:Nutrons2013    文件:ReverseButton.java   
public ReverseButton(Button btn) {
    this.btn = btn;
}
项目:Nutrons2013    文件:ToggleButton.java   
public ToggleButton(Button newButton) {
    btn = newButton;
}
项目:BadRobot2013    文件:OI.java   
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");
    }
}
项目:mecanumCommand    文件:OI.java   
public static Button getTriggerButton() {
    return triggerButton;
}
项目:mecanumCommand    文件:OI.java   
public static Button getGyroResetButton() {
    return gyroReset;
}
项目:FRC-5800-Stronghold    文件:JoystickButtonList.java   
/**
 * 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;
}
项目:Cogsworth    文件:HumanInput.java   
/**
 * 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);
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "X".
 * 
 * @return the button; never null
 */
public Button getXButton() {
    return this.xButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "Y".
 * 
 * @return the button; never null
 */
public Button getYButton() {
    return this.yButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "A".
 * 
 * @return the button; never null
 */
public Button getAButton() {
    return this.aButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "B".
 * 
 * @return the button; never null
 */
public Button getBButton() {
    return this.bButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "Back".
 * 
 * @return the button; never null
 */
public Button getBackButton() {
    return this.backButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "Start".
 * 
 * @return the button; never null
 */
public Button getStartButton() {
    return this.startButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "LB".
 * 
 * @return the button; never null
 */
public Button getLBButton() {
    return this.lbButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * Get the controller's button that is labeled "RB".
 * 
 * @return the button; never null
 */
public Button getRBButton() {
    return this.rbButton;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * 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;
}
项目:2014-Robot    文件:LogitechController.java   
/**
 * 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;
}