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

项目:Spartonics-Code    文件:OI.java   
public OI() {

        driveStick = new Joystick(RobotMap.DRIVE_STICK_NUMBER);
        driveButtons = new JoystickButton[13];

        auxiliaryStick = new Joystick(RobotMap.AUXILLIARY_STICK_NUMBER);
        auxiliaryButtons = new JoystickButton[13];

        for(int i = 1; i <= driveButtons.length - 1; i++) {
            driveButtons[i] = new JoystickButton(driveStick, i);
        }

        for(int i=1; i <= auxiliaryButtons.length - 1; i++){
            auxiliaryButtons[i] = new JoystickButton(auxiliaryStick, i);
        }

        //this.getButton(RobotMap.SHOOTER_CONTROL_BUTTON).whileHeld(new ShooterControl());
        this.getButton(2).whenPressed(new openIntake());
        this.getButton(3).whenPressed(new closeIntake());
        this.getButton(4).toggleWhenPressed(new IntakeIn());
        this.getButton(5).toggleWhenPressed(new IntakeOut());
        this.getButton(5).toggleWhenPressed(new stopIntake());
        this.getButton(4).whenPressed(new driveForward(20, .25));

    }
项目:FRC-2017-Command    文件:OI.java   
public OI(){
    JoystickButton x = new JoystickButton(controller, 3);
    JoystickButton y = new JoystickButton(controller, 4);
    JoystickButton a = new JoystickButton(controller, 1);
    JoystickButton b = new JoystickButton(controller, 2);
    JoystickButton rb = new JoystickButton(controller, 6);
    JoystickButton lb = new JoystickButton(controller, 5);
    JoystickButton start = new JoystickButton(controller, 8);
    JoystickButton back = new JoystickButton(controller,7);

    a.whileHeld(new PickupOn());
    b.whileHeld(new PickupReverse());
    y.whileHeld(new OpenGDS(5));
    x.whileHeld(new Climb());
    rb.whileHeld(new SpinVoltage(0.80, false));
    start.toggleWhenPressed(new ResetWinch());
    lb.whileHeld(new InvertedStickDrive());
}
项目:SteamWorks    文件:OI.java   
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

    logitech = new Joystick(0);

    shooterbutton = new JoystickButton(logitech, 1);
    shooterbutton.whileHeld(new shoot());


    // SmartDashboard Buttons
    SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
    SmartDashboard.putData("shoot", new shoot());

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    shootBackwardsButton = new JoystickButton(logitech, 2);
    shootBackwardsButton.whileHeld(new ShootReverse());

    LiftUPButton = new JoystickButton(logitech, 3);
    LiftReservseButton = new JoystickButton(logitech, 4);

    LiftUPButton.whileHeld(new LiftUP());
    LiftReservseButton.whileHeld(new LiftReverse());
}
项目:frc-robot    文件:Controller.java   
public Controller(int port) {

        // Controller
        joystick = new Joystick(port);

        // Buttons
        buttonA = new JoystickButton(joystick, Mappings.BUTTON_A);
        buttonB = new JoystickButton(joystick, Mappings.BUTTON_B);
        buttonX = new JoystickButton(joystick, Mappings.BUTTON_X);
        buttonY = new JoystickButton(joystick, Mappings.BUTTON_Y);
        buttonLeftBumper = new JoystickButton(joystick, Mappings.BUTTON_LEFTBUMPER);
        buttonRightBumper = new JoystickButton(joystick, Mappings.BUTTON_RIGHTBUMPER);

        // Axes
        axisLeftX = new JoystickAxis(joystick, Mappings.AXIS_LEFT_X, AXIS_THRESHOLD);
        axisLeftY = new JoystickAxis(joystick, Mappings.AXIS_LEFT_Y, AXIS_THRESHOLD);
        axisRightX = new JoystickAxis(joystick, Mappings.AXIS_RIGHT_X, AXIS_THRESHOLD);
        axisRightY = new JoystickAxis(joystick, Mappings.AXIS_RIGHT_Y, AXIS_THRESHOLD);
        axisLeftTrigger = new JoystickAxis(joystick, Mappings.AXIS_LEFT_TRIGGER, AXIS_THRESHOLD);
        axisRightTrigger = new JoystickAxis(joystick, Mappings.AXIS_RIGHT_TRIGGER, AXIS_THRESHOLD);
    }
项目:El-Jefe-2017    文件:OI.java   
public OI(){
    joystick = new Joystick(0);
    jyButton1 = new JoystickButton(joystick, 1);

    xbox = new Joystick(1);
    xbButton1 = new JoystickButton(xbox, 1);
    xbButton2 = new JoystickButton(xbox, 2);
    xbButton3 = new JoystickButton(xbox, 3);
    xbButton4 = new JoystickButton(xbox, 4);
    xbButton5 = new JoystickButton(xbox, 5);
    xbButton6 = new JoystickButton(xbox, 6);


    jyButton1.whileHeld(new FineControl());

    xbButton1.whileHeld(new Shoot());
    xbButton2.toggleWhenPressed(new IntakeToggle());
    xbButton3.toggleWhenPressed(new ToggleShooter());
    xbButton4.whenPressed(new ClawSet());
    xbButton5.whenPressed(new GripControl(0));
    xbButton6.whenPressed(new GripControl(1));

}
项目:FRC-2016    文件:XboxController.java   
/**
 * @param port of the controller.
 */
