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

项目:snobot-2017    文件:RelayWrapper.java   
public Value get()
{

    if (forwards && !reverse)
    {
        return Value.kForward;
    }
    else if (!forwards && reverse)
    {
        return Value.kReverse;
    }
    else if (forwards && reverse)
    {
        return Value.kOn;
    }
    else
    {
        return Value.kOff;
    }
}
项目:aerbot-junit    文件:DoubleSolenoidTest.java   
@Test
public void test() {

    // pretext
    Assert.assertEquals(doubleSolenoide.isDefaultState(), true);

    // test toggle
    doubleSolenoide.toggle();
    Assert.assertEquals(relay1, Relay.Value.kForward);
    Assert.assertEquals(relay2, Relay.Value.kOff);

    doubleSolenoide.toggle();
    Assert.assertEquals(relay1, Relay.Value.kOff);
    Assert.assertEquals(relay2, Relay.Value.kForward);

}
项目:snobot-2017    文件:Snobot.java   
public void autonomousPeriodic()
{
    if (mTimer.get() < 2)
    {
        mRelay.set(Value.kForward);
    }
    else if (mTimer.get() < 4)
    {
        mRelay.set(Value.kReverse);
    }
    else
    {
        mRelay.set(Value.kOn);
    }
}
项目:FRCStronghold2016    文件:AimingFlashlight.java   
public void toggle() {
    if (isOn) {
        isOn = false;
        light.set(Value.kOff);
    } else {
        isOn = true;
        light.set(Value.kForward);
    }
}
项目:Frc2017FirstSteamWorks    文件:Robot.java   
public void setVisionEnabled(boolean enabled)
{
    if (gripVision != null)
    {
        ringLightsPower.set(enabled? Value.kOn: Value.kOff);
        gripVision.setVideoOutEnabled(enabled);
        gripVision.setEnabled(enabled);
        tracer.traceInfo("Vision", "Grip Vision is %s!", enabled? "enabled": "disabled");
    }
    else if (faceDetector != null)
    {
        faceDetector.setVideoOutEnabled(enabled);
        faceDetector.setEnabled(enabled);
        tracer.traceInfo("Vision", "Face Detector is %s!", enabled? "enabled": "disabled");
    }
    else
    {
        ringLightsPower.set(enabled? Value.kOn: Value.kOff);

        if (frontPixy != null)
        {
            frontPixy.setEnabled(enabled);
            tracer.traceInfo("Vision", "Front pixy is %s!", enabled? "enabled": "disabled");
        }

        if (rearPixy != null)
        {
            rearPixy.setEnabled(enabled);
            tracer.traceInfo("Vision", "Rear pixy is %s!", enabled? "enabled": "disabled");
        }
    }
}
项目:strongback-java    文件:HardwareRelay.java   
@Override
public State state() {
    Value value = relay.get();
    if (value == Value.kForward || value == Value.kOn) return State.ON;
    if (value == Value.kReverse || value == Value.kOff) return State.OFF;
    return State.UNKOWN;
}
项目:2013_drivebase_proto    文件:WsRelay.java   
public void set(IOutputEnum key, Object value)
{
    if(value instanceof Value)
    {
        relay.set((Value) value);
    }
}
项目:2014_software    文件:WsRelay.java   
public void set(IOutputEnum key, Object value)
{
    if(value instanceof Value)
    {
        relay.set((Value) value);
    }
}
项目:2013_robot_software    文件:WsRelay.java   
public void set(IOutputEnum key, Object value)
{
    if(value instanceof Value)
    {
        relay.set((Value) value);
    }
}
项目:2017    文件:Autonomous.java   
private static boolean baselinePath ()
{
    System.out.println("Current State = " + currentState);
    System.out.println("Encoder Val: "
            + Hardware.autoDrive.getAveragedEncoderValues());
    // System.out.println("Delayval: " + delayBeforeAuto);
    // System.out.println("Timer val: " + Hardware.autoStateTimer.get());
    switch (currentState)
        {
        case INIT:

            Hardware.leftRearMotor.set(0);
            Hardware.leftFrontMotor.set(0);
            Hardware.rightRearMotor.set(0);
            Hardware.rightFrontMotor.set(0);
            Hardware.gearIntake.stopIntakeWheels();
            Hardware.autoStateTimer.reset();
            Hardware.autoStateTimer.start();
            initializeDriveProgram();
            // Hardware.ringlightRelay.set(Value.kOn);
            Hardware.autoStateTimer.start();
            currentState = MainState.DELAY_BEFORE_START;
            break;
        case DELAY_BEFORE_START:
            // stop all the motors to feed the watchdog
            Hardware.leftRearMotor.set(0);
            Hardware.leftFrontMotor.set(0);
            Hardware.rightRearMotor.set(0);
            Hardware.rightFrontMotor.set(0);
            Hardware.gearIntake.raiseArm();
            // wait for timer to run out
            if (Hardware.autoStateTimer.get() >= delayBeforeAuto)
                {
                // Hardware.axisCamera.saveImagesSafely();
                // currentState = MainState.ACCELERATE;
                currentState = MainState.DRIVE_FORWARD_TO_CENTER;
                Hardware.autoStateTimer.reset();
                Hardware.autoStateTimer.start();
                }
            break;
        case DRIVE_FORWARD_TO_CENTER:
            // baseline is 94 inches from wall, so drive a little bit further
            if (onNewDrive == false)
                {
                if (Hardware.autoDrive.driveInches(115,
                        DRIVE_SPEED) == true)
                    {
                    currentState = MainState.DONE;
                    }
                }
            else
                {
                if (Hardware.newDrive.driveStraightInches(115,
                        DRIVE_SPEED) == true)
                    {
                    currentState = MainState.DONE;
                    }
                }
            break;
        default:
        case DONE:
            Hardware.autoDrive.drive(0, 0, 0);
            Hardware.ringlightRelay.set(Value.kOff);
            return true;
        }
    return false;
}
项目:Robot_2017    文件:DefaultRelay.java   
protected void execute() {
    RobotMap.lightsLightEnable.set(Value.kOn);
    RobotMap.lightsLightEnable.set(Value.kForward);
}
项目:Practice_Robot_Code    文件:DefaultRelay.java   
protected void execute() {
    RobotMap.motorRelayMotorRelay1.set(Value.kOff);
}
项目:snobot-2017    文件:RelayGraphicDisplay.java   
public RelayDisplay()
{
    setPreferredSize(new Dimension(sWIDTH, sHEIGHT));
    mValue = Value.kOff;
}
项目:snobot-2017    文件:RelayGraphicDisplay.java   
public void updateDisplay(Value value)
{
    mValue = value;
}
项目:r2016    文件:IntakeSubsystem.java   
@Override
public void tick() {
    IntakeSubsystemMode mode = (IntakeSubsystemMode) this.getMode();

    if(mode != null) {
        switch(mode) {
        case INTAKING:
            if(this.canIntake()) {
                System.out.println("Trying to intake, and all is good.");
                this.set(1.0d);
            } else {
                System.out.println("Trying to intake, but the thing is a thing and that is bad.");
                this.set(0.0d);
            }

            break;

        case OUTPUTTING:
            this.set(-1.0d);
            break;

        case FIRING:
            this.set(1.0d);
            break;

        case DISABLED:
            this.stopMotor();
            break;

        case STOPPED:
        default:
            this.set(0.0d);
            break;
        }
    } else {
        this.set(0.0d);
    }

    if(this._limitSwitch.isTripped()) {
        this._indicatorRelay.set(Value.kOn);
    } else {
        this._indicatorRelay.set(Value.kOff);
    }
}
项目:FRCStronghold2016    文件:AimingFlashlight.java   
public boolean get(){
    return !light.get().equals(Value.kOff);
}
项目:strongback-java    文件:HardwareRelay.java   
@Override
public HardwareRelay on() {
    relay.set(Value.kForward);
    return this;
}
项目:strongback-java    文件:HardwareRelay.java   
@Override
public HardwareRelay off() {
    relay.set(Value.kOff);
    return this;
}
项目:RobotCode2014    文件:ShooterSubsystem.java   
public void startCompressor() {
    compressor.setRelayValue(Value.kForward);
}
项目:RobotCode2014    文件:ShooterSubsystem.java   
public void stopCompressor() {
    compressor.setRelayValue(Value.kOff);
}
项目:aerbot-junit    文件:DoubleSolenoidTest.java   
@Override
public void setRelayValues(Value relayOne, Value relayTwo) {
    relay1 = relayOne;
    relay2 = relayTwo;
}
项目:aerbot-junit    文件:IntakeTest.java   
@Override
public Value intakeLiftState() {
    return intakeOpen ? Relay.Value.kForward : Relay.Value.kReverse;
}
项目:RobotCode2013    文件:Storage.java   
/**
 * Forcefully turns the compressor on
 */
public void turnCompressorOn() {
    compressor.setRelayValue(Value.kForward);
    secondaryCompressionSystem.setRelayValue(Value.kForward);
}
项目:RobotCode2013    文件:Storage.java   
/**
 * Forcefully turns the compressor off
 */
public void turnCompressorOff() {
    compressor.setRelayValue(Value.kOff);
    secondaryCompressionSystem.setRelayValue(Value.kOff);
}