本文整理汇总了Java中edu.wpi.first.wpilibj.Solenoid类的典型用法代码示例。如果您正苦于以下问题:Java Solenoid类的具体用法?Java Solenoid怎么用?Java Solenoid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Solenoid类属于edu.wpi.first.wpilibj包,在下文中一共展示了Solenoid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DriveTrain
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public DriveTrain(OperatorInputs _operatorInputs) {
this.operatorInputs = _operatorInputs;
this.leftTalons = new Talon(LEFT_PORT);
this.rightTalons = new Talon(RIGHT_PORT);
this.gearShiftLow = new Solenoid(SHIFT_MODULE, SHIFT_PORT_LOW);
this.gearShiftHigh = new Solenoid(SHIFT_MODULE, SHIFT_PORT_HIGH);
this.leftEncoder = new Encoder(3, 4);
this.rightEncoder = new Encoder(5, 6);
this.timer = new Timer();
//Start all wheels off
leftTalons.set(0);
rightTalons.set(0);
//Starts in low gear
gearShiftLow.set(isHighGear);
gearShiftHigh.set(!isHighGear);
leftEncoder.setDistancePerPulse(-DISTANCE_PER_PULSE);
rightEncoder.setDistancePerPulse(DISTANCE_PER_PULSE);
}
示例3: DriveTrain
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
/**
*
*/
public DriveTrain() {
super("DriveTrain");
FLeftMotor = new Victor(RobotMap.FLeftMotorPWM);
FRightMotor = new Victor(RobotMap.FRightMotorPWM);
BLeftMotor = new Victor(RobotMap.BLeftMotorPWM);
BRightMotor = new Victor(RobotMap.BRightMotorPWM);
//MLeftMotor = new Victor(RobotMap.MLeftMotorPWM);
//MRightMotor = new Victor(RobotMap.MRightMotorPWM);
drive = new RobotDrive(FLeftMotor, BLeftMotor, FRightMotor, BRightMotor);
//drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
//drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
GShiftSolDown = new Solenoid(RobotMap.DriveTrainLowGearSolenoid);
GShiftSolUp = new Solenoid(RobotMap.DriveTrainHighGearSolenoid);
display = DriverStationLCD.getInstance();
}
示例4: PneumaticTest
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public PneumaticTest(int numDoubleValves) {
super("PneumaticTestSubsystem");
try {
m_solenoidExtend = new Solenoid[numDoubleValves];
m_solenoidRetract = new Solenoid[numDoubleValves];
m_position = new String[numDoubleValves];
int relayPort = 1;
int moduleId = 1;
for (int valveId = 0; valveId < numDoubleValves; valveId++) {
if (valveId == 4) {
moduleId = 2;
relayPort = 1;
}
System.out.println("Pneumatic Extend, Valve id = " + valveId + ", module = " + moduleId + ", port = " + relayPort);
m_solenoidExtend[valveId] = new Solenoid(moduleId, relayPort++);
System.out.println("Pneumatic Retract, Valve id = " + valveId + ", module = " + moduleId + ", port = " + relayPort);
m_solenoidRetract[valveId] = new Solenoid(moduleId, relayPort++);
m_position[valveId] = PneumaticSubsystem.UNKNOWN;
}
} catch (Exception e) {
System.out.println("Unknown error initializing " + getName() + ". Message = " + e.getMessage());
}
}
示例5: update
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public void update()
{
for (int cy = 0; cy < MODULES; cy++)
{
for (int cx = 0; cx < CHANNELS; cx++)
{
Solenoid s = solenoids[cy][cx];
if (s == null)
{
continue;
}
SmartDashboard.putBoolean(String.format("%d - %d", cy + 1, cx + 1), s.get());
}
}
}
示例6: Drivetrain
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public Drivetrain () {
leftBackMotor = new TalonWrapper (RobotMap.Drivetrain.LEFT_BACK_MOTOR_CHANNEL, Constants.Drivetrain.LEFT_BACK_MOTOR_FLIPPED);
leftMiddleMotor = new TalonWrapper (RobotMap.Drivetrain.LEFT_MIDDLE_MOTOR_CHANNEL, Constants.Drivetrain.LEFT_MIDDLE_MOTOR_FLIPPED);
leftFrontMotor = new TalonWrapper (RobotMap.Drivetrain.LEFT_FRONT_MOTOR_CHANNEL, Constants.Drivetrain.LEFT_FRONT_MOTOR_FLIPPED);
rightBackMotor = new TalonWrapper (RobotMap.Drivetrain.RIGHT_BACK_MOTOR_CHANNEL, Constants.Drivetrain.RIGHT_BACK_MOTOR_FLIPPED);
rightMiddleMotor = new TalonWrapper (RobotMap.Drivetrain.RIGHT_MIDDLE_MOTOR_CHANNEL, Constants.Drivetrain.RIGHT_MIDDLE_MOTOR_FLIPPED);
rightFrontMotor = new TalonWrapper (RobotMap.Drivetrain.RIGHT_FRONT_MOTOR_CHANNEL, Constants.Drivetrain.RIGHT_FRONT_MOTOR_FLIPPED);
leftEnc = new EncoderWrapper (RobotMap.Drivetrain.LEFT_ENC_CHANNEL_A, RobotMap.Drivetrain.LEFT_ENC_CHANNEL_B);
rightEnc = new EncoderWrapper (RobotMap.Drivetrain.RIGHT_ENC_CHANNEL_A, RobotMap.Drivetrain.RIGHT_ENC_CHANNEL_B);
gyro = new Gyro(RobotMap.Drivetrain.GYRO_CHANNEL);
shifter = new Solenoid(RobotMap.Drivetrain.SHIFTER_CHANNEL);
leftTargetSpeed = rightTargetSpeed = leftCurrSpeed = rightCurrSpeed = 0;
isBusy = false;
isShifterLocked = false;
}
示例7: 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);
}
示例8: SystemShooter
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public SystemShooter() {
super();
wheel1 = new Victor(5); // Both bots: 5
wheel2 = new Victor(6); // Both bots: 6
cockOn = new Solenoid(4); //competition: 4 / practice: 1
cockOff = new Solenoid(3); //competition: 3 / practice: 2
fireOn = new Solenoid(6); // competition: 6 / practice: 5
fireOff = new Solenoid(5); // competition: 5 / practice 6
gateUp = new Solenoid(1); // competition: 1 / practice 3
gateDown = new Solenoid(2); // competition: 2 / practice 4
autoShoot = false;
isShootingAngle = true;
frisbeesShot = 0;
enteringLoop = false;
cockTime = WiredCats2415.textReader.getValue("cockTime");
gatesDownTime = WiredCats2415.textReader.getValue("gatesDownTime");
fireTime = WiredCats2415.textReader.getValue("fireTime");
System.out.println("[WiredCats] Initialized System Shooter");
}
示例9: 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);
}
示例10: update
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public void update()
{
for (int cy = 0; cy < modules; cy++)
{
for (int cx = 0; cx < channels; cx++)
{
Solenoid s = solenoids[cy][cx];
if (s == null)
{
continue;
}
labels[cy][cx].setText(String.format("%d - %d : %s", cy + 1, cx + 1, s.get()));
}
}
solenoidWindow.invalidate();
solenoidWindow.validate();
}
示例11: reset
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public void reset() {
for (int i = 0; i < motors.length; i++) {
if (motors[i] == null) {
continue;
}
if (motors[i] instanceof CANTalon) {
((CANTalon) motors[i]).delete();
} else if (motors[i] instanceof Victor) {
((Victor) motors[i]).free();
}
}
motors = new SpeedController[64];
for (int i = 0; i < solenoids.length; i++) {
if (solenoids[i] == null) {
continue;
}
solenoids[i].free();
}
solenoids = new Solenoid[64];
for (int i = 0; i < relays.length; i++) {
if (relays[i] == null) {
continue;
}
relays[i].free();
}
relays = new Relay[64];
for (int i = 0; i < analogInputs.length; i++) {
if (analogInputs[i] == null) {
continue;
}
analogInputs[i].free();
}
analogInputs = new AnalogInput[64];
if (compressor != null)
compressor.free();
}
示例12: robotInit
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public void robotInit() {
frontLeft = new VictorSP(0);
backLeft = new VictorSP(1);
frontRight = new VictorSP(2);
backRight = new VictorSP(3);
intakeMotor = new VictorSP(4);
compressor = new Compressor(0);
intakeSolenoid = new Solenoid(0);
driveTrain = new RobotDrive(frontLeft, backLeft, frontRight, backRight);
driveTrain.setSafetyEnabled(false);
driveTrain.setExpiration(0.1);
driveTrain.setSensitivity(0.5);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
XboxController = new Joystick(2);
rightJoystick = new Joystick(1);
leftJoystick = new Joystick(0);
}
示例13: robotInit
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit()
{
// PWM's
mTestMotor1 = new Talon(0);
mTestMotor2 = new Jaguar(1);
mServo = new Servo(2);
// Digital IO
mDigitalOutput = new DigitalOutput(0);
mRightEncoder = new Encoder(4, 5);
mLeftEncoder = new Encoder(1, 2);
mUltrasonic = new Ultrasonic(7, 6);
// Analog IO
mAnalogGryo = new AnalogGyro(0);
mPotentiometer = new AnalogPotentiometer(1);
// Solenoid
mSolenoid = new Solenoid(0);
// Relay
mRelay = new Relay(0);
// Joysticks
mJoystick1 = new Joystick(0);
mJoystick2 = new XboxController(1);
// SPI
mSpiGryo = new ADXRS450_Gyro();
// Utilities
mTimer = new Timer();
mPDP = new PowerDistributionPanel();
Preferences.getInstance().putDouble("Motor One Speed", .5);
}
示例14: SnobotShooter
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
public SnobotShooter(SpeedController aShooterMotor, Solenoid aShooterSolenoid, OperatorJoystick aShooterJoystick)
{
mShooterJoystick = aShooterJoystick;
mShooterSolenoid = aShooterSolenoid;
mShooterMotor = aShooterMotor;
mIncreaseSpeedButton = new LatchedButton();
mDecreaseSpeedButton = new LatchedButton();
}
示例15: robotInit
import edu.wpi.first.wpilibj.Solenoid; //导入依赖的package包/类
/**
* This function is run when the robot is first started up and should be used for any initialization code.
*/
@Override
public void robotInit()
{
// UI
mShooterJoystick = new Joystick(PortMap.sOPERATOR_JOYSTICK_PORT);
mDriveJoystick = new Joystick(PortMap.sDRIVER_JOYSTICK_PORT);
mDriverController = new DriverJoystick(mDriveJoystick);
mOperatorController = new OperatorJoystick(mShooterJoystick);
//Shooter
mShooterMotor = new Talon(PortMap.sSHOOTER_MOTOR);
mShooterSolenoid = new Solenoid(PortMap.sSHOOTER_PISTON);
mShooter = new SnobotShooter(mShooterMotor, mShooterSolenoid, mOperatorController);
//Drive Train
mLeftMotor = new Talon(PortMap.sLEFT_DRIVE_MOTOR);
mRightMotor = new Talon(PortMap.sRIGHT_DRIVE_MOTOR);
mDriveTrain = new SnobotDriveTrain(mLeftMotor, mRightMotor, mDriverController);
// Intake
mUpperIntakeMotor = new Talon(PortMap.sUPPER_INTAKE_MOTOR);
mLowerIntakeMotor = new Talon(PortMap.sLOWER_INTAKE_MOTOR);
mIntake = new SnobotIntake(mLowerIntakeMotor, mUpperIntakeMotor, mOperatorController);
addModule(mDriveTrain);
addModule(mShooter);
addModule(mIntake);
initializeLogHeaders();
// Now all the preferences should be loaded, make sure they are all
// saved
PropertyManager.saveIfUpdated();
}