public XboxController(int port) {
    super(port);
    a = new JoystickButton(this, 1);
    b = new JoystickButton(this, 2);
    x = new JoystickButton(this, 3);
    y = new JoystickButton(this, 4);
    leftBumper = new JoystickButton(this, 5);
    rightBumper = new JoystickButton(this, 6);
    select = new JoystickButton(this, 7);
    start = new JoystickButton(this, 8);
    leftJoystickButton = new JoystickButton(this, 9);
    rightJoystickButton = new JoystickButton(this, 10);
    leftTrigger = new AnalogButton(this, 2, 0.1);
    rightTrigger = new AnalogButton(this, 3, 0.1);
}
项目:Stronghold_2016    文件:XboxController.java   
public XboxController(final int port) {
    super(port); // Extends Joystick...

    /* Initialize */
    this.port = port;
    this.controller = new Joystick(this.port); // Joystick referenced by
                                                // everything
    this.dPad = new DirectionalPad(this.controller);
    this.lt = new Trigger(this.controller, HAND.LEFT);
    this.rt = new Trigger(this.controller, HAND.RIGHT);
    this.a = new JoystickButton(this.controller, A_BUTTON_ID);
    this.b = new JoystickButton(this.controller, B_BUTTON_ID);
    this.x = new JoystickButton(this.controller, X_BUTTON_ID);
    this.y = new JoystickButton(this.controller, Y_BUTTON_ID);
    this.lb = new JoystickButton(this.controller, LB_BUTTON_ID);
    this.rb = new JoystickButton(this.controller, RB_BUTTON_ID);
    this.back = new JoystickButton(this.controller, BACK_BUTTON_ID);
    this.start = new JoystickButton(this.controller, START_BUTTON_ID);
    this.rightClick = new JoystickButton(this.controller, RIGHT_CLICK_ID);
    this.leftClick = new JoystickButton(this.controller, LEFT_CLICK_ID);
}
项目:Stronghold-2016    文件:OI.java   
public void initButtons() {
    //intakeButtonIn = new JoystickButton(secondary, RobotMap.INTAKE_BUTTON_IN);
    //intakeButtonOut = new JoystickButton(secondary, RobotMap.INTAKE_BUTTON_OUT);
    //shooterButtonIn = new JoystickButton(secondary, RobotMap.SHOOTER_BUTTON_IN);
    //shooterButtonOut = new JoystickButton(secondary, RobotMap.SHOOTER_BUTTON_OUT);
    //autoIntakeButton = new JoystickButton(secondary, RobotMap.AUTO_INTAKE_BUTTON);
    //pusherButton = new JoystickButton(secondary, RobotMap.PUSHER_BUTTON);
    //driveIntakeOut = new JoystickButton(secondary, RobotMap.INTAKE_BUTTON_OUT);
    //lockButton = new JoystickButton(secondary, RobotMap.LOCK_BUTTON);
    //autoAimButton = new JoystickButton(secondary, RobotMap.AUTO_AIM_BUTTON);
    //autoShootButton = new JoystickButton(secondary, RobotMap.AUTO_SHOOT_BUTTON);
    //autoIntakeButton = new JoystickButton(secondary, RobotMap.AUTO_INTAKE_BUTTON);
    //autoResetShooterButton = new JoystickButton(secondary, RobotMap.RESET_SHOOTER_BUTTON);

    manipulatorUp = new JoystickButton(right, RobotMap.MANIPULATOR_UP_BUTTON);
    manipulatorDown = new JoystickButton(right, RobotMap.MANIPULATOR_DOWN_BUTTON);

    spinFrontButton = new JoystickButton(right, RobotMap.SPIN_BUTTON_FRONT);
    spinBackButton = new JoystickButton(right, RobotMap.SPIN_BUTTON_BACK);

    tieButtons();
}
项目:XboxController    文件:XboxController.java   
/**
 * (Constructor #1)
 * There are two ways to make an XboxController. With this constructor,
 * you can specify which port you expect the controller to be on.
 * @param port
 */
