public MySolenoid(int solDownChannel, int solUpChannel, boolean bDefault) { // True means its backwards, so the default is on m_bDefaultStat = bDefault; m_solUp = new Solenoid(solUpChannel); m_solDown = new Solenoid(solDownChannel); m_solUp.set(m_bDefaultStat); m_solDown.set(!m_bDefaultStat); }
/** * Sets the solenoids based on argument, true means active * * @param bVal */ public void set(boolean bVal) { if (bVal) { m_solUp.set(m_bDefaultStat); m_solDown.set(!m_bDefaultStat); } else { m_solUp.set(!m_bDefaultStat); m_solDown.set(m_bDefaultStat); } }
/** * Move the flopper * * @param down Button input */ public void flop(boolean down) { if (down && !flopped) { position = !position; flopperA.set(position); flopperB.set(!position); flopped = true; } else if (!down) { flopped = false; } }
@Override public HardwareSingleSolenoid retract() { solenoid.set(false); direction = Direction.RETRACTING; checkState(); return this; }
@Override public HardwareSingleSolenoid extend() { solenoid.set(true); direction = Direction.EXTENDING; checkState(); return this; }
/** Initializes the instance variables. Done here because this can be called twice. */ protected void initialize() { if (!RobotMap.isPrototype) { // final robot code goes here } else { gathererOn = false; gathererSwitch = new Relay(RobotMap.gathererMotorRelay); pullGatherer = new Solenoid(RobotMap.pullGatherer); pushGatherer = new Solenoid(RobotMap.pushGatherer); leftExhaust = new Solenoid(RobotMap.leftExhaust); rightExhaust = new Solenoid(RobotMap.rightExhaust); pullGatherer.set(false); pushGatherer.set(true); } }
HardwareSingleSolenoid(edu.wpi.first.wpilibj.Solenoid solenoid, Direction initialDirection) { assert solenoid != null; assert initialDirection != null; this.solenoid = solenoid; this.direction = initialDirection; solenoid.set(initialDirection == Direction.EXTENDING); checkState(); }
public void foldGatherer(boolean pull) { if (pull) { pushGatherer.set(false); rightExhaust.set(true); leftExhaust.set(true); pullGatherer.set(true); } else { pullGatherer.set(false); rightExhaust.set(false); leftExhaust.set(false); pushGatherer.set(true); } }
/** This function is called periodically during autonomous */ public void autonomousInit() { autoTimer.reset(); autoTimer.start(); gyro.reset(); relay.set(Relay.Value.kOn); setSpeedFast(); setLEDTeamColour(); sol4.set(false); sol5.set(true); sol7.set(true); sol8.set(false); autoStop = false; autonomousStopped = false; autoTimeAtStop = 99999; drive.setRun(false); loadAndShoot.setRun(false); autoForward(); }
protected void execute() { if (time.get() < 3.0) { talonLeft.set(1); talonRight.set(1); } else if (time.get() < 5.0) { talonLeft.set(0); talonRight.set(0); soleLiftDown.set(true); } else if (time.get() < 6.0) { talonLeft.set(-1); talonRight.set(-1); } else talonLeft.set(1); talonRight.set(1); }
private void updateState() { switch (state) { case CLAMPED: clampOpen.set(false); clampClose.set(true); break; case LIFTED: liftUp.set(true); liftDown.set(false); break; case OPEN: liftDown.set(true); liftUp.set(false); clampOpen.set(true); clampClose.set(false); break; default: break; } }
/** This function is called once each time the robot enters operator control. */ public void operatorControl() { drivetrain.setSafetyEnabled(true); compressor.start(); while (isOperatorControl() && isEnabled()) { // The throttle goes from 1 to -1, bottom to top. This // scales it to go 0 to 1, bottom to top. double throttle = (-leftStick.getRawAxis(3) + 1) / 2; double drive = deadband(leftStick.getY()) * throttle; double steer = deadband(-rightStick.getX()) * throttle; drivetrain.arcadeDrive(drive, steer); boolean shouldSpinWheels = leftStick.getRawButton(1); boolean shouldFire = shouldSpinWheels && rightStick.getRawButton(1); shooterWheels.set(shouldSpinWheels ? -1 : 0); shooter.set(shouldFire); Timer.delay(0.005); // wait for a motor update time } }
public void setSpeedSlow() { sol1.set(false); sol2.set(true); }
public void setSpeedFast() { sol1.set(true); sol2.set(false); }
public void retract() { shooterActuator.set(false); }
public void rightOpen(boolean open) { rightGate.set(open); }
public void rightarmclose() { rightSolOpen.set(false); rightSolClose.set(true); }
public void unlock() { discLock.set(false); }
public void set(boolean activated) { collectorArms.set(activated); }
public void extend() { shooterActuator.set(true); }
public void shift(boolean highGear) { isHighGear = highGear; shifter.set(!isHighGear); straightController.setGains(highGear ? highStraightGains : lowStraightGains); turnController.setGains(highGear ? highTurnGains : lowTurnGains); }
public void shiftHigh() { sole2.set(true); }
public void shiftLow() { sole1.set(true); }
public void setNandoAct(boolean x) { nandoAct.set(x); }
public void setAngleAct(boolean x) { angleAct.set(x); }
public void shoot() { sol7.set(false); sol8.set(true); }
public void leftarmclose() { leftSolOpen.set(false); leftSolClose.set(true); }
public void lock() { discLock.set(true); }
public void operatorControl() { while (this.isEnabled()) { if (controller.getRawButton(1)) { aButtonPressed = true; } else if (aButtonPressed) { aButtonPressed = false; if (!aButtonPressed) { in.set(false); out.set(false); } } if (controller.getRawButton(2)) { bButtonPressed = true; } else if (bButtonPressed) { bButtonPressed = false; if (!bButtonPressed) { in.set(false); out.set(false); } } if (controller.getRawButton(3)) { xButtonPressed = true; } else if (xButtonPressed) { xButtonPressed = false; if (!xButtonPressed) valve.set(Relay.Value.kOff); } if (controller.getRawButton(4)) { yButtonPressed = true; } else if (yButtonPressed) { yButtonPressed = false; valve.set(Relay.Value.kOff); } if (aButtonPressed) { out.set(false); in.set(true); } if (bButtonPressed) { in.set(false); out.set(true); } if (xButtonPressed) { SmartDashboard.putBoolean("compressorOn", true); valve.set(Relay.Value.kOn); } SmartDashboard.putBoolean("compressorOn", xButtonPressed); SmartDashboard.putBoolean("pistonOut", aButtonPressed); SmartDashboard.putBoolean("pistonIn", bButtonPressed); SmartDashboard.putBoolean("pressure relief", input.get()); // System.out.println("output " + input.get()); if (input.get()) { System.out.println("INPUT RETURNED TRUE, SETTING VALVE TO OFF"); valve.set(Relay.Value.kOff); } Timer.delay(.1); } }
public void shiftOff() { sole1.set(false); sole2.set(false); }