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

项目:Storm2014    文件:LimitSwitchedMotor.java   
/**
 * 
 * @param controller The {@link SpeedController} that controls the motor.
 * @param top The top {@link Trigger} (trigger at the positive end of the motor's output).
 * @param topOnValue The value from the top {@link Trigger} where you want the motor to stop.
 * @param bottom The bottom {@link Trigger} (trigger at the negative end of the motor's output).
 * @param bottomOnValue The value from the bottom {@link Trigger} where you want the motor to stop.
 */
public LimitSwitchedMotor(SpeedController controller,Trigger top,boolean topOnValue,
                                                     Trigger bottom,boolean bottomOnValue) {
    _controller = controller;
    _top = top;
    _bottom = bottom;
    _bgThread.schedule(_bgTask, 0, (long)(DEFAULT_PERIOD*1000));
    _topOn = topOnValue;
    _bottomOn = bottomOnValue;
}
项目:Storm2013    文件:LimitSwitchedMotor.java   
/**
 * 
 * @param controller The {@link SpeedController} that controls the motor.
 * @param top The top {@link Trigger} (trigger at the positive end of the motor's output).
 * @param topOnValue The value from the top {@link Trigger} where you want the motor to stop.
 * @param bottom The bottom {@link Trigger} (trigger at the negative end of the motor's output).
 * @param bottomOnValue The value from the bottom {@link Trigger} where you want the motor to stop.
 */
public LimitSwitchedMotor(SpeedController controller,Trigger top,boolean topOnValue,
                                                     Trigger bottom,boolean bottomOnValue) {
    _controller = controller;
    _top = top;
    _bottom = bottom;
    _bgThread.schedule(_bgTask, 0, (long)(DEFAULT_PERIOD*1000));
    _topOn = topOnValue;
    _bottomOn = bottomOnValue;
}
项目:MinuteMan    文件:MultiTrigger.java   
public MultiTrigger(Trigger[] triggers){
    this.triggers = triggers;
}
项目:frc2017    文件:OI.java   
public OI() {
  this.joystick = new XboxController(RobotMap.XBOX_CONTROLLER);

  this.joystick2 = new XboxController(RobotMap.XBOX_CONTROLLER2);


  this.buttonA2 = new JoystickButton(this.joystick2, 1);
  this.buttonB2 = new JoystickButton(this.joystick2, 2);
  this.buttonX2 = new JoystickButton(this.joystick2, 3);
  this.buttonY2 = new JoystickButton(this.joystick2, 4);
  this.buttonLeftBumper2 = new JoystickButton(this.joystick2, 5);
  this.buttonRightBumper2 = new JoystickButton(this.joystick2, 6);
  this.buttonBack2 = new JoystickButton(this.joystick2, 7);
  this.buttonStart2 = new JoystickButton(this.joystick2, 8);
  this.buttonLeftThumb2 = new JoystickButton(this.joystick2, 9);
  this.buttonRightThumb2 = new JoystickButton(this.joystick2, 10);
  this.dpadUp2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 0;}};
  this.dpadUpRight2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 45;}};
  this.dpadRight2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 90;}};
  this.dpadDownRight2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 135;}};
  this.dpadDown2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 180;}};
  this.dpadDownLeft2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 225;}};
  this.dpadLeft2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 270;}};
  this.dpadUpLeft2 = new Trigger() {@Override public boolean get() {return joystick2.getPOV(0) == 315;}};

  // mappings based on this post from CD...
  // https://www.chiefdelphi.com/forums/attachment.php?attachmentid=20028&d=1455109186
  this.buttonA = new JoystickButton(this.joystick, 1);
  this.buttonB = new JoystickButton(this.joystick, 2);
  this.buttonX = new JoystickButton(this.joystick, 3);
  this.buttonY = new JoystickButton(this.joystick, 4);
  this.buttonLeftBumper = new JoystickButton(this.joystick, 5);
  this.buttonRightBumper = new JoystickButton(this.joystick, 6);
  this.buttonBack = new JoystickButton(this.joystick, 7);
  this.buttonStart = new JoystickButton(this.joystick, 8);
  this.buttonLeftThumb = new JoystickButton(this.joystick, 9);
  this.buttonRightThumb = new JoystickButton(this.joystick, 10);
  this.dpadUp = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 0;}};
  this.dpadUpRight = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 45;}};
  this.dpadRight = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 90;}};
  this.dpadDownRight = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 135;}};
  this.dpadDown = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 180;}};
  this.dpadDownLeft = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 225;}};
  this.dpadLeft = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 270;}};
  this.dpadUpLeft = new Trigger() {@Override public boolean get() {return joystick.getPOV(0) == 315;}};

  //this.buttonA.whenPressed(new DriveHeadingAndDistance(0, 1));
  //this.buttonA.whenPressed(new DriveStraightCommand(5));
 // this.buttonA.whenPressed(new DriveStraightCommand(5));
  //this.buttonB.whenPressed(new TurnToHeading(180));
  this.buttonRightBumper.whileHeld(new DeliverGearCommand());

  this.buttonA2.whenPressed(new FeederCommand());
  this.buttonB2.toggleWhenPressed(new ShooterCommand());
  //this.buttonX2.whenPressed(new PushGear());
}