public XboxController(final int port) {
    super(port);  // Extends Joystick...

    /* Initialize */
    this.port       = port;
    this.controller = new Joystick(this.port);    // Joystick referenced by everything

    this.leftStick  = new Thumbstick    (this.controller, HAND.LEFT);
    this.rightStick = new Thumbstick    (this.controller, HAND.RIGHT);
    this.dPad       = new DirectionalPad(this.controller);
    this.lt         = new Trigger       (this.controller, HAND.LEFT);
    this.rt         = new Trigger       (this.controller, HAND.RIGHT);
    this.a          = new JoystickButton(this.controller, A_BUTTON_ID);
    this.b          = new JoystickButton(this.controller, B_BUTTON_ID);
    this.x          = new JoystickButton(this.controller, X_BUTTON_ID);
    this.y          = new JoystickButton(this.controller, Y_BUTTON_ID);
    this.lb         = new JoystickButton(this.controller, LB_BUTTON_ID);
    this.rb         = new JoystickButton(this.controller, RB_BUTTON_ID);
    this.back       = new JoystickButton(this.controller, BACK_BUTTON_ID);
    this.start      = new JoystickButton(this.controller, START_BUTTON_ID);
}
项目:2015RobotCode    文件:Robot.java   
public Robot() {    // initialize variables in constructor
    stick = new Joystick(RobotMap.JOYSTICK_PORT); // set the stick to refer to joystick #0
    button = new JoystickButton(stick, RobotMap.BTN_TRIGGER);

    myRobot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
            RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
    myRobot.setExpiration(RobotDrive.kDefaultExpirationTime);  // set expiration time for motor movement if error occurs

    pdp = new PowerDistributionPanel();  // instantiate class to get PDP values

    compressor = new Compressor(); // Compressor is controlled automatically by PCM

    solenoid = new DoubleSolenoid(RobotMap.SOLENOID_PCM_PORT1, RobotMap.SOLENOID_PCM_PORT2); // solenoid on PCM port #0 & #1

    /*camera = CameraServer.getInstance();
    camera.setQuality(50);
    camera.setSize(200);*/
    frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);  // create the image frame for cam
    session = NIVision.IMAQdxOpenCamera("cam0",
            NIVision.IMAQdxCameraControlMode.CameraControlModeController);  // get reference to camera
    NIVision.IMAQdxConfigureGrab(session);  // grab current streaming session
}
项目:Swerve    文件:OI.java   
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driverStick = new Joystick(1);
    coStick = new Joystick(2);

    autoSteerButton = new JoystickButton(driverStick, 2);

    shootButton = new JoystickButton(coStick, 1);
    eightBallSpit = new JoystickButton(coStick, 2);
    eightBallSuck = new JoystickButton(coStick, 3);
    bunnyLaunchButton = new JoystickButton(coStick, 4);

    shootButton.whileHeld(new ShootCommand());
    eightBallSuck.whileHeld(new EightBallSuck());
    eightBallSpit.whileHeld(new EightBallSpit());
    bunnyLaunchButton.whileHeld(new BunnyLaunch());
    // SmartDashboard Buttons
    //SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
    //SmartDashboard.putData("DriveLoop", new DriveLoop());
    SmartDashboard.putData("Reset Gyro", new ResetGyroCommand(Math.PI));

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:Veer    文件:OI.java   
public OI() {
    joystick1 = new Joystick(RobotMap.J1);
    joystick2 = new Joystick(RobotMap.J2);

    Snake = new JoystickButton(joystick1, ButtonType.LeftThumb);
        Snake.whileHeld(new Subsystem.Swerve.C_Snake());
    GoToHeading = new JoystickButton(joystick1, ButtonType.RightThumb);
        GoToHeading.whileHeld(new Subsystem.Swerve.C_GoToHeading());
    Pivot0 = new JoystickButton(joystick1, ButtonType.L1);
        Pivot0.whileHeld(new Subsystem.Swerve.C_Pivot());
    Pivot1 = new JoystickButton(joystick1, ButtonType.R1);
        Pivot1.whileHeld(new Subsystem.Swerve.C_Pivot());
    Pivot2 = new Bumper(joystick1, Axis.Trigger);
        Pivot2.whileHeld(new Subsystem.Swerve.C_Pivot());
    ZeroModules = new JoystickButton(joystick1, ButtonType.A);
        ZeroModules.whenPressed(new Subsystem.Swerve.C_ZeroModules());
    ResetGyro = new JoystickButton(joystick1, ButtonType.B);
        ResetGyro.whenPressed(new Subsystem.Swerve.C_ResetGyro());
    CancelZeroModules = new JoystickButton(joystick1, ButtonType.X);
}
项目:NR-2014-CMD    文件:OI.java   
public static void init()
{
    stick1 = new Joystick(1);
    stick2 = new Joystick(2);


    new JoystickButton(stick1, 5).whenPressed(new ShiftCommand(true));

    new JoystickButton(stick1, 3).whenPressed(new ShiftCommand(false));

    new JoystickButton(stick2, 7).whenPressed(new StopBallIntakeCommand());
    new JoystickButton(stick2, 6).whenPressed(new BallIntakeCommand());

    new JoystickButton(stick2, 11).whileHeld(new ShooterRotationCommand(-ShooterRotator.REGULAR_SPEED));
    new JoystickButton(stick2, 10).whileHeld(new ShooterRotationCommand(ShooterRotator.REGULAR_SPEED));


    new JoystickButton(stick2, 2).whenPressed(new ShooterRotateTargetCommand(ShooterRotator.AUTONOMOUS_ANGLE));
    new JoystickButton(stick2, 1).whenPressed(new PunchGroupCommand());
    new JoystickButton(stick2, 9).whenPressed(new TopArmDownCommand());
    new JoystickButton(stick2, 8).whenPressed(new TopArmUpCommand());
    new JoystickButton(stick2, 11).whenPressed(new ResetDogEarCommand());
    new JoystickButton(stick2, 3).whenPressed(new AutonomousCommand());
}
项目:RobotCode2013    文件:XboxController.java   
public static void init() {
    // Spin Up
    shootButton = new JoystickButton[1];
    shootButton[0] = new JoystickButton(stick, LEFT_BUMPER_BUTTON); // Left bumper
    shootButton[0].whileHeld(new SpeedUpShooter());


    // Shoot
    shootFrisbee = new JoystickButton[1];
    shootFrisbee[0] = new JoystickButton(stick, RIGHT_BUMPER_BUTTON); // Right bumper
    shootFrisbee[0].whenPressed(new PushFrisbeeOut());

    startCompressor = new JoystickButton[2];
    startCompressor[0] = new JoystickButton(stick, A_BUTTON); // A button
    startCompressor[0].whileHeld(new StartCompressor());

}
项目:Swerve    文件:OI.java   
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driverStick = new Joystick(1);
    coStick = new Joystick(2);

    autoSteerButton = new JoystickButton(driverStick, 2);

    shootButton = new JoystickButton(coStick, 1);
    eightBallSpit = new JoystickButton(coStick, 2);
    eightBallSuck = new JoystickButton(coStick, 3);
    bunnyLaunchButton = new JoystickButton(coStick, 4);

    shootButton.whileHeld(new ShootCommand());
    eightBallSuck.whileHeld(new EightBallSuck());
    eightBallSpit.whileHeld(new EightBallSpit());
    bunnyLaunchButton.whileHeld(new BunnyLaunch());
    // SmartDashboard Buttons
    //SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
    //SmartDashboard.putData("DriveLoop", new DriveLoop());
    SmartDashboard.putData("Reset Gyro", new ResetGyroCommand(Math.PI));

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:Command-Based-Robot    文件:OI.java   
private void initButtons() {
    // Wills buttons
    driveMode = new JoystickButton(driveStick, 1);
    wAngle = new JoystickButton(driveStick, 4);
    wLength = new JoystickButton(driveStick, 5);

    //Right Buttons
    rAngle = new JoystickButton(rightStick, 1);
    rLength = new JoystickButton(rightStick, 2);
    rLock = new JoystickButton(rightStick, 4);
    rULock = new JoystickButton(rightStick, 5);
    rAdjust = new JoystickButton(rightStick, 8);

    //Left Buttons
    lAngle = new JoystickButton(leftStick, 1);
    lLength = new JoystickButton(leftStick,2);
    lLock = new JoystickButton(leftStick, 4);
    lULock = new JoystickButton(leftStick, 5);
    lAdjust = new JoystickButton(leftStick, 8);

    //Assign the buttons to their commands
    tieButtons();
}
项目:Zed-Java    文件:Gamepad.java   
public Gamepad(int port) {
    joystick = new Joystick(port);
    LEFT_BUMPER = new JoystickButton(joystick, 5);
    LEFT_TRIGGER = new JoystickButton(joystick, 7);
    RIGHT_BUMPER = new JoystickButton(joystick, 6);
    RIGHT_TRIGGER = new JoystickButton(joystick, 8);
    DIAMOND_LEFT = new JoystickButton(joystick, 1);
    DIAMOND_DOWN = new JoystickButton(joystick, 2);
    DIAMOND_RIGHT = new JoystickButton(joystick, 3);
    DIAMOND_UP = new JoystickButton(joystick, 4);
    MIDDLE_LEFT = new JoystickButton(joystick, 9);
    MIDDLE_RIGHT = new JoystickButton(joystick, 10);
    LEFT_JOYSTICK_BUTTON = new JoystickButton(joystick, 11);
    RIGHT_JOYSTICK_BUTTON = new JoystickButton(joystick, 12);

    DPAD_UP = new DPadButton(this, DPadButton.DPAD_UP);
    DPAD_DOWN = new DPadButton(this, DPadButton.DPAD_DOWN);
    DPAD_LEFT = new DPadButton(this, DPadButton.DPAD_LEFT);
    DPAD_RIGHT = new DPadButton(this, DPadButton.DPAD_RIGHT);
}
项目:CK_16_Java    文件:OI.java   
public OI()
{
    // Init Joystick and Gamepad
    driverJoystick = new Joystick(1);
    shooterGamepad = new Joystick(2);

    // Init Buttons
    buttonInvertTiltJoy1 = new JoystickButton(driverJoystick, 8); // Tilt shooter on joystick
    buttonInvertTiltJoy2 = new JoystickButton(shooterGamepad, 5); // Tilt shooter on gamepad
    buttonInvertHangPiston = new JoystickButton(driverJoystick, 6); // Invert hang position (timeout needed)
    buttonExtendFirePiston = new JoystickButton(shooterGamepad, 6); // Extend fire piston
    buttonToggleShooterWheels = new JoystickButton(shooterGamepad, 2); // Toggle wheel spinning
    buttonForwardRollers = new JoystickButton(shooterGamepad, 3); // Manually run rollers forward
    buttonReverseRollers = new JoystickButton(shooterGamepad, 7); // Manually run rollers in reverse
    buttonManualLoadPiston = new JoystickButton(shooterGamepad, 1); // Manually control load piston
    buttonToggleAutoLoad = new JoystickButton(shooterGamepad, 8); // Toggle AutoLoad
}
项目:Robot-Code-2013    文件:OI.java   
public OI() {        
    leftJoy = new Joystick(RobotMap.LEFT_JOY_PORT);
    rightJoy = new Joystick(RobotMap.RIGHT_JOY_PORT);
    shootController = new Joystick(RobotMap.SHOOTER_CONTROLLER_PORT);

    rightTriggerButton = new JoystickButton(rightJoy, 1);

    loadButton = new JoystickButton(shootController, 9);

    shootButton = new JoystickButton(shootController, 2);
    shootUp = new JoystickButton(shootController,6);
    shootDown = new JoystickButton(shootController,5);

    overrideButton = new JoystickButton(shootController,8);
    LEDButton = new JoystickButton(shootController,7);       

    rightTriggerButton.whenPressed(new WriteHeight());
    loadButton.whenPressed(new Load());
    shootUp.whenPressed(new ShootSpeedUp());
    shootDown.whenPressed(new ShootSpeedDown());
    overrideButton.whenPressed(new OverrideMode());
    LEDButton.whenPressed(new LED());
}
项目:Spartonics-Code    文件:OI.java   
public JoystickButton getButton(int buttonNum, boolean auxiliary) {
    if(auxiliary){
        return this.auxiliaryButtons[buttonNum];
    }else{
        return this.driveButtons[buttonNum];
    }
}
项目:Spartonics-Code    文件:OI.java   
public OI() {

        driveStick = new Joystick(RobotMap.DRIVE_STICK_NUMBER);
        driveButtons = new JoystickButton[13];

        auxiliaryStick = new Joystick(RobotMap.AUXILIARY_STICK_NUMBER);
        auxiliaryButtons = new JoystickButton[13];

        for(int i = 1; i <= driveButtons.length - 1; i++) {
            driveButtons[i] = new JoystickButton(driveStick, i);
        }

        for(int i=1; i <= auxiliaryButtons.length - 1; i++){
            auxiliaryButtons[i] = new JoystickButton(auxiliaryStick, i);
        }

        //this.getButton(RobotMap.SHOOTER_CONTROL_BUTTON).whileHeld(new ShooterControl());
        this.getButton(RobotMap.WINCH_UP_BUTTON).whenPressed(new WinchUp());
        this.getButton(RobotMap.WINCH_DOWN_BUTTON).whileHeld(new WinchDown());
        this.getButton(RobotMap.INTAKE_FORWARD_BUTTON, true).toggleWhenPressed(new ForwardIntake());
        this.getButton(RobotMap.INTAKE_BACKWARD_BUTTON, true).whileHeld(new ReverseIntake());       
        this.getButton(RobotMap.REVERSE_DRIVE_BUTTON).whenPressed(new FlipChassisDirection());
        this.getButton(RobotMap.SHIFT_DOWN_BUTTON, true).whileHeld(new ShiftDown());
        this.getButton(RobotMap.SHIFT_UP_BUTTON, true).whileHeld(new ShiftUp());

        this.getButton(RobotMap.TURN_ENCODERS_OFF, true).toggleWhenPressed(new RemoveEncoderInfluence());

    }
