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


Java GenericHID类代码示例

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


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

示例1: DirectionalButton

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public DirectionalButton(Direction direction, GenericHID joystick)
{
	neededAngle = 1;
	this.direction = direction;
	this.joystick = joystick;

	switch (direction)
	{
	case UP:
		neededAngle = 0;
		break;
	case DOWN:
		neededAngle = 180;
		break;
	case LEFT:
		neededAngle = 270;
		break;
	case RIGHT:
		neededAngle = 90;
		break;
	}
}
 
开发者ID:BytingBulldogs3539,项目名称:BBLIB,代码行数:23,代码来源:DirectionalButton.java

示例2: execute

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
protected void execute() {
    //here we already have to access the io object. 
    //read the up/down and left/right from io.
    //then pass those values to the mecanum drive function.
    
    SmartDashboard.putNumber("[MC] X", oi.getXbox().getX(GenericHID.Hand.kLeft));
    SmartDashboard.putNumber("[MC] Y", oi.getXbox().getY(GenericHID.Hand.kLeft));
    SmartDashboard.putNumber("[MC] Theta", oi.getXbox().getThrottle());
    X = oi.getXbox().getX(GenericHID.Hand.kLeft);
    if ( Math.abs(X) <= 0.25) {
        X = 0.0;
    } else {
    }
    Y = oi.getXbox().getY(GenericHID.Hand.kLeft);
    if (Math.abs(Y) <= 0.25) {
        Y = 0.0;
    }
    throttle = oi.getXbox().getThrottle();
    if (Math.abs(throttle) <= 0.25) {
        throttle = 0.0;          
    }       

    driveTrain.mecanumDrive(X, Y, throttle, gyro.getAngle());//- (RobotTemplate.gyroOff * Timer.getFPGATimestamp())))
    //driveTrain.mecanumDrive(oi.getXbox().getX(GenericHID.Hand.kLeft), oi.getXbox().getY(GenericHID.Hand.kLeft), oi.getXbox().getTwist(), gyro.getAngle());
}
 
开发者ID:frc3946,项目名称:MecanumDrivetrain,代码行数:26,代码来源:MecanumDrive.java

示例3: execute

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
protected void execute()
{
    if (OI.primaryXboxController.getBumper(GenericHID.Hand.kLeft))
    {
        if (!runShooter)
        {
            shooter.runShooter(shooterSpeed);
            runShooter = true;
        }
        
        else
        {
            shooter.runShooter(0);
            runShooter = false;
        }            
    }
}
 
开发者ID:BadRobots1014,项目名称:BadRobot2013,代码行数:18,代码来源:ShootWithController.java

示例4: winchUp

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public void winchUp(XboxController controller) {
  	double y = deadZoneInput(controller.getY(GenericHID.Hand.kLeft), .1);   	
  			
if(y > .1)
	speedController1.set(y);
else
	speedController1.set(0);
  }
 
开发者ID:FRC-6413,项目名称:steamworks-java,代码行数:9,代码来源:Winch.java

示例5: shouldUseFieldOrientedDrive

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
private boolean shouldUseFieldOrientedDrive() {
  double absXL = Math.abs(joystick.getX(GenericHID.Hand.kLeft));
  absXL = absXL < DEADZONE ? 0 : absXL;
  double absXR = Math.abs(joystick.getX(GenericHID.Hand.kRight));
  absXR = absXR < DEADZONE ? 0 : absXR;
  double abxYL = Math.abs(joystick.getY(GenericHID.Hand.kLeft));
  abxYL = abxYL < DEADZONE ? 0 : abxYL;
  double absYR = Math.abs(joystick.getY(GenericHID.Hand.kRight));
  absYR = absYR < DEADZONE ? 0 : absYR;
  return absXL > absXR || abxYL > absYR;
}
 
开发者ID:FRC-1294,项目名称:frc2017,代码行数:12,代码来源:TeleopDriveCommand.java

