当前位置: 首页>>代码示例>>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;未经允许,请勿转载。