项目:Spartonics-Code    文件:OI.java   
public JoystickButton getButton(int buttonNum, boolean auxiliary) {
    if(auxiliary){
        return this.auxiliaryButtons[buttonNum];
    }else{
        return this.driveButtons[buttonNum];
    }
}
项目:FRC6706_JAVA2017    文件:OI.java   
public OI(){

    //SmartDashboard.putNumber("Get Ball Speed", Robot.pivot.getAngle());

    SmartDashboard.putData("Cast Ball In", new CastInBallCommand());
    SmartDashboard.putData("Cast Ball Out", new CastOutBallCommand());
    SmartDashboard.putData("Stop Cast Ball", new StopCastBallCommand());
    SmartDashboard.putData("Get Ball In", new GetInBallCommand());
    SmartDashboard.putData("Stop Get Ball", new StopGetBallCommand());

    SmartDashboard.putData("Climb Rope Up", new ClimbRopeUpCommand());
    SmartDashboard.putData("Stop Climb Rope", new ClimbRopeHoldCommand());

    //Button Drive
    new JoystickButton(myStick, RobotMap.DriveForward).whileHeld(new DriveTrainForwardButtonCommand());
    new JoystickButton(myStick, RobotMap.DriveBack).whileHeld(new DriveTrainBackButtonCommand());
    new JoystickButton(myStick, RobotMap.DriveLeft).whileHeld(new DriveTrainLeftButtonCommand());
    new JoystickButton(myStick, RobotMap.DriveRight).whileHeld(new DriveTrainRightButtonCommand());
    new JoystickButton(myStick, RobotMap.TurnLeft).whenPressed(new DriveTrainTurnLeft());//need test
    new JoystickButton(myStick, RobotMap.TurnRight).whenPressed(new DriveTrainTurnRight());//need test
    // GetBall buttons
    new JoystickButton(myRobotStick, RobotMap.GetInBall).whenPressed(new GetInBallCommand());   
    new JoystickButton(myRobotStick, RobotMap.StopGetBall).whenPressed(new StopGetBallCommand());   
    // CastBall buttons
    new JoystickButton(myRobotStick, RobotMap.CastInBall).whenPressed(new CastInBallCommand()); 
    new JoystickButton(myRobotStick, RobotMap.CastOutBall).whenPressed(new CastOutBallCommand());   
    new JoystickButton(myRobotStick, RobotMap.StopCastBall).whenPressed(new StopCastBallCommand());
    // CastBall buttons
    new JoystickButton(myRobotStick, RobotMap.ClimbRopeUpButton).whenPressed(new ClimbRopeUpCommand());
    new JoystickButton(myRobotStick, RobotMap.ClimbRopeUpButton2).whenPressed(new ClimbRopeUpCommand2());
    new JoystickButton(myRobotStick, RobotMap.ClimbRopeHoldButton).whenPressed(new ClimbRopeHoldCommand());
    new JoystickButton(myStick, RobotMap.ClimbRopeUp2).whenPressed(new ClimbRopeUpCommand());
    new JoystickButton(myStick, RobotMap.ClimbRopeHold2).whenPressed(new ClimbRopeHoldCommand());

}
项目:MinuteMan    文件:OI.java   
/**
 * Populates the array "buttons" with buttons from 1 to 12 of each joystick.
 * @author Vincent Benenati
 * @author Robert Smith
 */
