當前位置: 首頁>>代碼示例>>Java>>正文


Java Relay.Value方法代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.Relay.Value方法的典型用法代碼示例。如果您正苦於以下問題:Java Relay.Value方法的具體用法?Java Relay.Value怎麽用?Java Relay.Value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.wpi.first.wpilibj.Relay的用法示例。


在下文中一共展示了Relay.Value方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: tick

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
@Override
public void tick() {
	double horizontalRotationDegrees = (double) this.getDataKey(CameraSubsystemDataKey.HORIZONTAL_ROTATION_DEGREES);
	double verticalRotationDegrees = (double) this.getDataKey(CameraSubsystemDataKey.VERTICAL_ROTATION_DEGREES);
	
	double horizontalValue = WarriorMath.map(horizontalDegrees[1], horizontalDegrees[0], horizontalRotationDegrees, 0.0, 1.0);
	double verticalValue = WarriorMath.map(verticalDegrees[1], verticalDegrees[0], verticalRotationDegrees, 0.0, 1.0);
	
	Relay.Value lightsValue = null;
	
	if((boolean) this.getDataKey(CameraSubsystemDataKey.LIGHTS) == true) {
		lightsValue = Relay.Value.kOn;
	} else {
		lightsValue = Relay.Value.kOff;
	}
	
	this._horizontal.set(horizontalValue);
	this._vertical.set(verticalValue);
	this._lights.set(lightsValue);
}
 
開發者ID:frc2503,項目名稱:r2016,代碼行數:21,代碼來源:CameraSubsystem.java

示例2: setForward

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
 * Set the state of the forward channel.
 * The innermost pin (A) on the Relay connector is "forward".
 * This method will not affect the state of the reverse channel.
 * 
 * @param val true if on, false if off
 */
public void setForward(boolean fwdVal) {
	Relay.Value currentValue = this.get(),
			    newValue = currentValue;
	
	if(currentValue == Relay.Value.kForward) {
		if(!fwdVal)
			newValue = Relay.Value.kOff;
	} else if(currentValue == Relay.Value.kOff) {
		if(fwdVal)
			newValue = Relay.Value.kForward;
	} else if(currentValue == Relay.Value.kOn) {
		if(!fwdVal)
			newValue = Relay.Value.kReverse;
	} else if(currentValue == Relay.Value.kReverse) {
		if(fwdVal)
			newValue = Relay.Value.kOn;
	}
	
	this.set(newValue);
}
 
開發者ID:Team2168,項目名稱:2014_Main_Robot,代碼行數:28,代碼來源:BitRelay.java

示例3: setReverse

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
 * Set the state of the reverse channel.
 * The center pin (B) on the Relay connector is "reverse".
 * This method will not affect the state of the forward channel.
 * 
 * @param val true if on, false if off
 */
public void setReverse(boolean revVal) {
	Relay.Value currentValue = this.get(),
		    newValue = currentValue;

if(currentValue == Relay.Value.kForward) {
	if(revVal)
		newValue = Relay.Value.kOn;
} else if(currentValue == Relay.Value.kOff) {
	if(revVal)
		newValue = Relay.Value.kReverse;
} else if(currentValue == Relay.Value.kOn) {
	if(!revVal)
		newValue = Relay.Value.kForward;
} else if(currentValue == Relay.Value.kReverse) {
	if(!revVal)
		newValue = Relay.Value.kOff;
}

this.set(newValue);
}
 
開發者ID:Team2168,項目名稱:2014_Main_Robot,代碼行數:28,代碼來源:BitRelay.java

示例4: set

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public void set(boolean pRelayState) {
    boolean leftRelayState;
    boolean rightRelayState;
    Relay.Value currentValue = relay.get();

    /* Get left and right relay states */
    if (relaySide == LEFT_RELAY) {
        leftRelayState = pRelayState;
        rightRelayState = (currentValue.equals(Relay.Value.kOn) || currentValue.equals(Relay.Value.kReverse));
    }
    else {
        leftRelayState = (currentValue.equals(Relay.Value.kOn) || currentValue.equals(Relay.Value.kForward));
        rightRelayState = pRelayState;
    }

    /* Set relay to left and right relay states */
    if (leftRelayState) {
        if (rightRelayState) {
            relay.set(Relay.Value.kOn);
        }
        else {
            relay.set(Relay.Value.kForward);
        }
    }
    else if (rightRelayState) {
        relay.set(Relay.Value.kReverse);
    }
    else {
        relay.set(Relay.Value.kOff);
    }
}
 
開發者ID:TaylorRobotics,項目名稱:TitanRobot2014,代碼行數:32,代碼來源:SimpleRelay.java

示例5: get

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public Relay.Value get() {
	return relay.get();
}
 
開發者ID:FRC4131,項目名稱:FRCStronghold2016,代碼行數:4,代碼來源:RangeFlap.java

示例6: setRelayValues

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
 * @param set
 *            relay values
 */
public void setRelayValues(Relay.Value relayOne, Relay.Value relayTwo) {
	this.relayOne.set(relayOne);
	this.relayTwo.set(relayTwo);
}
 
開發者ID:Impact2585,項目名稱:aerbot-champs,代碼行數:9,代碼來源:DoubleSolenoid.java

示例7: intakeLiftState

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public Relay.Value intakeLiftState(){
	return intakeLift.get();
}
 
開發者ID:Impact2585,項目名稱:aerbot-champs,代碼行數:4,代碼來源:IntakeSystem.java

示例8: getPosition

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
 * This method no matter what state the switch is in, and uses the values found
 * in the
 * WPI Relay class' enum "Value" for compatibility. If the state of the first
 * port
 * the switch is plugged into is "on," and the state of the second port the
 * switch is
 * plugged into is "off," the method returns the "kForward". If the reverse is
 * true,
 * the method returns "kReverse". If both are off (the switch is in its center
 * position), the method return "kOff". This does not make use of the
 * Relay.Value.kOn
 * value.
 * 
 * @return The state of the switch. Either "kForward", "kReverse", or "kOff".
 * @author Alex Kneipp
 * @written Jan 18, 2016
 */
public Relay.Value getPosition ()
{
    if (switch1.isOn())
        return Relay.Value.kForward;
    else if (switch2.isOn())
        return Relay.Value.kReverse;
    else
        return Relay.Value.kOff;
}
 
開發者ID:FIRST-Team-339,項目名稱:2017,代碼行數:28,代碼來源:DoubleThrowSwitch.java

示例9: setRelayValues

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
 * set relay values
 * @param relayOne the value to set the first relay to
 * @param relayTwo the value to set the second relay to
 */
public void setRelayValues(Relay.Value relayOne, Relay.Value relayTwo) {
	this.relayOne.set(relayOne);
	this.relayTwo.set(relayTwo);
}
 
開發者ID:Impact2585,項目名稱:Lib2585,代碼行數:10,代碼來源:DoubleSolenoid.java


注:本文中的edu.wpi.first.wpilibj.Relay.Value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。