Java 类edu.wpi.first.wpilibj.DoubleSolenoid.Value 实例源码

项目:r2016    文件:PortcullisLiftSubsystem.java   
@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;
    }
}
项目:Robot_2015    文件:ToggleIngestors.java   
@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);
    }
}
项目:NR-2014-CMD    文件:Puncher.java   
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);
}
项目:frc-2017    文件:GearManipulator.java   
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);
    }

}
项目:2017    文件:Transmission.java   
/**
 * 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;
            }

        }
}
项目:2017-Robot    文件:Robot.java   
@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); 
}
项目:Steamwork_2017    文件:Robot.java   
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:
    }
}
项目:Steamwork_2017    文件:Robot.java   
public void gearBox() {
    if (stick.getRawButton(5)) {
        gearBox.set(Value.kReverse);
    }
    if (stick.getRawButton(6)) {
        gearBox.set(Value.kForward);
    }
}
项目:STEAMworks    文件:Dumper.java   
public void switchPos() {
    switch (solenoid.get()) {
        case kOff: case kReverse:
            solenoid.set(Value.kForward);
            break;
        case kForward:
            solenoid.set(Value.kReverse);
            break;
    }
}
项目:frc-2016    文件:AManipulators.java   
public void toggleAManipulators() {
    Value solenoidVal = aManipulatorSolenoid.get();
    if (solenoidVal == Value.kReverse) {
        aManipulatorSolenoid.set(DoubleSolenoid.Value.kForward);
    } else {
        aManipulatorSolenoid.set(DoubleSolenoid.Value.kReverse);
    }
}
项目:frc-2016    文件:Intake.java   
public void toggleIntakeSolenoid() {
    Value SolenoidVal = Actuator.get();
    if (SolenoidVal == Value.kForward) {
        lowerRake();
    } else {
        raiseRake();

    }
}
项目:2017-code    文件:BallDoor.java   
@Override
public void run() {
    if(xbox.getStart()){
        solenoid.set(Value.kForward);
    }else{
        solenoid.set(Value.kReverse);
    }
}
项目:2017-code    文件:BallDoor.java   
@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);
    }
}
项目:2017-code    文件:GearManipulator.java   
@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;
    }
}
项目:2017-code    文件:GearManipulator.java   
@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);
    }
}
项目:2016    文件:Autonomous.java   
/**
 * 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);
}
项目:2016    文件:Transmission.java   
/**
 * 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;
            }

        }
}
项目:Stronghold-2016    文件:FlyWheels.java   
public void setPusher(boolean on) {
    if (on) {
        pusher.set(Value.kForward);
    } else {
        pusher.set(Value.kReverse);
    }
}
项目:Robot_2015    文件:ToggleUpperClamp.java   
@Override
protected void initialize() 
{
    if (RobotMap.pneumaticsDoubleSolenoidUpperClamp.get() == Value.kReverse) 
    {
        RobotMap.pneumaticsDoubleSolenoidUpperClamp.set( DoubleSolenoid.Value.kForward );
    } 
    else 
    {
        RobotMap.pneumaticsDoubleSolenoidUpperClamp.set( DoubleSolenoid.Value.kReverse );
    }
}
项目:strongback-java    文件:HardwareDoubleSolenoid.java   
protected void checkState() {
    if ( solenoid.get() == Value.kForward ) {
        direction = Direction.EXTENDING;
    } else if ( solenoid.get() == Value.kReverse ) {
        direction = Direction.RETRACTING;
    } else {
        direction = Direction.STOPPED;
    }
}
项目:strongback-java    文件:HardwareDoubleSolenoid.java   
@Override
public HardwareDoubleSolenoid extend() {
    solenoid.set(Value.kForward);
    direction = Direction.EXTENDING;
    checkState();
    return this;
}
项目:strongback-java    文件:HardwareDoubleSolenoid.java   
@Override
public HardwareDoubleSolenoid retract() {
    solenoid.set(Value.kReverse);
    direction = Direction.RETRACTING;
    checkState();
    return this;
}
项目:FRC-2015-Robot-Java    文件:RobotHardwareWoodbot.java   
@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());
}
项目:frc-2017    文件:GearManipulator.java   
public void gearManipulatorDown() {
    manipulatorSolenoid.set(DoubleSolenoid.Value.kForward);
}
项目:frc-2017    文件:GearManipulator.java   
public void gearManipulatorUp() {
    manipulatorSolenoid.set(DoubleSolenoid.Value.kReverse);
}
项目:frc-2017    文件:GearManipulator.java   
public void irSensorRaise() {
    if (IrSensor.getVoltage() <= 2) {
        manipulatorSolenoid.set(DoubleSolenoid.Value.kReverse);
        manipulatorMotor.set(0.0);
    }
}
项目:FRC-5800-Stronghold    文件:CommandDoubleSolenoid.java   
public void onStart() {
    solenoid.set(on ? Value.kForward : Value.kReverse);
}
项目:FRC-5800-Stronghold    文件:CommandDoubleSolenoid.java   
protected void onCompletion() {
    solenoid.set(Value.kOff);
}
项目:2017-Robot    文件:Robot.java   
@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";
}
项目:steamworks-java    文件:Arm.java   
public void closeArm() {
    openClose.set(Value.kForward);      
    System.out.println("close arm");
}
项目:steamworks-java    文件:Arm.java   
public void openArm() {
    openClose.set(Value.kReverse);
    RobotMap.ArmDownTime = new Date();
}
项目:steamworks-java    文件:Arm.java   
public void lowerArm() {
    upDown.set(Value.kReverse);
    System.out.println("lowering arm");

}
项目:steamworks-java    文件:Arm.java   
public void raiseArm() {
    upDown.set(Value.kForward);    
    System.out.println("raising arm");

}
项目:STEAMworks    文件:FlapperControl.java   
/**
 * constructor
 * @param f true = falpperDown;//flase = flapperUP
 */
public FlapperControl(boolean f) {
       requires(Robot.flapper);
       val = f ? Value.kForward : Value.kReverse;
   }
项目:STEAMworks    文件:GateControl.java   
/**
 * Constructor.
 * @param f true=gate up, false=gate down
 */
public GateControl(boolean f) {
       requires(Robot.gate);
       val = f ? Value.kReverse : Value.kForward;
   }
项目:STEAMworks    文件:ShooterShiftLow.java   
@Override
protected void initialize(){
    ballShooter.switchPos(Value.kReverse);
}
项目:STEAMworks    文件:ShooterShiftHigh.java   
@Override
protected void initialize(){
    ballShooter.switchPos(Value.kForward);
}
项目:STEAMworks    文件:BallShooter.java   
public void switchPos(DoubleSolenoid.Value value){
    solenoid.set(value);
}
项目:STEAMworks    文件:Gate.java   
public Gate() {
    solenoid = new DoubleSolenoid(RobotMap.GATE_FORWARD_CHANNEL, RobotMap.GATE_REVERSE_CHANNEL);
    solenoid.set(Value.kReverse);
}
项目:STEAMworks    文件:Gate.java   
public void switchPos(DoubleSolenoid.Value val) {
solenoid.set(val);
  }