@Override public void tick() { PortcullisLiftSubsystemMode mode = (PortcullisLiftSubsystemMode) this.getMode(); switch(mode) { case RAISING: this._lift.set(Value.kForward); break; case LOWERING: this._lift.set(Value.kReverse); break; case DISABLED: case STOPPED: default: this._lift.set(Value.kOff); break; } }
@Override protected void initialize() { if (RobotMap.pneumaticsSolenoidRight.get() == false) { if (RobotMap.pneumaticsDoubleSolenoidCClamps.get() == DoubleSolenoid.Value.kReverse) { RobotMap.pneumaticsDoubleSolenoidCClamps.set(DoubleSolenoid.Value.kForward); endTime = System.currentTimeMillis() + 500; sentinel = true; } else RobotMap.pneumaticsSolenoidRight.set(true); RobotMap.pneumaticsSolenoidLeft.set(false); } else { if (RobotMap.pneumaticsDoubleSolenoidCClamps.get() == DoubleSolenoid.Value.kReverse) { RobotMap.pneumaticsDoubleSolenoidCClamps.set(DoubleSolenoid.Value.kForward); endTime = System.currentTimeMillis() + 500; otherSentinel = true; } else RobotMap.pneumaticsSolenoidRight.set(false); RobotMap.pneumaticsSolenoidLeft.set(true); } }
private Puncher() { try { winch = new CANJaguar(RobotMap.WINCH_JAG); winch.configPotentiometerTurns(1); winch.setPositionReference(CANJaguar.PositionReference.kPotentiometer); winch.setSafetyEnabled(false); setWinchLimit(.95f); } catch (CANTimeoutException ex) { reportCANException(ex); } dogEar = new DoubleSolenoid(RobotMap.DOG_EAR_SOLENOID_DEPLOY, RobotMap.DOG_EAR_SOLENOID_UNDEPLOY); dogEar.set(Value.kReverse); }
public void toggleManipulator() { Value solenoidVal = manipulatorSolenoid.get(); if (solenoidVal == Value.kForward) { manipulatorSolenoid.set(DoubleSolenoid.Value.kReverse); } else { manipulatorSolenoid.set(DoubleSolenoid.Value.kForward); manipulatorMotor.set(0.5); } }
/** * Set the current gear of the transmission. If we have a * physical transmission and we set it within that gear range, * we adjust the solenoid accordingly. * * @param gear * new gear to set the transmission to * * @author Noah Golmant * @written 16 July 201 */ public void setGear (int gear) { if ((gear < 1) || (gear > this.MAX_GEAR)) { if ((this.getDebugState() == DebugState.DEBUG_MOTOR_DATA) || (this.getDebugState() == DebugState.DEBUG_ALL)) { System.out.println("Failed to set gear " + gear + "in setGear()"); } return; } this.gear = gear; // check for a physical transmission if (this.transmissionSolenoids != null) { switch (gear) { case 1: this.transmissionSolenoids.set(Value.kForward); break; case 2: this.transmissionSolenoids.set(Value.kReverse); break; default: this.transmissionSolenoids.set(Value.kOff); break; } } }
@Override public void autonomousInit() { encLeftDrive.reset(); navx.reset(); autoSelected = chooser.getSelected(); System.out.println("Auto selected: " + autoSelected); state = 0; condition = 0; gearpiston.set(Value.kReverse); }
public void autonomous() { String choose = chooser.getSelected(); Skylar.setSafetyEnabled(false); OptimusPrime.setSafetyEnabled(false); switch (choose) { case pos1: case pos2: while (isAutonomous() && isEnabled()) { timer = System.currentTimeMillis(); while (System.currentTimeMillis() - timer <= 3000) { adjustedDrive(0.5, 0.5); } smashDrive(0, 0); getSensorData(); gearBox.set(Value.kReverse); Timer.delay(2); timer = System.currentTimeMillis(); while (System.currentTimeMillis() - timer <= 1000) { adjustedDrive(-0.5, -0.5); } smashDrive(0, 0); getSensorData(); gearBox.set(Value.kForward); break; } case pos3: } }
public void gearBox() { if (stick.getRawButton(5)) { gearBox.set(Value.kReverse); } if (stick.getRawButton(6)) { gearBox.set(Value.kForward); } }
public void switchPos() { switch (solenoid.get()) { case kOff: case kReverse: solenoid.set(Value.kForward); break; case kForward: solenoid.set(Value.kReverse); break; } }
public void toggleAManipulators() { Value solenoidVal = aManipulatorSolenoid.get(); if (solenoidVal == Value.kReverse) { aManipulatorSolenoid.set(DoubleSolenoid.Value.kForward); } else { aManipulatorSolenoid.set(DoubleSolenoid.Value.kReverse); } }
public void toggleIntakeSolenoid() { Value SolenoidVal = Actuator.get(); if (SolenoidVal == Value.kForward) { lowerRake(); } else { raiseRake(); } }
@Override public void run() { if(xbox.getStart()){ solenoid.set(Value.kForward); }else{ solenoid.set(Value.kReverse); } }
@Override public void runAuto(double distance, double speed, boolean useSensor) { if(speed == 0){ solenoid.set(Value.kReverse); }else if(speed == 1){ solenoid.set(Value.kForward); }else{ solenoid.set(Value.kOff); } }
@Override public void run() { if(controller.getRawButton(3)){ //Press button X solenoid.set(Value.kForward); solenoid2.set(Value.kForward); isOpen = true; }else if(controller.getRawButton(4)){ //Press button Y solenoid.set(Value.kReverse); solenoid2.set(Value.kReverse); }else{ solenoid.set(Value.kOff); solenoid2.set(Value.kOff); isOpen = false; } }
@Override public void runAuto(double distance, double speed, boolean useSensor) { if(speed == SOLENOID_OFF){ solenoid.set(Value.kReverse); }else if(speed == SOLENOID_ON){ solenoid.set(Value.kForward); }else{ solenoid.set(Value.kOff); } }
/** * Stop everything. */ private static void done () { // after autonomous is disabled, the state machine will stop. // this code will run but once. autonomousEnabled = false; // stop printing debug statements. debug = false; // turn off all motors. Hardware.transmission.controls(0.0, 0.0); // including the arm. // end any surviving arm motions. armState = ArmState.DONE; Hardware.armMotor.set(0.0); // reset delay timer Hardware.delayTimer.stop(); Hardware.delayTimer.reset(); // turn off ringlight. Hardware.ringLightRelay.set(Relay.Value.kOff); Hardware.transmission .setDebugState(debugStateValues.DEBUG_NONE); }
public void setPusher(boolean on) { if (on) { pusher.set(Value.kForward); } else { pusher.set(Value.kReverse); } }
@Override protected void initialize() { if (RobotMap.pneumaticsDoubleSolenoidUpperClamp.get() == Value.kReverse) { RobotMap.pneumaticsDoubleSolenoidUpperClamp.set( DoubleSolenoid.Value.kForward ); } else { RobotMap.pneumaticsDoubleSolenoidUpperClamp.set( DoubleSolenoid.Value.kReverse ); } }
protected void checkState() { if ( solenoid.get() == Value.kForward ) { direction = Direction.EXTENDING; } else if ( solenoid.get() == Value.kReverse ) { direction = Direction.RETRACTING; } else { direction = Direction.STOPPED; } }
@Override public HardwareDoubleSolenoid extend() { solenoid.set(Value.kForward); direction = Direction.EXTENDING; checkState(); return this; }
@Override public HardwareDoubleSolenoid retract() { solenoid.set(Value.kReverse); direction = Direction.RETRACTING; checkState(); return this; }
@Override public void teleop() { boolean lifting = false; RobotOperation.driveDoubleStickArcade(0); //Change this when switching drive mode if(Gamepad.secondaryGamepad.getA()) { solenoid.set(Value.kForward); } else { solenoid.set(Value.kReverse); } if(Gamepad.secondaryGamepad.getB()) { lifting = !lifting; } if(lifting && Math.abs(liftEncoder.getRaw()) < 2) { liftMotor.set(0.5); liftMotor2.set(0.5); } if(lifting && Math.abs(liftEncoder.getRaw()) > 2) { liftMotor.set(0); liftMotor2.set(0); lifting = false; } if(!lifting) { liftMotor.set(0); liftMotor2.set(0); } Logger.riolog("" + liftEncoder.getRaw()); }
public void gearManipulatorDown() { manipulatorSolenoid.set(DoubleSolenoid.Value.kForward); }
public void gearManipulatorUp() { manipulatorSolenoid.set(DoubleSolenoid.Value.kReverse); }
public void irSensorRaise() { if (IrSensor.getVoltage() <= 2) { manipulatorSolenoid.set(DoubleSolenoid.Value.kReverse); manipulatorMotor.set(0.0); } }
public void onStart() { solenoid.set(on ? Value.kForward : Value.kReverse); }
protected void onCompletion() { solenoid.set(Value.kOff); }
@Override public void robotInit() { chooser = new SendableChooser<Integer>(); chooser.addDefault("center red", 1); chooser.addObject("center blue", 2); chooser.addObject("boiler red", 3); chooser.addObject("boiler blue", 4); chooser.addObject("ret red", 5); chooser.addObject("ret blue", 6); chooser.addObject("current test", 7); SmartDashboard.putData("Auto choices", chooser); //NETWORK TABLE VARIABLES table = NetworkTable.getTable("dataTable"); //POWER DIST PANEL pdp = new PowerDistributionPanel(); //NAVX navx = new AHRS(SPI.Port.kMXP); // CONTROLLER jsLeft = new Joystick(0); jsRight = new Joystick(1); xbox = new XboxController(5); // MOTORS leftFront = new Talon(pwm5); leftMid = new Talon(pwm3); leftBack = new Talon(pwm1); rightFront = new Talon(pwm4); rightMid = new Talon(pwm2); rightBack = new Talon(pwm0); // ENCODERS encLeftDrive = new Encoder(0,1); encRightDrive = new Encoder(2,3); // COMPRESSOR compressor = new Compressor(); compressor.start(); //SOLENOIDs driveChain = new DoubleSolenoid(0,1); driveChain.set(Value.kReverse); presser = new DoubleSolenoid(2,3); presser.set(Value.kReverse); gearpiston = new DoubleSolenoid(4,5); gearpiston.set(Value.kReverse); //CANTALONS climber = new CANTalon(2); shooter = new CANTalon(4); intake = new CANTalon(9); feeder = new CANTalon(13); // CAMERA //DON'T DELETE THE COMMENTED THREAD-IT IS USED FOR CALIBRATION /* UsbCamera usbCam = new UsbCamera("mscam", 0); usbCam.setVideoMode(VideoMode.PixelFormat.kMJPEG, 160, 120, 20); MjpegServer server1 = new MjpegServer("cam1", 1181); server1.setSource(usbCam); */ UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(); camera.setVideoMode(VideoMode.PixelFormat.kMJPEG, 160, 120, 20); //SMARTDASBOARD driveSetting = "LOW START"; gearSetting = "GEAR CLOSE START"; }
public void closeArm() { openClose.set(Value.kForward); System.out.println("close arm"); }
public void openArm() { openClose.set(Value.kReverse); RobotMap.ArmDownTime = new Date(); }
public void lowerArm() { upDown.set(Value.kReverse); System.out.println("lowering arm"); }
public void raiseArm() { upDown.set(Value.kForward); System.out.println("raising arm"); }
/** * constructor * @param f true = falpperDown;//flase = flapperUP */ public FlapperControl(boolean f) { requires(Robot.flapper); val = f ? Value.kForward : Value.kReverse; }
/** * Constructor. * @param f true=gate up, false=gate down */ public GateControl(boolean f) { requires(Robot.gate); val = f ? Value.kReverse : Value.kForward; }
@Override protected void initialize(){ ballShooter.switchPos(Value.kReverse); }
@Override protected void initialize(){ ballShooter.switchPos(Value.kForward); }
public void switchPos(DoubleSolenoid.Value value){ solenoid.set(value); }
public Gate() { solenoid = new DoubleSolenoid(RobotMap.GATE_FORWARD_CHANNEL, RobotMap.GATE_REVERSE_CHANNEL); solenoid.set(Value.kReverse); }
public void switchPos(DoubleSolenoid.Value val) { solenoid.set(val); }