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
this.disable();
gyro.start();
- leftGearPiston = new DoubleSolenoid(10, Constants.DriveTrain.LEFT_FORWARD,
- Constants.DriveTrain.LEFT_REVERSE);
- rightGearPiston = new DoubleSolenoid(10,
- Constants.DriveTrain.RIGHT_FORWARD,
- Constants.DriveTrain.RIGHT_REVERSE);
+ leftGearPiston = new DoubleSolenoid(Constants.DriveTrain.MODULE_B_ID,
+ Constants.DriveTrain.LEFT_FORWARD, Constants.DriveTrain.LEFT_REVERSE);
+ 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;
}
/*
* Method is a required method that the PID Subsystem uses to return the
* calculated PID value to the driver
- *
+ *
* @param Gives the user the output from the PID algorithm that is calculated
* internally
- *
+ *
* Body: Uses the output, does some filtering and drives the robot
*/
@Override
output = Math.signum(output) * 0.3;
left = output;
right = output + drift * Constants.DriveTrain.kp / 10;
- drive(left, right);
} else if (DRIVE_MODE == Constants.DriveTrain.GYRO_MODE) {
left = output;
right = -output;
- arcadeDrive(0, output);
}
+ drive(left, right);
pidOutput = output;
}
/*
* Checks the drive mode
- *
+ *
* @return the current state of the robot in each state Average distance from
* both sides of tank drive for Encoder Mode Angle from the gyro in GYRO_MODE
*/
/*
* constrains the distance to within -100 and 100 since we aren't going to
* drive more than 100 inches
- *
+ *
* Configure Encoder PID
- *
+ *
* Sets the setpoint to the PID subsystem
*/
public void driveDistance(double dist, double maxTimeOut) {
/*
* Turning method that should be used repeatedly in a command
- *
+ *
* First constrains the angle to within -360 and 360 since that is as much as
* we need to turn
- *
+ *
* Configures Gyro PID and sets the setpoint as an angle
*/
public void turnAngle(double angle) {
rightGearPiston.set(gear);
}
+ public void startCompressor() {
+ compressor.start();
+ }
+
+ public void stopCompressor() {
+ compressor.stop();
+ }
+
+ public void toggleCompressor() {
+ if (compressor.enabled())
+ compressor.stop();
+ else
+ compressor.start();
+ }
+
}