private void createButtons(){
    for(int joystickNum = 0; joystickNum < JOYSTICK_NUM; joystickNum++){
        for(int buttonNum = 0; buttonNum < BUTTON_NUM; buttonNum++){
            buttons[joystickNum][buttonNum] = new JoystickButton(joysticks[joystickNum], buttonNum + 1);
        }
    }
}
项目:MinuteMan    文件:S_DTWhole.java   
public void safeArcadeDrive(Joystick joystick, JoystickButton safetyButton, boolean squaredInputs){
    if(safetyButton.get()){
        robotDrive.arcadeDrive(joystick, squaredInputs);
    }
    else{
        robotDrive.stopMotor();
    }
}
项目:MinuteMan    文件:S_DTWhole.java   
public void safeTankDrive(Joystick leftJoystick, Joystick rightJoystick, JoystickButton[] safetyButtons, boolean squaredInputs){
    if(getAll(safetyButtons)){
        robotDrive.tankDrive(leftJoystick, rightJoystick, squaredInputs);
    }
    else{
        robotDrive.stopMotor();
    }
}
项目:MinuteMan    文件:S_DTWhole.java   
private boolean getAll(JoystickButton[] buttons){
    for(int buttonNum = 0; buttonNum < buttons.length; buttonNum++){
        if(!buttons[buttonNum].get()){
            return false;
        }
    }
    return true;
}
项目:2016Robot    文件:OI.java   
public OI() {

        inputRecordings = new ArrayList<double[]>();
        joystick1 = new Joystick(0);
        joystick2 = new Joystick(1);
        operator = new Joystick(2);

        new JoystickButton(joystick1, 1).whenPressed(new ShootIntoGoal());
        new JoystickButton(joystick1, 3).whenPressed(new SetShooterToTestSpeed());
        new JoystickButton(joystick1, 5).whileHeld(new TurnToOpponentAlliance());
        new JoystickButton(joystick1, 6).whenPressed(new DecreaseShooterTestSpeed());
        new JoystickButton(joystick1, 7).whileHeld(new TurnToOurAlliance());
        new JoystickButton(joystick1, 8).whenPressed(new IncreaseShooterTestSpeed());

        new JoystickButton(operator, 1).whenPressed(new ShooterToBottom());
        new JoystickButton(operator, 2).whenPressed(new ToggleShooterPiston());
        new JoystickButton(operator, 3).whileHeld(new ManualShooterAngle());
//      new JoystickButton(operator, 4).whenPressed(new ArmsUp());
        new JoystickButton(operator, 5).whileHeld(new ShooterManualJogUp());
        new JoystickButton(operator, 6).whileHeld(new ShooterOuttake());
        new JoystickButton(operator, 7).whenPressed(new ShootFullSpeed());
//      new JoystickButton(operator, 8).whenPressed(new ArmsDown());
        new JoystickButton(operator, 9).whileHeld(new ShooterManualJogDown());
        new JoystickButton(operator, 10).whileHeld(new ShooterIntake());
        new JoystickButton(operator, 11).whenPressed(new SafeArmsToggle());
        new JoystickButton(operator, 12).whenPressed(new ShootIntoGoal());

    }
