當前位置: 首頁>>代碼示例>>Java>>正文


Java JoystickButton.whileHeld方法代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.buttons.JoystickButton.whileHeld方法的典型用法代碼示例。如果您正苦於以下問題:Java JoystickButton.whileHeld方法的具體用法?Java JoystickButton.whileHeld怎麽用?Java JoystickButton.whileHeld使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.wpi.first.wpilibj.buttons.JoystickButton的用法示例。


在下文中一共展示了JoystickButton.whileHeld方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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());
}
 
開發者ID:mr-glt,項目名稱:FRC-2017-Command,代碼行數:19,代碼來源:OI.java

示例2: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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());
}
 
開發者ID:Team2667,項目名稱:SteamWorks,代碼行數:24,代碼來源:OI.java

示例3: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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));
    
}
 
開發者ID:Team395,項目名稱:El-Jefe-2017,代碼行數:24,代碼來源:OI.java

示例4: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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
}
 
開發者ID:Tmm2471,項目名稱:Swerve,代碼行數:24,代碼來源:OI.java

示例5: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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);
}
 
開發者ID:VulcanRobotics,項目名稱:Veer,代碼行數:21,代碼來源:OI.java

示例6: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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());
}
 
開發者ID:FRC5442,項目名稱:Bernie,代碼行數:36,代碼來源:OI.java

示例7: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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());

	}
 
開發者ID:NicholsSchool,項目名稱:2015-Beaker-Competition,代碼行數:41,代碼來源:OI.java

示例8: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
/**
 * 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());
}
 
開發者ID:CircuitRunners,項目名稱:frc_2015_recyclerush,代碼行數:40,代碼來源:OI.java

示例9: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI() {
       driveJoystick1 = new Joystick(JOY_STICK_PORT1);
       driveJoystick2 = new Joystick(JOY_STICK_PORT2);
       gamepad = new Gamepad(GAME_PAD_PORT);   
       xbox = new XBoxController(XBOX_PORT);
       
       ArmJoystickUp = new JoystickButton(driveJoystick1, 3);
       ArmJoystickUp.whenPressed(new LiftArm(0.2));
       
       ArmJoystickDown = new JoystickButton (driveJoystick1, 2);
       ArmJoystickDown.whenPressed(new LiftArm(-0.2));
       

       ArmXboxUp = new JoystickButton (xbox, 5);
       ArmXboxUp.whileHeld(new LiftArm(.5));

       ArmXboxDown = new JoystickButton (xbox, 6);
       ArmXboxDown.whileHeld(new LiftArm(-0.5));
       
       WindUp = new JoystickButton (xbox, 4);
       WindUp.whileHeld(new WindUp());
       
//     WindUp = new JoystickButton (xbox, 4);
//     WindUp.whenPressed(new WindUp());       

       Release = new JoystickButton (xbox, 1);
       Release.whenPressed(new UnWind());       
       
     /*  OpenNet = new JoystickButton (xbox, 6);
       OpenNet.whenPressed(new OpenNet());
       
       CloseNet = new JoystickButton(xbox, 5);
       CloseNet.whenPressed(new CloseNet());
       
       DumpBall = new JoystickButton (xbox, 4);
       DumpBall.whenPressed(new DumpBall());    */  
    }
 
開發者ID:iraiders,項目名稱:2014Robot-,代碼行數:38,代碼來源:OI.java

