<commit_before>package org.firstinspires.ftc.robotcontroller.libs;

import com.qualcomm.robotcore.util.Range;

/**
 * Created by Team 10794 on 10/22/16.
 * This is a library class that controls the motors
 */
public class MotorFunctions {

    //These are the control variables for the function. They are set in the constructor.
    private static int motorMin, motorMax;
    private static double servoMin, servoMax;
    private static double servoDelta;

    /**
     * Constructor initializing the library class with the desired max and min ranges and servo
     * delta
     * @param pMotorMin the minimum value of the DC motor
     * @param pMotorMax the maximum value of the DC motor
     * @param pServoMin the minimum value of the servo
     * @param pServoMax the maximum value of the servo
     * @param pServoDelta the amount by which to change the servo position
     */
    public MotorFunctions(int pMotorMin, int pMotorMax, double pServoMin, double pServoMax, double
            pServoDelta) {
        motorMin = pMotorMin;
        motorMax = pMotorMax;
        servoMin = pServoMin;
        servoMax = pServoMax;

        servoDelta = pServoDelta;
    }

    /**
     * Normalizes the power level from the joystick value<commit_msg>Alpha holonomic drive<commit_after>package org.firstinspires.ftc.robotcontroller.libs;

import com.qualcomm.robotcore.util.Range;

/**
 * Created by Team 10794 on 10/22/16.
 * This is a library class that controls the motors
 */
public class MotorFunctions {

    //These are the control variables for the function. They are set in the constructor.
    private static int motorMin, motorMax;
    private static double servoMin, servoMax;
    private static double servoDelta;

    /**
     * Constructor initializing the library class with the desired max and min ranges and servo
     * delta
     * @param pMotorMin the minimum value of the DC motor
     * @param pMotorMax the maximum value of the DC motor
     * @param pServoMin the minimum value of the servo
     * @param pServoMax the maximum value of the servo
     * @param pServoDelta the amount by which to change the servo position
     */
    public MotorFunctions(int pMotorMin, int pMotorMax, double pServoMin, double pServoMax, double
            pServoDelta) {
        motorMin = pMotorMin;
        motorMax = pMotorMax;
        servoMin = pServoMin;
        servoMax = pServoMax;

        servoDelta = pServoDelta;
    }

    /**
     * Holonomic Drive Intiailizer
     */
    public MotorFunctions() {
        // reverse motors
    }


    public static float[] holonomic(float joystick_turn, float joystick_speed, float
            joystick_strafe) {
        // Front Left Wheel: y - x + z (speed - turn + strafe)
        // Front Right Wheel: y + x - z (speed + turn - strafe)
        // Back Left Wheel: y + x + z (speed + turn + strafe)
        // Back Right Wheel: y - x - z (speed - turn - strafe)

        double mag = Math.abs(joystick_turn) + Math.abs(joystick_speed) + Math.abs(joystick_strafe);
        mag = Range.clip(mag, -1, 1);

        float fl, fr, bl, br;
        fl = (float)Range.clip((scaleInput(joystick_speed) - scaleInput(joystick_turn) + scaleInput
                        (joystick_strafe)), -mag, +mag);
        fr = (float)Range.clip((scaleInput(joystick_speed) + scaleInput(joystick_turn) - scaleInput
                (joystick_strafe)), -mag, +mag);
        bl = (float)Range.clip((scaleInput(joystick_speed) + scaleInput(joystick_turn) + scaleInput
                (joystick_strafe)), -mag, +mag);
        br = (float)Range.clip((scaleInput(joystick_speed) - scaleInput(joystick_turn) - scaleInput
                (joystick_strafe)), -mag, +mag);
        
        float[] motorVals = {fl, fr, bl, br};
        return motorVals;
    }

    /**
     * Normalizes the power level from the joystick value
{'fraction_non_alphanumeric': 0.08285714285714285, 'fraction_numerical': 0.006233766233766234, 'mean_word_length': 2.615962441314554, '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': '22671', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1109, 'n_words': 381}