示例6: allInputsInDeadZone

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
private boolean allInputsInDeadZone() {
  return Math.abs(getJoystickZ()) <  TRIGGER_DEADZONE &&
          Math.abs(joystick.getX(GenericHID.Hand.kLeft)) < DEADZONE &&
          Math.abs(joystick.getY(GenericHID.Hand.kLeft)) < DEADZONE &&
          Math.abs(joystick.getX(GenericHID.Hand.kRight)) < DEADZONE &&
          Math.abs(joystick.getY(GenericHID.Hand.kRight)) < DEADZONE;

}
 
开发者ID:FRC-1294,项目名称:frc2017,代码行数:9,代码来源:TeleopDriveCommand.java

示例7: tankDrive

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public void tankDrive(
        GenericHID leftStick, int leftAxis, GenericHID rightStick, int rightAxis,
        boolean inverted, boolean squaredInput)
{
    tankDrive(
            leftStick.getRawAxis(leftAxis), rightStick.getRawAxis(rightAxis),
            inverted, squaredInput);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:9,代码来源:HalRobotDrive.java

示例8: arcadeDrive

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public void arcadeDrive(
        GenericHID driveStick, int driveAxis, GenericHID turnStick, int turnAxis,
        boolean inverted, boolean squaredInput)
{
    arcadeDrive(
            driveStick.getRawAxis(driveAxis), turnStick.getRawAxis(turnAxis),
            inverted, squaredInput);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:9,代码来源:HalRobotDrive.java

示例9: OI

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的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());
}
 
开发者ID:CircuitRunners,项目名称:frc_2015_recyclerush,代码行数:40,代码来源:OI.java

示例10: tick

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
@Override
public void tick() {
    Joystick joy = UDPreference.joystick;
    if (UDPreference.JOYSTICK_LAYOUT.toLowerCase().equals("xbox_stick")) {
        UDPreference.drive.mecanumDrive_Cartesian(joy.getX(GenericHID.Hand.kLeft), joy.getY(GenericHID.Hand.kLeft), joy.getX(GenericHID.Hand.kRight), 0);
    }
}
 
开发者ID:Open-RIO,项目名称:UniversalDrive,代码行数:8,代码来源:DriveMecanum.java

示例11: tick

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
@Override
public void tick() {
    Joystick joy = UDPreference.joystick;
    if (UDPreference.JOYSTICK_LAYOUT.toLowerCase().equals("xbox_stick")) {
        UDPreference.drive.tankDrive(joy.getY(GenericHID.Hand.kLeft), joy.getY(GenericHID.Hand.kRight), UDPreference.DRIVE_SQUAREDINPUTS);
    }
}
 
开发者ID:Open-RIO,项目名称:UniversalDrive,代码行数:8,代码来源:DriveTank.java

示例12: execute

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public void execute(XboxController controller) {
    double xleft = controller.getX(GenericHID.Hand.kLeft);
    double yleft = controller.getY(GenericHID.Hand.kLeft);
    double xright = controller.getX(GenericHID.Hand.kRight);
    
    drive.mecanumDrive_Cartesian(joystickSensitivity(xleft), joystickSensitivity(yleft), joystickSensitivity(xright),0);
}
 
开发者ID:owatonnarobotics,项目名称:2014RobotCode,代码行数:8,代码来源:Drive.java

示例13: isFinished

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
protected boolean isFinished() 
{
    if((Timer.getFPGATimestamp()-startTime) > shooterRunTime)
        return true;
    //for debug
    if(OI.primaryXboxController.getBumper(GenericHID.Hand.kLeft) || 
            OI.primaryXboxController.getRawButton(1))
        return true;

    return false;
}
 
开发者ID:BadRobots1014,项目名称:BadRobot2013,代码行数:12,代码来源:Shoot.java

示例14: getThrottle

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public double getThrottle() {
  return -xboxController.getY(GenericHID.Hand.kLeft);
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:4,代码来源:OperatorInterface.java

示例15: getTurn

import edu.wpi.first.wpilibj.GenericHID; //导入依赖的package包/类
public double getTurn() {
  return -xboxController.getX(GenericHID.Hand.kRight);
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:4,代码来源:OperatorInterface.java


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