项目: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());
    }
项目:Bernie    文件:OI.java   
public OI() {
    xboxController = new Joystick(0);
    xboxController2 = new Joystick(1);

    xboxAButton = new JoystickButton(xboxController, 1);
    //xboxAButton.whileHeld(new Parallel());
    xboxAButton.whileHeld(new Shoot());
    xboxBButton = new JoystickButton(xboxController, 2);
    //xboxBButton.whileHeld(new Intaking());
    xboxXButton = new JoystickButton(xboxController, 3);
    xboxYButton = new JoystickButton(xboxController, 4);

    xboxAButton2 = new JoystickButton(xboxController2, 1);
    //xboxAButton2.whileHeld(new PortArmDown());
    xboxRightBumper = new JoystickButton(xboxController, 6);
    xboxRightBumper.whileHeld(new FullForward());
    xboxLeftBumper = new JoystickButton(xboxController, 5);
    xboxLeftBumper.whileHeld(new FullBackward());


    xboxBButton2 = new JoystickButton(xboxController2, 2);
    xboxBButton2.whileHeld(new Wind());
    xboxXButton2 = new JoystickButton(xboxController2, 3);
    xboxXButton2.whileHeld(new Clutch());
    xboxYButton2 = new JoystickButton(xboxController2, 4);
    xboxYButton2.whileHeld(new ClutchOut());
    xboxLeftBumper2 = new JoystickButton(xboxController2, 6);
    xboxLeftBumper2.whileHeld(new Parallel());
    xboxRightBumper2 = new JoystickButton(xboxController2, 5);
    xboxRightBumper2.whileHeld(new Intaking());
    xboxBackButton2 = new JoystickButton(xboxController2, 7);
    //xboxBackButton2.whileHeld(new SwitchCamera());
    // SmartDashboard Buttons
    //SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
}
项目:FRC-2016    文件:AdvJoystick.java   
/**
 * @param port of the controller.
 */
