当前位置: 首页>>代码示例>>Java>>正文


Java Trigger类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.buttons.Trigger的典型用法代码示例。如果您正苦于以下问题:Java Trigger类的具体用法?Java Trigger怎么用?Java Trigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Trigger类属于edu.wpi.first.wpilibj.buttons包,在下文中一共展示了Trigger类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LimitSwitchedMotor

import edu.wpi.first.wpilibj.buttons.Trigger; //导入依赖的package包/类
/**
 * 
 * @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;
}
 
开发者ID:2729StormRobotics,项目名称:Storm2014,代码行数:18,代码来源:LimitSwitchedMotor.java

示例2: MultiTrigger

import edu.wpi.first.wpilibj.buttons.Trigger; //导入依赖的package包/类
public MultiTrigger(Trigger[] triggers){
	this.triggers = triggers;
}
 
开发者ID:taco650,项目名称:MinuteMan,代码行数:4,代码来源:MultiTrigger.java

示例3: OI

import edu.wpi.first.wpilibj.buttons.Trigger; //导入依赖的package包/类
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());
}
 
开发者ID:FRC-1294,项目名称:frc2017,代码行数:57,代码来源:OI.java


注:本文中的edu.wpi.first.wpilibj.buttons.Trigger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。