public void armUse() { // Arm contols int armPotValue = armPot.getValue(); if (xboxDriver.getBtnB()) { // arm for slot feeding if (armPotValue < armSlotFeedingValue - angleTolerance) { armVictor.set(-.2); } else if (armPotValue < armSlotFeedingValue - focusTolerance) { armVictor.set(-.02); } else if (armPotValue > armSlotFeedingValue + angleTolerance) { armVictor.set(.5); } else if (armPotValue > armSlotFeedingValue + focusTolerance) { armVictor.set(.05); } else { armVictor.set(0); } } else if (xboxDriver.getBtnY()) { // arm for shovel feeding if (armPotValue < armShovelFeedingValue - angleTolerance) { armVictor.set(-.2); } else if (armPotValue < armShovelFeedingValue - focusTolerance) { armVictor.set(-.02); } else if (armPotValue > armShovelFeedingValue + angleTolerance) { armVictor.set(.5); } else if (armPotValue > armShovelFeedingValue + focusTolerance) { armVictor.set(.05); } else { armVictor.set(0); } } else { if (xboxDriver.getBtnLB() && armPotValue > minArmValue) { armVictor.set(-.2); // driver left bumper = down, right bumper = up; } else if (xboxDriver.getBtnRB() && armPotValue < maxArmValue) { armVictor.set(.5); } else { armVictor.set(0); } if (xboxDriver.getBtnA() && armPotValue < climbStopValue) { // when driver controls, hold button A to use winch, release to // stop winchRelay.set(Relay.Value.kOn); winchRelay.setDirection(Relay.Direction.kReverse); } else { winchRelay.set(Relay.Value.kOff); } } } // end of arm use
public void shooterUse() { // Betty operation if (xboxOperator.getBtnLB()) { // hold right bumper to fire starterDelay++; if (xboxOperator.getTriggers() < -0.5) { // feeder shot if (shootingSpeed > feederShotSpeed) { // accelerating shooter speed until top speed shootingSpeed = shootingSpeed + flyWheelAcceleration; } else { shootingSpeed = feederShotSpeed; // ensures desired value } } else { // normal shot if (shootingSpeed > normalShotSpeed) { // accelerating shooter speed until top speed shootingSpeed = shootingSpeed + flyWheelAcceleration; } else { shootingSpeed = normalShotSpeed; // ensures desired value } } shooterWheel.set(shootingSpeed); if (xboxOperator.getBtnRB() && starterDelay > 60) { // shoot normal shot bettyRelay.setDirection(Relay.Direction.kForward); bettyRelay.set(Relay.Value.kOn); } else if (xboxOperator.getBtnB() && starterDelay > 60) { // shoot normal shot bettyRelay.setDirection(Relay.Direction.kReverse); bettyRelay.set(Relay.Value.kOn); } else { bettyRelay.set(Relay.Value.kOff); } } else if (bettyOpen.get()) { // close betty if not shooting shootingSpeed = 0.0; bettyRelay.setDirection(Relay.Direction.kForward); bettyRelay.set(Relay.Value.kOn); shooterWheel.set(0); starterDelay = 0; } else { shootingSpeed = 0.0; bettyRelay.set(Relay.Value.kOff); shooterWheel.set(0); starterDelay = 0; } } // end of shooter use