微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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,(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,(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());
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。