<commit_before>package org.usfirst.frc.team4536.robot;

import java.lang.Math;

public class Utilities {
	
	/*
	 * Takes in values and makes them between -1 and 1
	 */
	public static double limit (double input) {
		double output;
		
		if(input > 1) {
			output = 1;
		}
		else if(input < -1) {
			output = -1;
		}
		else {
			output = input;
		}
		
		return output;
	}
		
	/*
	 * Takes in values and makes sure they are both above deadZone and below -deadZone
	 * We use it to create a small region on our joysticks that outputs 0
	 * Once the joystick gets outside of the dead zone, it outputs their actual values
	 */
	public static double deadZone (double input, double deadZone) {
        double output;
		
		if ((input < deadZone) && (input > -deadZone))      //if the input is within the dead zone, return 0
            output = 0;
        else
            output = input;
		
		return output;
     	}
	
	
	/*
	 * 
	 */
	public static double speedCurve(double input, double curve) {
        double output;
        double adjustedCurve = curve;
        
        //We don't want to have bases smaller than 0.1 because of weird math
        if(curve <= 0.1) {         
            adjustedCurve = 0.1;
        }
        
        //If the input is negative then pretend that it's positive 
        if(input < 0) {            
            output = -(Math.pow(-input, adjustedCurve));  //and reflect it over the X axis
        }
        //If it's positive then simply take it to the power of the adjustedCurve
        else {                     
            output = Math.pow(input, adjustedCurve);
        }
        
        //output has to be between -1 and 1
        limit(output);
        
        return output;
    }
}<commit_msg>Added Liam's AccelLimit to Utilities class<commit_after>package org.usfirst.frc.team4536.robot;

import java.lang.Math;

public class Utilities {
	
	/*
	 * Takes in values and makes them between -1 and 1
	 */
	public static double limit (double input) {
		double output;
		
		if(input > 1) {
			output = 1;
		}
		else if(input < -1) {
			output = -1;
		}
		else {
			output = input;
		}
		
		return output;
	}
		
	/*
	 * Takes in values and makes sure they are both above deadZone and below -deadZone
	 * We use it to create a small region on our joysticks that outputs 0
	 * Once the joystick gets outside of the dead zone, it outputs their actual values
	 */
	public static double deadZone (double input, double deadZone) {
        double output;
		
		if ((input < deadZone) && (input > -deadZone))      //if the input is within the dead zone, return 0
            output = 0;
        else
            output = input;
		
		return output;
     	}
	
	
	/*
	 * 
	 */
	public static double speedCurve(double input, double curve) {
        double output;
        double adjustedCurve = curve;
        
        //We don't want to have bases smaller than 0.1 because of weird math
        if(curve <= 0.1) {         
            adjustedCurve = 0.1;
        }
        
        //If the input is negative then pretend that it's positive 
        if(input < 0) {            
            output = -(Math.pow(-input, adjustedCurve));  //and reflect it over the X axis
        }
        //If it's positive then simply take it to the power of the adjustedCurve
        else {                     
            output = Math.pow(input, adjustedCurve);
        }
        
        //output has to be between -1 and 1
        limit(output);
        
        return output;
    }
	
	public static double accelLimit(double fullSpeedTime, double throttle, double prevValue) {		
		double finalThrottle;
    	
    	double throttleDiff = throttle - prevValue;
    	double accelerationLimit = 0.02 / fullSpeedTime; //Sets accelerationLimit to the proper double to make the robot reach its top speed in the given full speed time.    	
    	//forward throttle of robot can increase only by + or - forwardAccelerationLimit per cycle (20ms)
    	if (throttleDiff > accelerationLimit) {
    		finalThrottle = prevValue + accelerationLimit;
    	} else if (throttleDiff < -accelerationLimit) {
    		finalThrottle = prevValue - accelerationLimit;
    	} else {
    		finalThrottle = throttle;
    	}
    	
    	return finalThrottle;
	}
}
{'fraction_non_alphanumeric': 0.07871788828658968, 'fraction_numerical': 0.011548432712703276, 'mean_word_length': 1.9088416723783412, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 8, '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': '2361690', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1185, 'n_words': 459}