public void turnHandle() { if (xbox.getX(Hand.kRight) >= .5) { System.out.println("Turn to the right"); } else { System.out.println("Turn to the left"); } System.out.println("" + xbox.getX(Hand.kRight)); }
public void xHandle() { double xbVal = xbox.getX(Hand.kLeft); if (xbVal >= .5) { System.out.println("Move to the right"); } else { System.out.println("Move to the left"); } System.out.println("" + xbVal); }
protected void execute() { double value = Robot.operatorInterface.xboxController.getTriggerAxis(Hand.kRight) - Robot.operatorInterface.xboxController.getTriggerAxis(Hand.kLeft); //SmartDashboard.putNumber("ManualControl_value", value); switch (type) { case DRIVE_THROTTLE: Robot.driveTrain.rawThrottleTurnDrive(value, 0); break; case DRIVE_TURN: Robot.driveTrain.rawThrottleTurnDrive(0, value); break; case SHOOTER_RPM: Robot.shooter.setShooterPercentVBus(value); break; case INTAKE: Robot.intake.setIntakeRaw(value); break; case FEEDER: Robot.feeder.setFeeder(value); break; case GEAR_SERVO: Robot.gearManipulator.setServoRaw(SmartDashboard.getNumber("ManualControl_value", 0)); break; case STIRRER_SERVO: Robot.stirrer.setStirrer(value); break; default: break; } }
@Override public void run() { if(stick.getBumper(Hand.kLeft)){ spike.set(true); }else{ spike.set(false); } }
@Override protected void execute() { if(Robot.oi.getJoystick2().getTriggerAxis(Hand.kRight) > TRIGGER_DEADZONE){ Robot.driveSubsystem.enableBrakeMode(false); Robot.climbingSubsystem.climbTalon.set(Robot.oi.getJoystick2().getTriggerAxis(Hand.kRight)); } //else if(Robot.oi.getJoystick2().getYButton() == true){ // Robot.climbingSubsystem.climbTalon.set(1.0); //} else{ Robot.climbingSubsystem.climbTalon.set(0); } }
private double nonZero(double leftVal, double rightVal) { if (leftVal == 0) { return rightVal; } else if (rightVal == 0) { return leftVal; } else { if (getPreference() == Hand.kLeft) { return leftVal; } else if (getPreference() == Hand.kRight) { return rightVal; } else { return Math.max(leftVal, rightVal); } } }
public void yHandle() { double xbVal = xbox.getY(Hand.kLeft); if (xbVal >= .5) System.out.println("Move forward!"); else System.out.println("Move backward"); System.out.println("" + xbVal); }
public double getThrottle() { return -xboxController.getY(GenericHID.Hand.kLeft); }
public double getTurn() { return -xboxController.getX(GenericHID.Hand.kRight); }
public boolean isQuickTurn() { return xboxController.getStickButton(GenericHID.Hand.kRight); }
public double getTriggerValue() { return xboxController.getTriggerAxis(Hand.kRight) - xboxController.getTriggerAxis(Hand.kLeft); }
public DualJoystick(int left, int right, Hand pref) { this.left = new Joystick(left); this.right = new Joystick(right); this.pref = pref; }
public DualJoystick(Joystick left, Joystick right, Hand pref) { this.left = left; this.right = right; this.pref = pref; }
public void setPreference(Hand pref) { this.pref = pref; }
public Hand getPreference() { return pref; }
public boolean getBumper(Hand hand) { return false; }
public boolean getTop(Hand hand) { return left.getTop() || right.getTop(); }
public boolean getTrigger(Hand hand) { return left.getTrigger() || right.getTrigger(); }
public double getX(Hand hand) { double leftVal = left.getX(); double rightVal = right.getX(); return nonZero(leftVal, rightVal); }
public double getY(Hand hand) { double leftVal = left.getY(); double rightVal = right.getY(); return nonZero(leftVal, rightVal); }
public double getZ(Hand hand) { double leftVal = left.getZ(); double rightVal = right.getZ(); return nonZero(leftVal, rightVal); }
protected void execute() { driveTrain.pyramidDrive(oi.getXbox(), Hand.kLeft); }
/** * Every command that implements automatic behavior should check this in isFinished(). This method * returns true if * <ul> * <li>The left (throttle) stick button is pressed, or</li> * <li>Throttle is applied beyond 0.5</li> * </ul> * * @return True if the above conditions are met. */ public boolean isCancelled() { // just to be safe. The controller could fall down or something. if (DriverStation.getInstance().isAutonomous()) { return false; } return getThrottle() > 0.5 || getThrottle() < -0.5 || xboxController.getStickButton(GenericHID.Hand.kLeft) || farmController.getRawButton(28); }