示例10: init

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public static void init() {
	left = new Joystick(1);
	right = new Joystick(2);
	xboxController = new XboxController(left);
               		
	shootButton = new JoystickButton(left, JOYSTICK_SPIN_UP_SHOOTER);
	shootButton.whileHeld(new SpeedUpShooter());
               
               testSlowCommand = new JoystickButton(right, JOYSTICK_TEST_SLOW_COMMAND);
               testSlowCommand.whenPressed(new TestSlowDownShooter());
               
               angleUp = new JoystickButton(left, JOYSTICK_ANGLE_UP);
               angleUp.whileHeld(new MoveShooterAngleUp());
             
               angleDown = new JoystickButton(left, JOYSTICK_ANGLE_DOWN);
	angleDown.whileHeld(new MoveShooterAngleDown());
               
	shootFrisbee = new JoystickButton(right, JOYSTICK_SHOOT);
	shootFrisbee.whenPressed(new PushFrisbeeOut());
			
	startCompressor = new JoystickButton(left, JOYSTICK_COMPRESSOR_DRIVER);
	startCompressor.whileHeld(new StartCompressor());
	
	liftUp = new JoystickButton(right, JOYSTICK_LIFTER);
	liftUp.whenPressed(new ToggleLifter());
	
	resetEncoder = new JoystickButton(right, JOYSTICK_RESET_ENCODER);
	resetEncoder.whenPressed(new ResetAngleEncoder());
}
 
開發者ID:Team-2502,項目名稱:RobotCode2013,代碼行數:30,代碼來源:OI.java

示例11: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI() {
	double speed = Preferences.getInstance().getDouble(RobotMap.desiredSpeed, 0.0);
	double distance = Preferences.getInstance().getDouble(RobotMap.desiredDistance, 0.0);
	SmartDashboard.putData(new DriveDistance(distance, speed));
	SmartDashboard.putData(new CenterGearAutonomous());
	SmartDashboard.putData(new UpManipulator());
	SmartDashboard.putData(new DriveStraightAuto(distance, speed));

	JoystickButton leftJoyTrigger = new JoystickButton(stickLeft, 1);
	JoystickButton button2Left = new JoystickButton(stickLeft, 2);
	JoystickButton button3Left = new JoystickButton(stickLeft, 3);
	JoystickButton button4Left = new JoystickButton(stickLeft, 4);
	JoystickButton button5Left = new JoystickButton(stickLeft, 5);
	JoystickButton button6Left = new JoystickButton(stickLeft, 6);
	JoystickButton button7Left = new JoystickButton(stickLeft, 7);
	JoystickButton button8Left = new JoystickButton(stickLeft, 8);
	JoystickButton button9Left = new JoystickButton(stickLeft, 9);
	JoystickButton button10Left = new JoystickButton(stickLeft, 10);
	JoystickButton button11Left = new JoystickButton(stickLeft, 11);

	JoystickButton rightJoyTrigger = new JoystickButton(stickRight, 1);
	// JoystickButton button2Right = new JoystickButton(stickRight, 2);
	// JoystickButton button3Right = new JoystickButton(stickRight, 3);
	// JoystickButton button4Right = new JoystickButton(stickRight, 4);
	// JoystickButton button5Right = new JoystickButton(stickRight, 5);
	// JoystickButton button6Right = new JoystickButton(stickRight, 6);
	// JoystickButton button7Right = new JoystickButton(stickRight, 7);
	// JoystickButton button8Right = new JoystickButton(stickRight, 8);
	// JoystickButton button9Right = new JoystickButton(stickRight, 9);
	// JoystickButton button10Right = new JoystickButton(stickRight, 10);
	// JoystickButton button11Right = new JoystickButton(stickRight, 11);

	JoystickButton buttonA = new JoystickButton(xbox, 1);
	JoystickButton buttonB = new JoystickButton(xbox, 2);
	JoystickButton buttonX = new JoystickButton(xbox, 3);
	JoystickButton buttonY = new JoystickButton(xbox, 4);
	// XboxLeftTrigger xboxLeftTrigger = new XboxLeftTrigger();
	// XboxRightTrigger xboxRightTrigger = new XboxRightTrigger();

	JoystickButton leftButton = new JoystickButton(xbox, 5);
	JoystickButton rightButton = new JoystickButton(xbox, 6);
	JoystickButton back = new JoystickButton(xbox, 7);
	JoystickButton start = new JoystickButton(xbox, 8);
	JoystickButton leftJoyXboxButton = new JoystickButton(xbox, 9);
	JoystickButton rightJoyXboxButton = new JoystickButton(xbox, 10);
	// Xbox commands

	buttonA.whenPressed(new ToggleGearManip());
	buttonX.whileHeld(new ClimberOn());
	buttonB.whileHeld(new ShooterCommandGroup());
	buttonB.whenReleased(new AugerOff());
	buttonB.whenReleased(new ShooterOff());
	buttonB.whenReleased(new ElevatorOff());
	rightButton.whenPressed(new DropManipulatorReverseMotor());

	// Joystick commands

	rightJoyTrigger.whileHeld(new RunIntake());
	leftJoyTrigger.whileHeld(new DriveStraightJoysticks());
	button2Left.toggleWhenActive(new DriveHalfSpeed());
}
 