public AdvJoystick(int port) {
    super(port);
    trigger = new JoystickButton(this, 1);
    thumb = new JoystickButton(this, 2);
    three = new JoystickButton(this, 3);
    four = new JoystickButton(this, 4);
    five = new JoystickButton(this, 5);
    six = new JoystickButton(this, 6);
}
项目:Stronghold_2016    文件:OI.java   
public OI() {
        leftStick = new Joystick(1);
        rightStick = new Joystick(2);

        xboxController = new XboxController(3);

        // Joystick buttons
        upShifter = new JoystickButton(rightStick, 7);
        downShifter = new JoystickButton(leftStick, 7);

        leftTrigger = new JoystickButton(leftStick, 1);
        rightTrigger = new JoystickButton(rightStick, 1);

        //Drive Controls
        leftTrigger.whenPressed(new GearShiftCommand(true));
        rightTrigger.whenPressed(new GearShiftCommand(false));

        //Intake Controls
        xboxController.a.whileHeld(new IntakeRollerCommand("out"));
        xboxController.y.whileHeld(new IntakeRollerCommand("in"));
        xboxController.x.whenReleased(new IntakePistonCommand());

        //Shooter Controls
//      xboxController.dPad.up.whenPressed(new ShooterWheelToggleCommand(true));
//      xboxController.dPad.down.whenPressed(new ShooterWheelToggleCommand(false));

        xboxController.rt.whenPressed(new ShooterPistonCommand(false));
        xboxController.lt.whenPressed(new ShooterPistonCommand(true));
        xboxController.b.whileHeld(new ShooterWheelCommand());

        if(xboxController.rb.get()){
            Robot.intakeRollerSubsystem.setOverride(true);
        }

        xboxController.rb.whenReleased(new DefensePistonCommand(true));
        xboxController.lb.whenReleased(new DefensePistonCommand(false));

    }
项目: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));
}
项目:2015-Beaker-Competition    文件:OI.java   
public OI() {

        joystick0 = new Joystick(0);
        joystick1 = new Joystick(1);
        joystick2 = new Joystick(2);

        intakeOutButton = new JoystickButton(joystick0, 1);
        intakeOutButton.whileHeld(new IntakeOut());

        elevatorUpAllTheWayButton = new JoystickButton(joystick0, 6);
        elevatorUpAllTheWayButton.whileHeld(new ElevatorUpAllTheWay());

        elevatorDownAllTheWayButton = new JoystickButton(joystick0, 7);
        elevatorDownAllTheWayButton.whileHeld(new ElevatorDownAllTheWay());

        intakeInButton = new JoystickButton(joystick1, 1);
        intakeInButton.whileHeld(new IntakeIn());

        elevatorUpButton = new JoystickButton(joystick1, 3);
        elevatorUpButton.whileHeld(new ElevatorUp());

        elevatorDownButton = new JoystickButton(joystick1, 2);
        elevatorDownButton.whileHeld(new ElevatorDown());

        elevatorUpOperatorButton = new JoystickButton(joystick2, 1);
        elevatorUpOperatorButton.whileHeld(new ElevatorUpOperator());

        elevatorUpAllTheWayButton2 = new JoystickButton(joystick2, 6);
        elevatorUpAllTheWayButton2.whileHeld(new ElevatorUpAllTheWay());

        elevatorDownAllTheWayButton2 = new JoystickButton(joystick2, 7);
        elevatorDownAllTheWayButton2.whileHeld(new ElevatorDownAllTheWay());

        SmartDashboard.putData("Autonomous", new Autonomous());
        SmartDashboard.putData("IntakeIn", new IntakeIn());
        SmartDashboard.putData("IntakeOut", new IntakeOut());
        SmartDashboard.putData("ElevatorUp", new ElevatorUp());
        SmartDashboard.putData("ElevatorDown", new ElevatorDown());

    }
