本文整理匯總了Java中edu.wpi.first.wpilibj.buttons.JoystickButton.whenPressed方法的典型用法代碼示例。如果您正苦於以下問題:Java JoystickButton.whenPressed方法的具體用法?Java JoystickButton.whenPressed怎麽用?Java JoystickButton.whenPressed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.buttons.JoystickButton
的用法示例。
在下文中一共展示了JoystickButton.whenPressed方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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));
}
示例2: 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);
}
示例3: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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());
}
示例4: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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));
}
示例5: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
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());
}
示例6: 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());
}
示例7: 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()); */
}
示例8: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI() {
xbox = new XboxController(1); //Be careful not to plug in multiple USB Items...
switchSpin = new JoystickButton(xbox, RobotMap.PASS);
launch = new JoystickButton(xbox, RobotMap.LAUNCH);
toggleGrabber = new JoystickButton(xbox, RobotMap.PASS_TOGGLE);
switchSpin.whenPressed(new PassCommand());
launch.whenPressed(new LaunchCommandGroup());
toggleGrabber.whenPressed(new ToggleGrabber());
}
示例9: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI(){
raiseForkLiftButton = new JoystickButton(stick2, 1);
lowerForkLiftButton = new JoystickButton(stick2, 2);
raiseDumperButton = new JoystickButton(stick2, 5);
lowerDumperButton = new JoystickButton(stick2, 6);
raiseGoalieButton = new JoystickButton(stick2, 7);
lowerGoalieButton = new JoystickButton(stick2, 8);
fireAndWaitButton = new JoystickButton(stick2, 4);
sonicButton = new JoystickButton(stick2, 10);
joyThresh = new Hole(OI.getStick(), 1,1,1,1);
raiseForkLiftButton.whenPressed(new RaiseForkLift());
lowerForkLiftButton.whenPressed(new LowerForkLift());
raiseGoalieButton.whenPressed(new GoalieUp());
lowerGoalieButton.whenPressed(new GoalieDown());
raiseDumperButton.whenPressed(new LiftDumper());
lowerDumperButton.whenPressed(new LowerDumper());
fireAndWaitButton.whenPressed(new FireAndWait());
sonicButton.whenPressed(new SonicTest());
SmartDashboard.putNumber("Ultrasonic Value:", SensorBase.sonic.getVoltage()/9.766);
SmartDashboard.putBoolean("GoalieDown:", OI.goalie.atGoalieDownStop());
SmartDashboard.putBoolean("GoalieUp:", OI.goalie.atGoalieUpStop());
SmartDashboard.getBoolean("ForkUp", OI.forkLift.atUpperStop());
SmartDashboard.getBoolean("ForkDown", OI.forkLift.atLowerStop());
SmartDashboard.getBoolean("DumperUp", OI.dumper.AtUpperStop());
SmartDashboard.getBoolean("DumperDown", OI.dumper.AtLowerStop());
SmartDashboard.getNumber("DriveOutput1", Chassis.victor1.getSpeed());
SmartDashboard.getNumber("DriveOutput2", Chassis.victor2.getSpeed());
SmartDashboard.getNumber("DriveOutput3", Chassis.victor3.getSpeed());
SmartDashboard.getNumber("DriveOutput4", Chassis.victor4.getSpeed());
}
示例10: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
secondaryController = new Joystick(2);
retractCatcherButton = new JoystickButton(secondaryController, 6);
retractCatcherButton.whenPressed(new CatcherRetractCommand());
extendCatcherButton = new JoystickButton(secondaryController, 8);
extendCatcherButton.whenPressed(new CatcherExtendCommand());
retractSweeperButton = new JoystickButton(secondaryController, 5);
retractSweeperButton.whenPressed(new SweeperRetractCommand());
extendSweeperButton = new JoystickButton(secondaryController, 7);
extendSweeperButton.whenPressed(new SweeperExtendCommand());
sweeperEjectButton = new JoystickButton(secondaryController, 4);
sweeperEjectButton.whenPressed(new SweeperEjectCommand());
sweeperOffButton = new JoystickButton(secondaryController, 1);
sweeperOffButton.whenPressed(new SweeperOffCommand());
sweeperSweepButton = new JoystickButton(secondaryController, 2);
sweeperSweepButton.whenPressed(new SweeperSweepCommand());
driveJoystick = new Joystick(1);
enableFieldCentricControl = new JoystickButton(driveJoystick, 7);
enableFieldCentricControl.whenPressed(new FieldCentricMecanumDriveCommand());
enableNormalDriveButton = new JoystickButton(driveJoystick, 8);
enableNormalDriveButton.whenPressed(new DriveCommand());
resetGyroButton = new JoystickButton(driveJoystick, 12);
resetGyroButton.whenPressed(new ResetGyroComand());
fieldCentricMecanumDriveButton = new JoystickButton(driveJoystick, 8);
fieldCentricMecanumDriveButton.whenPressed(new FieldCentricMecanumDriveCommand());
// SmartDashboard Buttons
SmartDashboard.putData("Sweeper Extend Command", new SweeperExtendCommand());
SmartDashboard.putData("Sweeper Retract Command", new SweeperRetractCommand());
SmartDashboard.putData("Sweeper Sweep Command", new SweeperSweepCommand());
SmartDashboard.putData("Sweeper Eject Command", new SweeperEjectCommand());
SmartDashboard.putData("Sweeper Off Command", new SweeperOffCommand());
SmartDashboard.putData("Catcher Extend Command", new CatcherExtendCommand());
SmartDashboard.putData("Catcher Retract Command", new CatcherRetractCommand());
SmartDashboard.putData("Reset Gyro Comand", new ResetGyroComand());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
示例11: 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());
}
示例12: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //導入方法依賴的package包/類
public OI(Scheduler scheduler) {
joystick = new Joystick(RobotMap.JOYSTICK_PORT);
triggerButton = new JoystickButton(joystick, RobotMap.JSBUTTON_TRIGGER);
gyroReset=new JoystickButton(joystick,RobotMap.JSBUTTON_GYRO_RESET);
gyroReset.whenPressed(new GyroReset());
// triggerButton.whenPressed(new DriveWithJoystick());
// (new DriveWithJoystick()).start();
scheduler.add(new DriveWithJoystick());
}
示例13: 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());
}
示例14: 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
}
示例15: 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());
}