<commit_before>package com.edinarobotics.zeke.subsystems;

import com.edinarobotics.utils.common.Updatable;
import com.edinarobotics.utils.sensors.UltrasonicSensor;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Talon;

public class Drivetrain implements Updatable {
    private RobotDrive robotDrive;
    private double magnitude, direction, rotation;
    private Talon frontLeftT, frontRightT, rearLeftT, rearRightT;
    private UltrasonicSensor ultrasonicSensor;
    
    private static final double ULTRASONIC_START_VOLTAGE = 0;
    private static final double ULTRASONIC_END_VOLTAGE = 1;
    private static final double ULTRASONIC_START_DISTANCE = 0;
    private static final double ULTRASONIC_END_DISTANCE = 1;
    
    public Drivetrain(int frontLeft, int rearLeft,
           int frontRight, int rearRight, int ultrasonicSensorChannel) {
        frontLeftT = new Talon(frontLeft);
        frontRightT = new Talon(frontRight);
        rearLeftT = new Talon(rearLeft);
        rearRightT = new Talon(rearRight);
        ultrasonicSensor = new UltrasonicSensor(ultrasonicSensorChannel, 
                ULTRASONIC_START_VOLTAGE, ULTRASONIC_END_VOLTAGE, 
                ULTRASONIC_START_DISTANCE, ULTRASONIC_END_DISTANCE);
        this.robotDrive = new RobotDrive(frontLeftT, rearLeftT,
               frontRightT, rearRightT);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
    }
    
    public void mecanumPolarStrafe(double magnitude, double direction) {
        this.magnitude = magnitude;
        this.direction = direction;
        update();
    }
    
    public void mecanumPolarRotation(double rotation) {
        this.rotation = rotation;
        update();
    }
    
    public double getMagnitude() {
        return magnitude;
    }
    
    public double getDirection() {
        return direction;
    }
    
    public void update() {
        robotDrive.mecanumDrive_Polar(magnitude, direction, rotation);
        
        
    }
}
<commit_msg>Added scaling for ultrasonic sensor and getUltrasonicSensor method.<commit_after>package com.edinarobotics.zeke.subsystems;

import com.edinarobotics.utils.common.Updatable;
import com.edinarobotics.utils.sensors.UltrasonicSensor;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Talon;

public class Drivetrain implements Updatable {
    private RobotDrive robotDrive;
    private double magnitude, direction, rotation;
    private Talon frontLeftT, frontRightT, rearLeftT, rearRightT;
    private UltrasonicSensor ultrasonicSensor;
    
    private static final double ULTRASONIC_SCALE = 6.799;
    
    public Drivetrain(int frontLeft, int rearLeft,
           int frontRight, int rearRight, int ultrasonicSensorChannel) {
        frontLeftT = new Talon(frontLeft);
        frontRightT = new Talon(frontRight);
        rearLeftT = new Talon(rearLeft);
        rearRightT = new Talon(rearRight);
        ultrasonicSensor = new UltrasonicSensor(ultrasonicSensorChannel, 
                ULTRASONIC_SCALE);
        this.robotDrive = new RobotDrive(frontLeftT, rearLeftT,
               frontRightT, rearRightT);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
    }
    
    public void mecanumPolarStrafe(double magnitude, double direction) {
        this.magnitude = magnitude;
        this.direction = direction;
        update();
    }
    
    public void mecanumPolarRotation(double rotation) {
        this.rotation = rotation;
        update();
    }
    
    public double getMagnitude() {
        return magnitude;
    }
    
    public double getDirection() {
        return direction;
    }
    
    public UltrasonicSensor getUltrasonicSensor() {
        return ultrasonicSensor;
    }
    
    public void update() {
        robotDrive.mecanumDrive_Polar(magnitude, direction, rotation);
        
        
    }
}

{'fraction_non_alphanumeric': 0.07394288244410006, 'fraction_numerical': 0.0017710870046491033, 'mean_word_length': 3.1794634597594817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1884592', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1409, 'n_words': 267}