開發者ID:chopshop-166,項目名稱:frc-2017,代碼行數:62,代碼來源:OI.java

示例12: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public OI() {
       // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

       xBoxController = new Joystick(0);
       
       aButton = new JoystickButton(xBoxController, 1);
       bButton = new JoystickButton(xBoxController, 2);
       xButton = new JoystickButton(xBoxController, 3);
       yButton = new JoystickButton(xBoxController, 4);
       leftBumper = new JoystickButton(xBoxController, 5);
       rightBumper = new JoystickButton(xBoxController, 6);
       selectButton = new JoystickButton(xBoxController, 7);
       startButton = new JoystickButton(xBoxController, 8);
       leftJoystick = new JoystickButton(xBoxController, 9);
       rightJoystick = new JoystickButton(xBoxController, 10);
       
       //aButton.whenPressed(new ShooterSequenceOn());
       //aButton.whenReleased(new ShooterSequenceOff());
       startButton.whenPressed(new InterfaceFlip());
       yButton.whenPressed(new ExpelGear());
       bButton.whenPressed(new IngestToggle());
       xButton.whileHeld(new CloseDoors());
       aButton.whenPressed(new FeederOn());
       leftJoystick.whenPressed(new SwitchCamera());
       //startButton.whenPressed(new Climb());
       leftBumper.whileHeld(new TankDriveLeft());
       rightBumper.whileHeld(new TankDriveRight());
       //Have Motor Position Check on smart dashboard only, not controller

       //SmartDashboard.putData("Autonomous Command", new DriveForward(4.0));
 	    //SmartDashboard.putData("RelayOn", new RelayOn());
 	    //SmartDashboard.putData("AllForward", new AllForward());
 	    //SmartDashboard.putData("MotorPositionCheck", new MotorPositionCheck());
 	    SmartDashboard.putData("Shooter sequence on", new ShooterSequenceOn());
 	    SmartDashboard.putData("Shooter sequence off", new ShooterSequenceOff());
 	    SmartDashboard.putData("Agitator on", new AgitatorOn());
 	    SmartDashboard.putData("Agitator off", new AgitatorOff());
 	    SmartDashboard.putData("Shooter on", new ShooterOn());
 	    SmartDashboard.putData("Shooter off", new ShooterOff());
 	    SmartDashboard.putData("Expell gear", new ExpelGear());
 	    //SmartDashboard.putData("DriveForward", new DriveForward());
 	    //SmartDashboard.putData("Open door", new OpenDoors());
 	    //SmartDashboard.putData("Close door", new CloseDoors());
 	    //SmartDashboard.putData("Extend pusher", new ExtendPusher());
 	    //SmartDashboard.putData("Retract pusher", new RetractPusher());
 	    SmartDashboard.putData("Flip motors", new InterfaceFlip());
 	    SmartDashboard.putNumber("camerasleect", Robot.camera);
 	   // SmartDashboard.putData("Turn Right", new TurnRight(.5));
 	   // SmartDashboard.putData("Turn Left", new TurnLeft(.5));
 	    //SmartDashboard.putData("Rotate left", new Rotate(45));
 	    //SmartDashboard.putData("Rotate 45", new Rotate(-45));
 	    //SmartDashboard.putData("RotatePID Home", new RotateWithPIDTankDrive(0.0));
 	    //SmartDashboard.putData("RotatePID 60", new RotateWithPIDTankDrive(60.0));
 	    //SmartDashboard.putData("RotatePID -60 (left)", new RotateWithPIDTankDrive(-60.0));
 	    //SmartDashboard.putData("RotatePID 120", new RotateWithPIDTankDrive(120.0));
 	    //SmartDashboard.putData("RotatePID -120 (60 right?)", new RotateWithPIDTankDrive(-120.0));
 	    
       // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
       
       //SmartDashboard Data        
   }
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:63,代碼來源:OI.java

