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


Java Relay.set方法代碼示例

本文整理匯總了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.");
    
    
}
 
開發者ID:FRC-Team-2403,項目名稱:2014-robot,代碼行數:22,代碼來源:RichardSimmons.java

示例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();
	}
 
開發者ID:cyborgs3335,項目名稱:STEAMworks,代碼行數:39,代碼來源:VisionTest.java

示例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);
}
 
開發者ID:MTHSRoboticsClub,項目名稱:FRC-2017,代碼行數:15,代碼來源:Robot.java

示例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;
}
 
開發者ID:MTHSRoboticsClub,項目名稱:FRC-2017,代碼行數:55,代碼來源:BallManagement.java

示例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;
}
 
開發者ID:MTHSRoboticsClub,項目名稱:FRC-2017,代碼行數:19,代碼來源:CameraControl.java

示例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;
}
 
開發者ID:MTHSRoboticsClub,項目名稱:FRC-2017,代碼行數:55,代碼來源:BallManagement.java

示例7: init

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public void init() {
	readSettingsFromPreferences();
	lightRing = new Relay(0);
	lightRing.set(Relay.Value.kForward);
}
 
開發者ID:firebears-frc,項目名稱:FB2016,代碼行數:6,代碼來源:Vision.java

示例8: LaunchSpike

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public LaunchSpike() {
    super();
    launcher = new Relay(RobotMap.LAUNCH_SOLENOID);
    launcher.set(Relay.Value.kOff);
}
 
開發者ID:owatonnarobotics,項目名稱:2014RobotCode,代碼行數:6,代碼來源:LaunchSpike.java

示例9: ControlExtendPiston

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public void ControlExtendPiston(Relay piston) {
	piston.set(Relay.Value.kForward);
}
 
開發者ID:Team4777,項目名稱:FRC-2015,代碼行數:4,代碼來源:PneumaticsClass.java

示例10: ControlRetractPiston

import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public void ControlRetractPiston(Relay piston) {
	piston.set(Relay.Value.kReverse);
}
 
開發者ID:Team4777,項目名稱:FRC-2015,代碼行數:4,代碼來源:PneumaticsClass.java

示例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);
}
 
開發者ID:alexbrinister,項目名稱:Nashoba-Robotics2014,代碼行數:7,代碼來源:Compressor.java


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