本文整理汇总了Java中edu.wpi.first.wpilibj.Relay.set方法的典型用法代码示例。如果您正苦于以下问题:Java Relay.set方法的具体用法?Java Relay.set怎么用?Java Relay.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.Relay
的用法示例。
在下文中一共展示了Relay.set方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
auto = new Autonomous(MechanismPack.getInstance());
teleop = new Teleop(ControlPack.getInstance(),
MechanismPack.getInstance(),
SensorPack.getInstance());
compressor = new Compressor(Channels.COMPRESSOR_PRESSURE_SWITCH_CHANNEL, Channels.COMPRESSOR_RELAY_CHANNEL);
compressor.start();
SensorPack.getInstance().getGyro().reset();
swagLights = new Relay(Channels.SWAG_LIGHT_PORT);
swagLights.set(Relay.Value.kOn);//TODO: NEEDED?
System.out.println("Robot initilization complete.");
}
示例2: VisionTest
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public VisionTest() {
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(); // cam0 by default
camera.setResolution(IMG_WIDTH, IMG_HEIGHT);
camera.setBrightness(0);
// camera.setExposureManual(100);
camera.setExposureAuto();
CvSource cs= CameraServer.getInstance().putVideo("name", IMG_WIDTH, IMG_HEIGHT);
visionThread = new VisionThread(camera, new GripPipeline(), pipeline -> {
Mat IMG_MOD = pipeline.hslThresholdOutput();
if (!pipeline.filterContoursOutput().isEmpty()) {
//Rect recCombine = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
Rect recCombine = computeBoundingRectangle(pipeline.filterContoursOutput());
if (recCombine == null) {
targetDetected = false;
return;
}
targetDetected = true;
computeCoords(recCombine);
synchronized (imgLock) {
centerX = recCombine.x + (recCombine.width / 2);
}
Imgproc.rectangle(IMG_MOD, new Point(recCombine.x, recCombine.y),new Point(recCombine.x + recCombine.width,recCombine.y + recCombine.height), new Scalar(255, 20, 0), 5);
} else {
targetDetected = false;
}
cs.putFrame(IMG_MOD);
});
visionThread.start();
Relay relay = new Relay(RobotMap.RELAY_CHANNEL, Direction.kForward);
relay.set(Relay.Value.kOn);
//this.processImage();
}
示例3: robotInit
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
chooser = new SendableChooser();
chooser.addDefault("Default Auto", defaultAuto);
chooser.addObject("My Auto", customAuto);
SmartDashboard.putData("Auto choices", chooser);
// create and reset relay
myRelay = new Relay(RELAY_CHANNEL,Relay.Direction.kForward);
myRelay.set(Relay.Value.kOff);
}
示例4: initialize
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public static void initialize() {
if (initialized)
return;
// reset trigger init time
initTriggerTime = Utility.getFPGATime();
// create and reset collector relay
collectorSolenoid = new Spark(HardwareIDs.COLLECTOR_SOLENOID_PWM_ID);
// create and reset gear tray spark & relay
gearTrayRelay = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_1,Relay.Direction.kForward);
gearTrayRelay.set(Relay.Value.kOff);
gearTrayRelay2 = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_2,Relay.Direction.kForward);
gearTrayRelay2.set(Relay.Value.kOff);
// create motors & servos
transportMotor = new Spark(HardwareIDs.TRANSPORT_PWM_ID);
collectorMotor = new CANTalon(HardwareIDs.COLLECTOR_TALON_ID);
agitatorServo = new Spark(HardwareIDs.AGITATOR_PWM_ID); // continuous servo control modeled as Spark PWM
feederMotor = new CANTalon(HardwareIDs.FEEDER_TALON_ID);
shooterMotor = new CANTalon(HardwareIDs.SHOOTER_TALON_ID);
// set up shooter motor sensor
shooterMotor.reverseSensor(false);
shooterMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
// FOR REFERENCE ONLY:
//shooterMotor.configEncoderCodesPerRev(12); // use this ONLY if you are NOT reading Native units
// USE FOR DEBUG ONLY: configure shooter motor for open loop speed control
//shooterMotor.changeControlMode(TalonControlMode.PercentVbus);
// configure shooter motor for closed loop speed control
shooterMotor.changeControlMode(TalonControlMode.Speed);
shooterMotor.configNominalOutputVoltage(+0.0f, -0.0f);
shooterMotor.configPeakOutputVoltage(+12.0f, -12.0f);
// set PID(F) for shooter motor (one profile only)
shooterMotor.setProfile(0);
shooterMotor.setP(3.45);
shooterMotor.setI(0);
shooterMotor.setD(0.5);
shooterMotor.setF(9.175);
// make sure all motors are off
resetMotors();
gamepad = new Joystick(HardwareIDs.GAMEPAD_ID);
initialized = true;
}
示例5: initialize
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public static void initialize() {
if (initialized)
return;
// reset trigger init time
initTriggerTime = Utility.getFPGATime();
cameraLedRelay = new Relay(HardwareIDs.CAMERA_LED_RELAY_CHANNEL,Relay.Direction.kForward);
cameraLedRelay.set(Relay.Value.kOff);
positionServo = new Servo(HardwareIDs.CAMERA_SERVO_PWM_ID);
gamepad = new Joystick(HardwareIDs.DRIVER_CONTROL_ID);
ledState = false;
initialized = true;
}
示例6: initialize
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public static void initialize() {
if (initialized)
return;
// reset trigger init time
initTriggerTime = Utility.getFPGATime();
// create and reset collector relay
collectorSolenoid = new Spark(HardwareIDs.COLLECTOR_SOLENOID_PWM_ID);
// create and reset gear tray spark & relay
gearTrayRelay = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_1,Relay.Direction.kForward);
gearTrayRelay.set(Relay.Value.kOff);
gearTrayRelay2 = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_2,Relay.Direction.kForward);
gearTrayRelay2.set(Relay.Value.kOff);
// create motors & servos
transportMotor = new Spark(HardwareIDs.TRANSPORT_PWM_ID);
collectorMotor = new CANTalon(HardwareIDs.COLLECTOR_TALON_ID);
agitatorServo = new Spark(HardwareIDs.AGITATOR_PWM_ID); // continuous servo control modeled as Spark PWM
feederMotor = new CANTalon(HardwareIDs.FEEDER_TALON_ID);
shooterMotor = new CANTalon(HardwareIDs.SHOOTER_TALON_ID);
// set up shooter motor sensor
shooterMotor.reverseSensor(false);
shooterMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
// FOR REFERENCE ONLY:
//shooterMotor.configEncoderCodesPerRev(12); // use this ONLY if you are NOT reading Native units
// USE FOR DEBUG ONLY: configure shooter motor for open loop speed control
//shooterMotor.changeControlMode(TalonControlMode.PercentVbus);
// configure shooter motor for closed loop speed control
shooterMotor.changeControlMode(TalonControlMode.Speed);
shooterMotor.configNominalOutputVoltage(+0.0f, -0.0f);
shooterMotor.configPeakOutputVoltage(+12.0f, -12.0f);
// set PID(F) for shooter motor (one profile only)
shooterMotor.setProfile(0);
shooterMotor.setP(P_COEFF);
shooterMotor.setI(I_COEFF);
shooterMotor.setD(D_COEFF);
shooterMotor.setF(F_COEFF);
// make sure all motors are off
resetMotors();
gamepad = new Joystick(HardwareIDs.GAMEPAD_ID);
initialized = true;
}
示例7: init
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public void init() {
readSettingsFromPreferences();
lightRing = new Relay(0);
lightRing.set(Relay.Value.kForward);
}
示例8: LaunchSpike
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public LaunchSpike() {
super();
launcher = new Relay(RobotMap.LAUNCH_SOLENOID);
launcher.set(Relay.Value.kOff);
}
示例9: ControlExtendPiston
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public void ControlExtendPiston(Relay piston) {
piston.set(Relay.Value.kForward);
}
示例10: ControlRetractPiston
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public void ControlRetractPiston(Relay piston) {
piston.set(Relay.Value.kReverse);
}
示例11: Compressor
import edu.wpi.first.wpilibj.Relay; //导入方法依赖的package包/类
public Compressor(int spikeChannel) {
spike = new Relay(spikeChannel);
spike.set(Relay.Value.kOff);
limit = PressureLimitSwitch.getInstance();
limit.init(HardwareDefines.PRESSURE_LIMIT_SWITCH_CHANNEL);
}