本文整理汇总了Java中edu.wpi.first.wpilibj.Solenoid.set方法的典型用法代码示例。如果您正苦于以下问题:Java Solenoid.set方法的具体用法?Java Solenoid.set怎么用?Java Solenoid.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.Solenoid
的用法示例。
在下文中一共展示了Solenoid.set方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
/**
* Called when the robot first starts, (only once at power-up).
*/
public void robotInit() {
//NetworkTable.setTeam(1259); adding the setTeam() method will cause the robot to encounter a thread error
//NetworkTable.setIPAddress("10.12.59.2");
operatorInputs = new OperatorInputs();
drive = new DriveTrain(operatorInputs);
prefs = Preferences.getInstance();
pickerPID = new PickerPID();
shoot = new Shooter(operatorInputs);
pick = new Picker(operatorInputs, pickerPID, shoot);
compressor = new Compressor(PRESSURE_SWITCH_CHANNEL, COMPRESSOR_RELAY_CHANNEL);
colwellContraption1 = new Solenoid(1, 3);
colwellContraption2 = new Solenoid(1, 4);
colwellContraption2.set(true);
this.autoTimer = new Timer();
drive.leftEncoder.start();
drive.rightEncoder.start();
drive.timer.start();
autoTimer.start();
}
示例2: Loader
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public Loader()
{
Conveyor = new Victor(ReboundRumble.LOADER_CONVEYOR_PWM);
loaderInSolenoid = new Solenoid(ReboundRumble.LOADER_IN_SOLENOID_CHANNEL);
loaderOutSolenoid = new Solenoid(ReboundRumble.LOADER_OUT_SOLENOID_CHANNEL);
loaderUpSolenoid = new Solenoid(ReboundRumble.LOADER_UP_SOLENOID_CHANNEL);
loaderDownSolenoid = new Solenoid(ReboundRumble.LOADER_DOWN_SOLENOID_CHANNEL);
loaderIn = new DigitalInput(ReboundRumble.LOAD_IN_GPIO_CHANNEL);
loaderOut = new DigitalInput(ReboundRumble.LOAD_OUT_GPIO_CHANNEL);
loaderUp = new DigitalInput(ReboundRumble.LOAD_UP_GPIO_CHANNEL);
loaderDown = new DigitalInput(ReboundRumble.LOAD_DOWN_GPIO_CHANNEL);
loaderDownSolenoid.set(false);
loaderUpSolenoid.set(true);
loaderOutSolenoid.set(false);
loaderInSolenoid.set(true);
}
示例3: DriveTrain
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public DriveTrain() {
mjGauche = JoystickDevice.GetTankDriveGauche();
mjDroite = JoystickDevice.GetTankDriveDroite();
mDriveTrain = new RobotDrive(PwmDevice.mMoteurGaucheAvant,
PwmDevice.mMoteurGaucheArriere,
PwmDevice.mMoteurDroiteAvant,
PwmDevice.mMoteurDroiteArriere);
msTransmissionHi = new Solenoid(SolenoidDevice.mTransmissionHi);
msTransmissionLow = new Solenoid(SolenoidDevice.mTransmissionLow);
meTransmissionGauche = new Encoder(DigitalDevice.mTransmissionGaucheEncodeurA,
DigitalDevice.mTransmissionGaucheEncodeurB);
mfMoteurGauche = new FiltrePasseBas(25);
meTransmissionDroite = new Encoder(DigitalDevice.mTransmissionDroiteEncodeurA,
DigitalDevice.mTransmissionDroiteEncodeurB);
mfMoteurDroite = new FiltrePasseBas(25);
msTransmissionHi.set(false);
msTransmissionLow.set(true);
}
示例4: WsSolenoid
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public WsSolenoid(String name, int module, int channel1) {
this.subject = new BooleanSubject(name);
subject.setValue(false);
solenoid = new Solenoid(module, channel1);
solenoid.set(false);
}
示例5: RobotTemplate
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public RobotTemplate() {
// initialize all the objects
ingest = new VictorPair(5,6);
elevator = new Victor(1);
shooter = new VictorPair(2,4);
robotDrive = new Drive(8, 7, 10, 9);
xbox = new JStick(1);
joystick = new JStick(2);
compressor = new Compressor(4, 3);
compressor.start();
driveGearA = new Solenoid(1);
driveGearB = new Solenoid(2);
driveGearA.set(true);
driveGearB.set(false);
selectedGear = 1;
leftEnc = new Encoder(6, 7, true,CounterBase.EncodingType.k2X);
leftEnc.setDistancePerPulse(0.103672558);
rightEnc = new Encoder(9, 10, false);
rightEnc.setDistancePerPulse(0.103672558);
lcd = DriverStationLCD.getInstance();
}
示例6: liftSet
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
static void liftSet(boolean state, Solenoid set, Solenoid retract) {
//If retracted, extend
if (state == false) {
set.set(true);
retract.set(false);
state = true;
} //If iextended, retract
else {
set.set(false);
retract.set(true);
state = false;
}
}
示例7: cycle
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
static void cycle(Solenoid set, Solenoid retract, int count, int timeA, int timeB) {
switch (count) {
case 0:
set.set(false);
retract.set(true);
break;
case 200:
set.set(true);
retract.set(false);
break;
case 400:
count = 0;
}
}
示例8: Canon
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public Canon(ReserveBallon reserve) {
mReserve = reserve;
mjControl = JoystickDevice.GetCoPilot();
mjAngleDeTir = new Jaguar(PwmDevice.mCanonAngleDeTir);
mfAngleDeTir = new FiltrePasseBas(25);
mjOrientationDeTir = new Jaguar(PwmDevice.mCanonOrientationDeTir);
mfOrientationDeTir = new FiltrePasseBas(25);
msTir = new Solenoid(SolenoidDevice.mCanonTir);
msTirRev = new Solenoid(SolenoidDevice.mCanonTirRev);
mdLimiteRotationGauche = new DigitalInput(DigitalDevice.mCanonLimiteRotationGauche);
mdLimiteRotationDroite = new DigitalInput(DigitalDevice.mCanonLimiteRotationDroite);
mjCanonHaut = new Jaguar(PwmDevice.mCanonMoteurHaut);
mfCanonHaut = new FiltrePasseBas(25);
macCanonHaut = new AnalogChannel(AnalogDevice.mCanonMoteurHaut);
mpidCanonHaut = new PIDController(Kp,Ki, Kd, macCanonHaut, mjCanonHaut);
mpidCanonHaut.setInputRange(0.0, 4095.0);
mpidCanonHaut.setOutputRange(-1.0, 1.0);
mjCanonBas = new Jaguar(PwmDevice.mCanonMoteurBas);
mfCanonBas = new FiltrePasseBas(25);
macCanonBas = new AnalogChannel(AnalogDevice.mCanonMoteurBas);
mpidCanonBas = new PIDController(Kp,Ki, Kd, macCanonBas, mjCanonBas);
mpidCanonBas.setInputRange(0.0, 4095.0);
mpidCanonBas.setOutputRange(-1.0, 1.0);
mRangeFinder = new RangeFinder(5);
maAngle = new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k8G);
maRef = new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k8G);
msTir.set(false);
msTirRev.set(true);
}
示例9: Pont
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public Pont() {
mjControl = JoystickDevice.GetCoPilot();
mjDroite = JoystickDevice.GetTankDriveDroite();
msBrasDown = new Solenoid(SolenoidDevice.mBrasDown);
msBrasUp = new Solenoid(SolenoidDevice.mBrasUp);
msBrasLock = new Solenoid(SolenoidDevice.mBrasLock);
msBrasUnlock = new Solenoid(SolenoidDevice.mBrasUnlock);
mdLimitLock = new DigitalIOButton(DigitalDevice.mBrasLimiteLock);
msBrasLock.set(false);
msBrasUnlock.set(true);
msBrasDown.set(false);
msBrasUp.set(true);
}
示例10: ClimbingSystem
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public ClimbingSystem(RobotTemplate robo)
{
try
{
up = new Solenoid(Wiring.CLIMB_SOLENOID_UP);
down = new Solenoid(Wiring.CLIMB_SOLENOID_DOWN);
forward = new Solenoid(Wiring.CLIMBING_SOLENOID_FORWARD);
back = new Solenoid(Wiring.CLIMBING_SOLENOID_BACKWARD);
home = new DigitalInput(Wiring.CYLINDER_HOME);
part = new DigitalInput(Wiring.CYLINDER_PART);
max = new DigitalInput(Wiring.CYLINDER_MAX);
winch = new CANJaguar(Wiring.WINCH_MOTOR);
countPart = new Counter(part);
countPart.setUpSourceEdge(true, false);
countPart.reset();
countPart.start();
winch.configMaxOutputVoltage(6.0);
forward.set(true);
back.set(false);
this.robo = robo;
time.start();
typicalCurrent = 0;
}
catch (CANTimeoutException ex)
{
ex.printStackTrace();
}
}
示例11: liftSet
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public static boolean liftSet(boolean state, Solenoid set, Solenoid retract) {
//If retracted, extend
if (state == false) {
set.set(true);
retract.set(false);
return true;
} //If iextended, retract
else {
set.set(false);
retract.set(true);
return false;
}
}
示例12: cycle
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
public static void cycle(Solenoid set, Solenoid retract, int count) {
switch (count) {
case 0:
set.set(false);
retract.set(true);
break;
case 200:
set.set(true);
retract.set(false);
break;
case 400:
count = 0;
}
}
示例13: test
import edu.wpi.first.wpilibj.Solenoid; //导入方法依赖的package包/类
/**
* This function is called once each time the robot enters test mode.
*/
public void test() {
Solenoid left = new Solenoid(1);
Solenoid right = new Solenoid(2);
Solenoid comm = new Solenoid(3);
while (isEnabled()) {
sonar.sonarLeftEnable.set(true);
sonar.sonarRightEnable.set(true);
System.out.print("L: " + sonar.getLeftDistance());
System.out.print(", R: " + sonar.getRightDistance());
System.out.print(", Dist: " + sonar.getDistance());
System.out.println(", Bal: " + sonar.getBalance());
if (sonar.getBalance() == Constants.SONIC_BALANCE_LEFT
|| sonar.getBalance() == Constants.SONIC_BALANCE_EQUAL) {
left.set(true);
} else {
left.set(false);
}
if (sonar.getBalance() == Constants.SONIC_BALANCE_RIGHT
|| sonar.getBalance() == Constants.SONIC_BALANCE_EQUAL) {
right.set(true);
} else {
right.set(false);
}
Timer.delay(.1);
}
/*Vision vision = new Vision();
double startTime = Timer.getFPGATimestamp();
thrower.initThrower();
// drive forward
dt.setSafetyEnabled(true);
dt.arcadeDrive(-0.7,0);
while (Timer.getFPGATimestamp() < startTime + 2.9) { //2.9 secs run time
thrower.update();
}
dt.arcadeDrive(0,0);
// Hot test
int hotCounter = 0;
while (Timer.getFPGATimestamp()< startTime + 4) {
if (vision.hot()) {
hotCounter ++;
}
else {
hotCounter --;
}
thrower.update();
Timer.delay(0.1);
}
//Throw test
thrower.setThrowSpeed(1.0);
thrower.setThrowArc((int)(ds.getAnalogIn(2)/5 * 130));
if (hotCounter > 0) {
System.out.println("Shooting");
} else {
System.out.println("Not hot, waiting");
Timer.delay(2);
System.out.println("Shooting");
}
thrower.startThrow();
while (thrower.getStatus() != Constants.THROWER_STATUS_HOME) {
thrower.update();
//System.out.println(thrower.getStatus());
Timer.delay(Constants.TELEOP_LOOP_DELAY_SECS);
}
//Turn around*/
}