项目:turtleshell    文件:OI.java   
public OI() {
    // Put Some buttons on the SmartDashboard
    SmartDashboard.putData("Elevator Bottom", new SetElevatorSetpoint(0));
    SmartDashboard.putData("Elevator Platform", new SetElevatorSetpoint(0.2));
    SmartDashboard.putData("Elevator Top", new SetElevatorSetpoint(0.3));

    SmartDashboard.putData("Wrist Horizontal", new SetWristSetpoint(0));
    SmartDashboard.putData("Raise Wrist", new SetWristSetpoint(-45));

    SmartDashboard.putData("Open Claw", new OpenClaw());
    SmartDashboard.putData("Close Claw", new CloseClaw());

    SmartDashboard.putData("Deliver Soda", new Autonomous());

    // Create some buttons
    JoystickButton d_up = new JoystickButton(joy, 5);
    JoystickButton d_right= new JoystickButton(joy, 6);
    JoystickButton d_down= new JoystickButton(joy, 7);
    JoystickButton d_left = new JoystickButton(joy, 8);
    JoystickButton l2 = new JoystickButton(joy, 9);
    JoystickButton r2 = new JoystickButton(joy, 10);
    JoystickButton l1 = new JoystickButton(joy, 11);
    JoystickButton r1 = new JoystickButton(joy, 12);

    // Connect the buttons to commands
    d_up.whenPressed(new SetElevatorSetpoint(0.2));
    d_down.whenPressed(new SetElevatorSetpoint(-0.2));
    d_right.whenPressed(new CloseClaw());
    d_left.whenPressed(new OpenClaw());

    r1.whenPressed(new PrepareToPickup());
    r2.whenPressed(new Pickup());
    l1.whenPressed(new Place());
    l2.whenPressed(new Autonomous());
}
项目:FRC2015Code    文件:OI.java   
public OI() {

        // One joystick for xbox controller, two for otherwise.
        switch (mode) {
        case TRUAL_MODE: {
            this.joystick = new Joystick[3];
            // to-do, never.
            break;
        }
        case DUAL_MODE: {
            this.joystick = new Joystick[2];
            this.joystick[leftJoystick] = new Joystick(0);
            this.joystick[rightJoystick] = new Joystick(1);
            this.shifterButton = new JoystickButton(joystick[0], 3);
            this.lifterButton = new JoystickButton(joystick[0], 4);
            this.liftUpButton = new JoystickButton(joystick[0], 1);
            this.liftDownButton = new JoystickButton(joystick[0], 2);
            this.grabberOpenButton = new JoystickButton(joystick[1], 1);
            this.grabberCloseButton = new JoystickButton(joystick[1], 2);
            this.compressorOnButton = new JoystickButton(joystick[1], 3);
            this.compressorOnButton = new JoystickButton(joystick[1], 4);
            break;
        }
        case XBOX_MODE: {
            this.joystick = new Joystick[1];
            this.joystick[xboxJoystick] = new Joystick(0);
            this.lifterButton = new JoystickButton(joystick[0], 1);
            this.shifterButton = new JoystickButton(joystick[0], 2);
            this.liftUpButton = new JoystickButton(joystick[0], 3);
            this.liftDownButton = new JoystickButton(joystick[0], 4);
            this.grabberOpenButton = new JoystickButton(joystick[0], 5);
            this.grabberCloseButton = new JoystickButton(joystick[0], 6);
            this.compressorOnButton = new JoystickButton(joystick[0], 8);
            this.compressorOffButton = new JoystickButton(joystick[0], 7);
            break;
        }
        }

    }
项目:Robot_2015    文件:Robot.java   
/**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
        RobotMap.init();
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
        LiftControl.zeroValue = RobotMap.forkliftMotor.getPosition();

        driveBase = new DriveBase();
        pneumatics = new Pneumatics();

        img = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);

        RobotMap.forkliftMotor.disableControl();
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
        // OI must be constructed after subsystems. If the OI creates Commands 
        //(which it very likely will), subsystems are not guaranteed to be 
        // constructed yet. Thus, their requires() statements may grab null 
        // pointers. Bad news. Don't move it.
        oi = new OI();

        back = new JoystickButton(oi.joystick, 7);
        start = new JoystickButton(oi.joystick, 8);

        try {
            cs = CameraServer.getInstance();
            cs.setQuality( 10 );

/* The available size constants for cs.setSize are 0,1,2 for:
    private static final int kSize640x480 = 0;
    private static final int kSize320x240 = 1;
    private static final int kSize160x120 = 2;
*/
//          cs.setSize( 1 );

            cs.startAutomaticCapture("cam0");
        } catch (Exception e) {
            // No camera signal, ignore
        }

        RobotMap.lightRing.set(true);
    }
项目:frc_2015_recyclerush    文件:OI.java   
/**
 * Receive a joystick and then map controls to it.
 *
 * @param joysticks The joysticks used for buttons
 */
public OI(GenericHID... joysticks) {
    // button map
    liftUpButton = new JoystickButton(joysticks[0], 5);
    liftDownButton = new JoystickButton(joysticks[0], 3);

    forkInButton = new JoystickButton(joysticks[0], 1);
    forkOutButton = new JoystickButton(joysticks[0], 2);

    extGrabButton = new JoystickButton(joysticks[0], 6);
    extThrowButton = new JoystickButton(joysticks[0], 4);

    reverseButton = new JoystickButton(joysticks[0], 12);

    // button controls
    liftUpButton.whileHeld(new Lift(1));
    liftDownButton.whileHeld(new Lift(-1));

    liftUpButton.whenReleased(new Lift(0));
    liftDownButton.whenReleased(new Lift(0));

    forkInButton.whileHeld(new Fork(1));
    forkOutButton.whileHeld(new Fork(-0.666));

    forkInButton.whenReleased(new Fork(0));
    forkOutButton.whenReleased(new Fork(0));

    extGrabButton.whileHeld(new ExtArm(1));
    extThrowButton.whileHeld(new ExtArm(-1));

    extGrabButton.whenReleased(new ExtArm(0));
    extThrowButton.whenReleased(new ExtArm(0));

    reverseButton.whenPressed(new ReverseDrive());
}
项目: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());
}