示例13: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

    primaryJoystick = new Joystick(0);
    coJoystick = new Joystick(1);
    
    X = new JoystickButton(primaryJoystick, 1);
    CIRCLE = new JoystickButton(primaryJoystick, 2);
    SQUARE = new JoystickButton(primaryJoystick, 3);
    rBumper = new JoystickButton(primaryJoystick, 6);
    lBumper = new JoystickButton(primaryJoystick, 5);
    START = new JoystickButton(primaryJoystick, 8);
    SELECT = new JoystickButton(primaryJoystick, 7);
    
    lBumper.whenPressed(new InvertDrive());
    SQUARE.whenPressed(new StraightDrive());
    CIRCLE.whileHeld(new RunReverseIntake());
    rBumper.whileHeld(new RunIntake());
    // lBumper.whileHeld(new RunReverseIntake());
    START.whenPressed(new TrackTarget());
    SELECT.cancelWhenPressed(new TrackTarget());
    
    TRIGGER = new JoystickButton(coJoystick, 1);
    THUMB = new JoystickButton(coJoystick, 2);
    LTHUMB = new JoystickButton(coJoystick, 3);
    RTHUMB = new JoystickButton(coJoystick, 4);
    
    TRIGGER.whenPressed(new ToggleShooter());
    THUMB.whenPressed(new TrackTarget());
    LTHUMB.whenPressed(new AdjustShootSpeed(-0.025));
    RTHUMB.whenPressed(new AdjustShootSpeed(0.025));


    // SmartDashboard Buttons
    SmartDashboard.putData("Track Target", new TrackTarget());
    SmartDashboard.putData("test", new Test());
    SmartDashboard.putNumber("Gyro", Robot.driveTrain.getGyroBearing());
    SmartDashboard.putNumber("Ultrasonic", Robot.driveTrain.getUltra());
    SmartDashboard.putNumber("Goal X", Robot.getGoalX());
    SmartDashboard.putNumber("Goal Y", Robot.getGoalY());
    
}
 
開發者ID:Team4914,項目名稱:2017-emmet,代碼行數:43,代碼來源:OI.java

