+ return driveTrain;
+ }
+
+ // DRIVE METHODS
+ public void setMotorValues(double left, double right) {
+ left = MathLib.restrictToRange(left, -1.0, 1.0);
+ right = MathLib.restrictToRange(right, -1.0, 1.0);
+
+ frontLeft.set(left);
+ rearLeft.set(left);
+
+ frontRight.set(-right);
+ rearRight.set(-right);
+ }
+
+ public void joystickDrive(final double thrust, final double twist) {
+ robotDrive.arcadeDrive(thrust, twist, true);
+ }
+
+ public void stop() {
+ setMotorValues(0, 0);
+ }
+
+ public double getLeftMotorVal() {
+ return (frontLeft.get() + rearLeft.get()) / 2;
+ }
+
+ public double getRightMotorVal() {
+ return (frontRight.get() + rearRight.get()) / 2;
+ }
+
+ // ENCODER METHODS
+
+ public double getLeftEncoderDistance() {
+ return leftEncoder.getDistance();
+ }
+
+ public double getRightEncoderDistance() {
+ return rightEncoder.getDistance();
+ }
+
+ public void printEncoderOutput() {
+ System.out.println("left: " + getLeftEncoderDistance());
+ System.out.println("right: " + getRightEncoderDistance());
+ // System.out.println(getAvgEncoderDistance());
+ }
+
+ public double getAvgEncoderDistance() {
+ return (leftEncoder.getDistance() + rightEncoder.getDistance()) / 2;
+ }
+
+ public void resetEncoders() {
+ leftEncoder.reset();
+ rightEncoder.reset();
+ }
+
+ public double getLeftSpeed() {
+ return leftEncoder.getRate();
+ }
+
+ public double getRightSpeed() {
+ return rightEncoder.getRate();
+ }
+
+ public double getSpeed() {
+ return (getLeftSpeed() + getRightSpeed()) / 2.0;
+ }
+
+ // ------Gyro------//
+ public double getAngle() {
+ return this.imu.getAngle();
+ }
+
+ public void resetGyro() {
+ this.imu.reset();
+ }
+
+ /*
+ * @return a value that is the current setpoint for the piston kReverse or
+ * KForward
+ */
+ public Value getLeftDriveTrainPiston() {
+ return leftDriveTrainPiston.get();
+ }
+
+ /*
+ * @return a value that is the current setpoint for the piston kReverse or
+ * KForward
+ */
+ public Value getRightDriveTrainPiston() {
+ return rightDriveTrainPiston.get();
+ }
+
+ /*
+ * Changes the ball shift gear assembly to high
+ */
+ public void setHighGear() {
+ changeGear(Constants.DriveTrain.FORWARD_PISTON_VALUE);
+ }
+
+ /*
+ * Changes the ball shift gear assembly to low
+ */
+ public void setLowGear() {
+ changeGear(Constants.DriveTrain.REVERSE_PISTON_VALUE);
+ }
+
+ /*
+ * Changes the gear to a DoubleSolenoid.Value
+ */
+ private void changeGear(DoubleSolenoid.Value gear) {
+ leftDriveTrainPiston.set(gear);
+ rightDriveTrainPiston.set(gear);
+ }
+
+ public Value getGearManipulatorPistonValue() {
+ return gearManipulatorPiston.get();
+ }
+
+ public void extendGearManipulatorPiston() {
+ gearManipulatorPiston.set(Constants.DriveTrain.FORWARD_PISTON_VALUE);
+ }
+
+ public void retractGearManipulatorPiston() {
+ gearManipulatorPiston.set(Constants.DriveTrain.REVERSE_PISTON_VALUE);
+ }
+
+ @Override
+ protected void initDefaultCommand() {
+ setDefaultCommand(new JoystickDrive());
+ }
+
+ public void setCANTalonsBrakeMode(boolean mode) {
+ frontLeft.enableBrakeMode(mode);
+ rearLeft.enableBrakeMode(mode);