((3.66 / 5.14) * 6 * Math.PI) / 256;
public static final int MANUAL_MODE = 1, ENCODER_MODE = 2, GYRO_MODE = 3;
+ public static final int LEFT_FORWARD = 0, LEFT_REVERSE = 1,
+ RIGHT_FORWARD = 2, RIGHT_REVERSE = 3;
public static double time = 0;
}
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.CounterBase.EncodingType;
+import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.RobotDrive;
private RobotDrive robotDrive;
private GyroLib gyro;
+ private DoubleSolenoid leftGearPiston, rightGearPiston;
+ // Drivetrain specific constants that relate to the inches per pulse value for
+ // the encoders
+ private final static double WHEEL_DIAMETER = 6.0; // in inches
+ private final static double PULSES_PER_ROTATION = 256; // in pulses
+ private final static double OUTPUT_SPROCKET_DIAMETER = 2.0; // in inches
+ private final static double WHEEL_SPROCKET_DIAMETER = 3.5; // in inches
+ public final static double INCHES_PER_PULSE = (((Math.PI)
+ * OUTPUT_SPROCKET_DIAMETER / PULSES_PER_ROTATION)
+ / WHEEL_SPROCKET_DIAMETER) * WHEEL_DIAMETER;
+
+ // Drivetrain specific constants that relate to the PID controllers
+ private final static double Kp = 1.0, Ki = 0.0,
+ Kd = 0.0 * (OUTPUT_SPROCKET_DIAMETER / PULSES_PER_ROTATION)
+ / (WHEEL_SPROCKET_DIAMETER) * WHEEL_DIAMETER;
public DriveTrain() {
super(kp, ki, kd);
this.disable();
gyro.start();
+ leftGearPiston = new DoubleSolenoid(Constants.DriveTrain.LEFT_FORWARD,
+ +Constants.DriveTrain.LEFT_REVERSE);
+ rightGearPiston = new DoubleSolenoid(Constants.DriveTrain.RIGHT_FORWARD,
+ Constants.DriveTrain.RIGHT_REVERSE);
}
@Override