<commit_before>package org.team2471.bunnybot.subsystems;

import com.team254.frc2016.CheesyDriveHelper;
import com.team254.lib.util.DriveSignal;
import org.team2471.bunnybot.defaultcommands.DriveTrainDefaultCommand;
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.team2471.bunnybot.IOMap;

import static org.team2471.bunnybot.HardwareMap.Drivetrain.*;
import static org.team2471.bunnybot.IOMap.*;

public class DriveTrain extends Subsystem {
  private CheesyDriveHelper cheesyDriveHelper;
  private static final double HIGH_SHIFTPOINT = 400.0;
  private static final double LOW_SHIFTPOINT = 325.0;

  public DriveTrain() {

    rightMotor2.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightMotor3.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightMotor2.set(rightMotor1.getDeviceID());
    rightMotor3.set(rightMotor1.getDeviceID());

    leftMotor2.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftMotor3.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftMotor2.set(leftMotor1.getDeviceID());
    leftMotor3.set(leftMotor1.getDeviceID());

    cheesyDriveHelper = new CheesyDriveHelper();
  }

  public void drive(double throttle, double turn) {
    if (SmartDashboard.getBoolean("CheesyDrive", true)) {              // left bumper permits quick turn (in place)
      DriveSignal driveSignal = cheesyDriveHelper.cheesyDrive(throttle, turn, driveController.getButton(4).get());

      rightMotor1.set(-driveSignal.rightMotor);
      leftMotor1.set(driveSignal.leftMotor);
    } else {
      double left = throttle + turn;
      double right = throttle - turn;

      rightMotor1.set(-right);
      leftMotor1.set(left);

      double averageSpeed = (Math.abs(leftMotor1.getSpeed()) + Math.abs(rightMotor1.getSpeed())) / 2;
      if (averageSpeed > HIGH_SHIFTPOINT) {
        shiftSolenoid.set(false);
      } else if (averageSpeed < LOW_SHIFTPOINT) {
        shiftSolenoid.set(true);
      }
      SmartDashboard.putNumber("Speed", averageSpeed);
    }
  }

  private double getSpeed() {
    return ( leftMotor1.getSpeed() + rightMotor1.getSpeed() ) / 2.0;
  }
  
  @Override
  protected void initDefaultCommand() {
    setDefaultCommand(new DriveTrainDefaultCommand());
  }
}<commit_msg>This is why the shifting wasn't working.<commit_after>package org.team2471.bunnybot.subsystems;

import com.team254.frc2016.CheesyDriveHelper;
import com.team254.lib.util.DriveSignal;
import org.team2471.bunnybot.defaultcommands.DriveTrainDefaultCommand;
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.team2471.bunnybot.IOMap;

import static org.team2471.bunnybot.HardwareMap.Drivetrain.*;
import static org.team2471.bunnybot.IOMap.*;

public class DriveTrain extends Subsystem {
  private CheesyDriveHelper cheesyDriveHelper;
  private static final double HIGH_SHIFTPOINT = 400.0;
  private static final double LOW_SHIFTPOINT = 325.0;

  public DriveTrain() {

    rightMotor2.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightMotor3.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightMotor2.set(rightMotor1.getDeviceID());
    rightMotor3.set(rightMotor1.getDeviceID());

    leftMotor2.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftMotor3.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftMotor2.set(leftMotor1.getDeviceID());
    leftMotor3.set(leftMotor1.getDeviceID());

    cheesyDriveHelper = new CheesyDriveHelper();
  }

  public void drive(double throttle, double turn) {
    if (SmartDashboard.getBoolean("CheesyDrive", true)) {              // left bumper permits quick turn (in place)
      DriveSignal driveSignal = cheesyDriveHelper.cheesyDrive(throttle, turn, driveController.getButton(4).get());  // is there a way to declare a button in IO, so that all the constants remain there.

      rightMotor1.set(-driveSignal.rightMotor);
      leftMotor1.set(driveSignal.leftMotor);
    }
    else {
      double left = throttle + turn;
      double right = throttle - turn;

      rightMotor1.set(-right);
      leftMotor1.set(left);
    }

    double averageSpeed = getSpeed();
    if (averageSpeed > HIGH_SHIFTPOINT) {
      shiftSolenoid.set(false);
    } else if (averageSpeed < LOW_SHIFTPOINT) {
      shiftSolenoid.set(true);
    }
    SmartDashboard.putNumber("Speed", averageSpeed);
  }

  private double getSpeed() {
    return (Math.abs(leftMotor1.getSpeed()) + Math.abs(rightMotor1.getSpeed())) / 2;
  }
  
  @Override
  protected void initDefaultCommand() {
    setDefaultCommand(new DriveTrainDefaultCommand());
  }
}
{'fraction_non_alphanumeric': 0.10560571068654209, 'fraction_numerical': 0.025194205332773462, 'mean_word_length': 4.376975169300226, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '679256', 'n_tokens_mistral': 1740, 'n_tokens_neox': 1546, 'n_words': 257}