public static final int MODULE_A_ID = 9, MODULE_B_ID = 10;
public static final int LEFT_FORWARD = 5, LEFT_REVERSE = 1,
RIGHT_FORWARD = 4, RIGHT_REVERSE = 0;
- public static final int COMPRESSOR_ID = 9;
public static double time = 0;
package org.usfirst.frc.team3501.robot;
import org.usfirst.frc.team3501.robot.commands.driving.ChangeGear;
-import org.usfirst.frc.team3501.robot.commands.driving.ToggleCompressor;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
public static Button intakeBoulder;
public static Button shootBoulder;
public static Button toggleGear;
- public static Button toggleCompressor;
// button to change robot to the scaling mode
public static DigitalButton toggleScaling;
Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT);
toggleGear.toggleWhenPressed(new ChangeGear());
- toggleCompressor = new JoystickButton(rightJoystick,
- Constants.OI.TOGGLE_COMPRESSOR_PORT);
- toggleCompressor.whenPressed(new ToggleCompressor());
-
// passPortcullis = new DigitalButton(
// new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT));
// passPortcullis.whenPressed(new PassPortcullis());
@Override
public void teleopInit() {
Robot.driveTrain.setLowGear();
- Robot.driveTrain.startCompressor();
}
@Override
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.driving;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/**
- *
- */
-public class ToggleCompressor extends Command {
-
- public ToggleCompressor() {
-
- }
-
- @Override
- protected void initialize() {
- Robot.driveTrain.toggleCompressor();
- }
-
- @Override
- protected void execute() {
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-}
import org.usfirst.frc.team3501.robot.sensors.Lidar;
import edu.wpi.first.wpilibj.CANTalon;
-import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.CounterBase.EncodingType;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
private GyroLib gyro;
private DoubleSolenoid leftGearPiston, rightGearPiston;
- private Compressor compressor;
// Drivetrain specific constants that relate to the inches per pulse value for
// the encoders
rightGearPiston = new DoubleSolenoid(Constants.DriveTrain.MODULE_B_ID,
Constants.DriveTrain.RIGHT_FORWARD, Constants.DriveTrain.RIGHT_REVERSE);
- compressor = new Compressor(Constants.DriveTrain.COMPRESSOR_ID);
-
Constants.DriveTrain.inverted = false;
}
rightGearPiston.set(gear);
}
- public void startCompressor() {
- compressor.start();
- }
-
- public void stopCompressor() {
- compressor.stop();
- }
-
- public void toggleCompressor() {
- if (compressor.enabled())
- compressor.stop();
- else
- compressor.start();
- }
-
}