示例14: OperatorInterface

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OperatorInterface() {

        driveStick = new Joystick(DRIVE_JOYSTICK_PORT);
        opStick = new Joystick(OPERATOR_STICK_PORT);
        groundGearOut = new JoystickButton(opStick, 420);
        trackButton = new JoystickButton(driveStick,TRACKING_BUTTON);
        trackButton.whileHeld(new VisionDriveCommand());
        climbButton = new JoystickButton(opStick,CLIMB_BUTTON);
        climbButton.whileHeld(new ClimbUp());
        flipOutButton = new JoystickButton(opStick,FLIP_OUT_BUTTON_PORT);
        flipOutButton.whenPressed(new FlipGear(true));
        openButton = new JoystickButton(opStick,OPEN_GEAR_MANIPULATOR_PORT);
        openButton.whenPressed(new OpenGearManipulator());
        closeButton = new JoystickButton(opStick,CLOSE_GEAR_MANIPULATOR_PORT);
        closeButton.whenPressed(new CloseGearManipulator());
        flipInButton = new JoystickButton(opStick, FLIP_IN_BUTTON_PORT);
        flipInButton.whenPressed(new FlipGear(false));
        intakeButton = new JoystickButton(opStick, INTAKE_BUTTON_PORT);
       // intakeButton.whileHeld(new IntakeCommand());
        intakeButton.whileHeld(new GroundPickupDown());
        intakeButton.whenInactive(new GroundPickupUpCommand());
        shiftButton = new JoystickButton(driveStick, SHIFT_DOWN_BUTTON);
        shiftButton.whileHeld(new ShiftDown());
        shiftButton.whenInactive(new ShiftUp());
        shootButton = new JoystickButton(opStick,SHOOTING_BUTTON);
        shootButton.whileHeld(new Shoot());
        togglePickupBarButton = new JoystickButton(opStick, TOGGLE_PICKUPBAR_BUTTON);
        togglePickupBarButton.whileHeld(new IntakeCommand());

        //TODO: COMMENT THIS OUT OR EVERYTHING GOES TO SHIT
        /*while (trackButton.get() || climbButton.get() || flipOutButton.get() || openButton.get() || closeButton.get()
                || flipInButton.get() || intakeButton.get() || shiftButton.get() || shootButton.get() || togglePickupBarButton.get()){
            buttons.add(trackButton);
            buttons.add(climbButton);
            buttons.add(flipInButton);
            buttons.add(flipOutButton);
            buttons.add(openButton);
            buttons.add(closeButton);
            buttons.add(intakeButton);
            buttons.add(shiftButton);
            buttons.add(shootButton);
            buttons.add(togglePickupBarButton);
            int[] rands = new int[10];
            for(int i=0;i<10;i++){
                rands[i] = (int)Math.floor(Math.random()*10 + 1);
                JoystickButton butan = buttons.get(i);
                butan = new JoystickButton(opStick, rands[i]);
            }
        }*/
    }
 
開發者ID:FRC-2928,項目名稱:VikingRobot,代碼行數:51,代碼來源:OperatorInterface.java

示例15: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI() {
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

       logitech = new Joystick(2);
       
       stUC = new JoystickButton(logitech, 9);
       stUC.whenReleased(new StopUnwindClimber());
       uC = new JoystickButton(logitech, 9);
       uC.whileHeld(new UnwindClimber());
       cPC = new JoystickButton(logitech, 2);
       cPC.whenPressed(new ClimberPistonClose());
       oCFG = new JoystickButton(logitech, 4);
       oCFG.whenPressed(new OpenFloorGear());
       rGD = new JoystickButton(logitech, 7);
       rGD.whenPressed(new RotateGearDown());
       rGU = new JoystickButton(logitech, 5);
       rGU.whenPressed(new RotateGearUp());
       stC = new JoystickButton(logitech, 1);
       stC.whenReleased(new StopClimber());
       sC = new JoystickButton(logitech, 1);
       sC.whileHeld(new StartClimber());
       cG = new JoystickButton(logitech, 8);
       cG.whenPressed(new CloseGear());
       oG = new JoystickButton(logitech, 6);
       oG.whenPressed(new OpenGear());
       leftJoystick = new Joystick(1);
       
       nCS = new JoystickButton(leftJoystick, 1);
       nCS.whenReleased(new NonJoystickScale());
       cS = new JoystickButton(leftJoystick, 1);
       cS.whileHeld(new JoystickScale());
       rightJoystick = new Joystick(0);
       
       iNV = new JoystickButton(rightJoystick, 1);
       iNV.whenPressed(new Inversion());


       // SmartDashboard Buttons

   // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

	// autogenerated code declares the number of each button and what
	// joystick it is on
}
 
開發者ID:RobotsByTheC,項目名稱:CMonster2017,代碼行數:45,代碼來源:OI.java


注:本文中的edu.wpi.first.wpilibj.buttons.JoystickButton.whileHeld方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。