本文整理汇总了Java中edu.wpi.first.wpilibj.buttons.JoystickButton.whenReleased方法的典型用法代码示例。如果您正苦于以下问题:Java JoystickButton.whenReleased方法的具体用法?Java JoystickButton.whenReleased怎么用?Java JoystickButton.whenReleased使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.buttons.JoystickButton
的用法示例。
在下文中一共展示了JoystickButton.whenReleased方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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());
}
示例3: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入方法依赖的package包/类
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
primaryJoystick = new Joystick(0);
A = new JoystickButton(primaryJoystick, 1);
B = new JoystickButton(primaryJoystick, 2);
X = new JoystickButton(primaryJoystick, 3);
TRIANGLE = new JoystickButton(primaryJoystick, 4);
rBumper = new JoystickButton(primaryJoystick, 6);
lBumper = new JoystickButton(primaryJoystick, 5);
START = new JoystickButton(primaryJoystick, 8);
SELECT = new JoystickButton(primaryJoystick, 7);
rBumper.whenPressed(new ClawExtend2());
rBumper.whenReleased(new ClawRetract2());
lBumper.whenPressed(new ToggleDriveDirection());
X.whenPressed(new ToggleDriveDirection());
B.whenPressed(new DeadReckon(5));
coJoystick = new Joystick(1);
coX = new JoystickButton(coJoystick, 1);
coCIRCLE = new JoystickButton(coJoystick, 2);
coSQUARE = new JoystickButton(coJoystick, 3);
coTRIANGLE = new JoystickButton(coJoystick, 4);
corBumper = new JoystickButton(coJoystick, 6);
colBumper = new JoystickButton(coJoystick, 5);
coSTART = new JoystickButton(coJoystick, 8);
coSELECT = new JoystickButton(coJoystick, 7);
colBumper.whenPressed(new ClawExtend2());
colBumper.whenReleased(new ClawRetract2());
corBumper.whenPressed(new ClawExtend2());
corBumper.whenReleased(new ClawRetract2());
/*
TRIGGER = new JoystickButton(coJoystick, 1);
THUMB = new JoystickButton(coJoystick, 2);
LTHUMB = new JoystickButton(coJoystick, 3);
RTHUMB = new JoystickButton(coJoystick, 4);
*/
// SmartDashboard Buttons
}
示例4: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入方法依赖的package包/类
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
primaryJoystick = new Joystick(0);
X = new JoystickButton(primaryJoystick, 1);
CIRCLE = new JoystickButton(primaryJoystick, 2);
SQUARE = new JoystickButton(primaryJoystick, 3);
TRIANGLE = new JoystickButton(primaryJoystick, 4);
rBumper = new JoystickButton(primaryJoystick, 6);
lBumper = new JoystickButton(primaryJoystick, 5);
START = new JoystickButton(primaryJoystick, 8);
SELECT = new JoystickButton(primaryJoystick, 7);
lBumper.whenPressed(new ClawExtend());
lBumper.whenReleased(new ClawRetract());
rBumper.whenPressed(new ToggleDriveModes());
SQUARE.whenPressed(new ToggleDriveDirection());
coJoystick = new Joystick(1);
coX = new JoystickButton(coJoystick, 1);
coCIRCLE = new JoystickButton(coJoystick, 2);
coSQUARE = new JoystickButton(coJoystick, 3);
coTRIANGLE = new JoystickButton(coJoystick, 4);
corBumper = new JoystickButton(coJoystick, 6);
colBumper = new JoystickButton(coJoystick, 5);
coSTART = new JoystickButton(coJoystick, 8);
coSELECT = new JoystickButton(coJoystick, 7);
colBumper.whenPressed(new ClawExtend());
colBumper.whenReleased(new ClawRetract());
/*
TRIGGER = new JoystickButton(coJoystick, 1);
THUMB = new JoystickButton(coJoystick, 2);
LTHUMB = new JoystickButton(coJoystick, 3);
RTHUMB = new JoystickButton(coJoystick, 4);
*/
// SmartDashboard Buttons
}
示例5: 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
}
示例6: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入方法依赖的package包/类
public OI() {
driverRightJoystick = new Joystick(2);
driverLeftJoystick = new Joystick(1);
Button_Canon_SetAngleWhiteZone = new DigitalIOButton(3);
Button_Canon_SetAngleWhiteZone.whileHeld(new Canon_CoPilotSetAngleZone());
Button_Canon_SetAngleWhiteZone.whenReleased(new Canon_CancelPrepareTopGoal());
Button_Canon_SetAngleWhiteZone.whenReleased(new CanonAngle_HandleManualMode());
Button_DriverCanon_PrepareTopGoal = new JoystickButton(driverLeftJoystick, 1);
Button_DriverCanon_PrepareTopGoal.whileHeld(new CanonSpinner_PrepareTopGoal());
Button_DriverCanon_PrepareTopGoal.whenReleased(new Canon_CancelPrepareTopGoal());
Button_DriverCanon_Shoot = new JoystickButton(driverLeftJoystick, 7);
Button_DriverCanon_Shoot.whenPressed(new CanonShooter_Shoot());
Button_Canon_PilotShootAuto = new JoystickButton(driverRightJoystick, 1);
Button_Canon_PilotShootAuto.whileHeld(new Canon_ShootTopGoalTeleop());
Button_Canon_PilotShootAuto.whenInactive(new CanonAngle_HandleManualMode());
Button_DriveTrain_MoveTo = new JoystickButton(driverRightJoystick, 9);
Button_DriveTrain_MoveTo.whenPressed(new DriveTrain_MoveTo(2));
Button_Canon_CopilotGrab = new JoystickButton(driverLeftJoystick, 2);
Button_Canon_CopilotGrab.whileHeld(new Canon_CopilotGrab());
Button_Canon_CopilotGrab.whenInactive(new CanonAngle_HandleManualMode());
Button_CanonShooter_Shoot = new DigitalIOButton(1);
Button_CanonShooter_Shoot.whenPressed(new CanonShooter_Shoot());
Button_CanonSpinner_ShootSpeed = new DigitalIOButton(2);
Button_CanonSpinner_ShootSpeed.whileHeld(new CanonSpinner_PrepareTopGoal());
Button_CanonSpinner_CatchSpeed = new DigitalIOButton(4);
Button_CanonSpinner_CatchSpeed.whileHeld(new CanonSpinner_ReceivePass());
Button_CanonSpinner_SetManualMode = new DigitalIOButton(8);
Button_CanonSpinner_SetManualMode.whenInactive(new CanonSpinner_HandlePresetMode());
Button_CanonSpinner_SetManualMode.whileHeld(new CanonSpinner_HandleManualMode());
Button_ResetShooterMIN = new JoystickButton(driverRightJoystick, 6);
Button_ResetShooterMIN.whileHeld(new CanonAngle_SetShooterAngle(8));
Button_ResetShooterMIN.whenReleased(new CanonAngle_Cancel());
Button_ResetShooterMAX = new JoystickButton(driverRightJoystick, 11);
Button_ResetShooterMAX.whileHeld(new CanonAngle_SetShooterAngle(90));
Button_ResetShooterMAX.whenReleased(new CanonAngle_Cancel());
}
示例7: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入方法依赖的package包/类
public OI() {
// Drive joystick
driveJoystick = new Joystick(Constants.DRIVE_JOYSTICK_PORT);
JoystickButton shiftGearDownButton = new JoystickButton(driveJoystick,
Constants.SHIFT_GEAR_DOWN_BUTTON.value);
shiftGearDownButton.whenPressed(new ShiftToLowGear());
shiftGearDownButton.whenReleased(new StopShiftGear());
JoystickButton shiftGearUpButton = new JoystickButton(driveJoystick,
Constants.SHIFT_GEAR_UP_BUTTON.value);
shiftGearUpButton.whenPressed(new ShiftToHighGear());
shiftGearUpButton.whenReleased(new StopShiftGear());
JoystickButton slowModeButton = new JoystickButton(driveJoystick,
Constants.SLOW_MODE_BUTTON.value);
slowModeButton.whenPressed(new ToggleDriveSlowMode());
slowModeButton.whenReleased(new ToggleDriveSlowMode());
// Operator joystick
operatorJoystick = new Joystick(Constants.OPERATOR_JOYSTICK_PORT);
JoystickButton pickupButton = new JoystickButton(operatorJoystick,
Constants.PICKUP_BUTTON.value);
pickupButton.whenPressed(new PickupBall());
pickupButton.whenReleased(new StopPickupBall());
JoystickButton releasePickupButton = new JoystickButton(operatorJoystick,
Constants.RELEASE_PICKUP_BUTTON.value);
releasePickupButton.whenPressed(new ReleasePickupBall());
releasePickupButton.whenReleased(new StopPickupBall());
JoystickButton shootWithResetButton = new JoystickButton(operatorJoystick,
Constants.SHOOT_WITH_RESET_BUTTON.value);
shootWithResetButton.whenPressed(new ShootBallWithReset());
JoystickButton shootWithoutResetButton = new JoystickButton(operatorJoystick,
Constants.SHOOT_WITHOUT_RESET_BUTTON.value);
shootWithoutResetButton.whenPressed(new ShootBallWithoutReset());
JoystickButton stopShootButton = new JoystickButton(operatorJoystick,
Constants.STOP_SHOOT_BUTTON.value);
stopShootButton.whenPressed(new StopShootBall());
}
示例8: OI
import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入方法依赖的package包/类
public OI() {
xbox = new XboxController(RobotMap.xboxController);
genius = new Joystick(RobotMap.leftJoystick);
// firePiston = new JoystickButton(xbox, RobotMap.firePiston);
loadFrisbee = new JoystickButton(xbox, RobotMap.loadFrisbee);
launchFrisbee = new JoystickButton(xbox, RobotMap.launchFrisbee);
TopClimbingPiston = new JoystickButton (xbox, RobotMap.TopClimbingPiston);
BottomClimbingPiston = new JoystickButton (xbox, RobotMap.BottomClimbingPiston);
fender = new JoystickButton(xbox, RobotMap.bumberDeflector);
// Climb = new JoystickButton(xbox, RobotMap.Climb);
pitchFore = new JoystickButton(xbox, RobotMap.pitchFore);
pitchAft = new JoystickButton(xbox, RobotMap.pitchAft);
StopMotors = new JoystickButton(xbox, RobotMap.StopMotors);
AutoAim = new JoystickButton(xbox, RobotMap.AutoAim);
debug = new JoystickButton(xbox, RobotMap.debugButton);
adjustUp = new JoystickButton(genius, RobotMap.adjustUp);
adjustLeft = new JoystickButton(genius, RobotMap.adjustLeft);
adjustRight = new JoystickButton(genius, RobotMap.adjustRight);
adjustDown = new JoystickButton(genius, RobotMap.adjustDown);
AutoAim.whileHeld(new AutoAim());
loadFrisbee.whileHeld(new LoadFrisbee());
launchFrisbee.whenPressed(new LaunchFrisbee());
StopMotors.whenPressed(new StopLaunchWheels(0));
loadFrisbee.whileHeld(new LoadFrisbee());
TopClimbingPiston.whileHeld(new ExtendTopClimbingPiston());
TopClimbingPiston.whileHeld(new PyramidDrive());
TopClimbingPiston.whenReleased(new RetractTopClimbingPiston());
BottomClimbingPiston.whileHeld(new ExtendBottomClimbingPiston());
BottomClimbingPiston.whileHeld(new PyramidDrive());
BottomClimbingPiston.whenReleased(new RetractBottomPiston());
fender.whenPressed(new ExtendBumperDeflector());
// Climb.whenPressed(new LevelDuringClimb());
pitchFore.whileHeld(new MoveClimbingMotor());
pitchAft.whileHeld(new MoveClimbingMotorBackwards());
debug.whileHeld(new LoadFrisbee());
adjustUp.whenPressed(new KWindageUp());
adjustLeft.whenPressed(new KWindageLeft());
adjustRight.whenPressed(new KWindageRight());
adjustDown.whenPressed(new KWindageDown());
}