<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package robot;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;

/**
 *
 * @author tanner
 */
public class Intake {
    //private enum mode {INTAKE, STOP, FIRE}

    private Joystick joystick;
    private Victor beltMotorOne, beltMotorTwo, unobtaniumMotor;
    private int intakeMode, previousMode;

    /**
     * Creates our intake system.
     * @param joystick Joystick of which it is to be controlled by.
     * @param intakeMotorOne First belt motor.
     * @param intakeMotorTwo Second belt motor.
     * @param unobtaniumMotor Unobtanium motor.
     */
    public Intake(Joystick joystick, Victor beltMotorOne, Victor beltMotorTwo, Victor unobtaniumMotor) {
        this.joystick = joystick;
        this.beltMotorOne = beltMotorOne;
        this.beltMotorTwo = beltMotorTwo;
        this.unobtaniumMotor = unobtaniumMotor;

        intakeMode = 0;
        previousMode = 0;
    }

    /**
     * Perform the actions that the mode we are in requires.
     */
    public void doAction() {
        //TODO: Check whether these buttons are correct.

        double beltSpeed = 0;
        double unobtaniumSpeed = 0;

        //Set the mode of the system, based on our button input
        if (joystick.getRawButton(2)) {
            //Intake Button
            if (intakeMode == 1) {
                //Mode is at intake, ergo stop.
                intakeMode = 0;
            } else {
                //Mode is not at intake
                intakeMode = 1;
            }
        } else {
            //TODO: Put this function into a function

            //Reverse Button
            if (joystick.getRawButton(3)) {
                //Reverse button was hit
                previousMode = intakeMode;
                intakeMode = -1;
            } else if (!joystick.getRawButton(3) && intakeMode == -1) {
                //We don't want to be in reverse anymore
                intakeMode = previousMode;
                previousMode = 0;
            }
            //Fire Button
            if (joystick.getRawButton(1)) {
                //Fire button was hit
                previousMode = intakeMode;
                intakeMode = 2;
            } else if (!joystick.getRawButton(1) && intakeMode == 2) {
                //We don't want to be firing anymore
                intakeMode = previousMode;
                previousMode = 0;
            }
        }

        //Put our chosen mode into action!
        switch (intakeMode) {
            case -1:
                //Reverse mode
                beltSpeed = -1;
                unobtaniumSpeed = 0;
                break;
            case 0:
                //Stop mode
                beltSpeed = 0;
                unobtaniumSpeed = 0;
                break;
            case 1:
                //Intake mode
                beltSpeed = 1;
                unobtaniumSpeed = -0.5;
                break;
            case 2:
                //Fire mode
                beltSpeed = 1;
                unobtaniumSpeed = 1;
                break;
            default:
                //Ahhh! mode
                beltSpeed = 0;
                unobtaniumSpeed = 0;
                break;
        }

        //Put mode into action
        setBeltSpeed(beltSpeed);
        setUnobtaniumSpeed(unobtaniumSpeed);
    }

    /**
     * Set the speed of the both belt motors.
     * @param speed Value of motor speed from -1 to 1
     */
    public void setBeltSpeed(double speed) {
        //As a safety measure of un-tested code, the following line is commented out to prevent *boom*
        //beltMotorOne.set(speed);
        beltMotorTwo.set(speed);
    }

    /**
     * Set the speed of the unobtanium motor for easy access.
     * @param speed Value of motor speed from -1 to 1
     */
    public void setUnobtaniumSpeed(double speed) {
        unobtaniumMotor.set(speed);
    }
}
<commit_msg>Remove a few TODO's. Begin implementation of unobtanium motor pot control.<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package robot;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;

/**
 *
 * @author tanner
 */
public class Intake {
    //private enum mode {INTAKE, STOP, FIRE}

    private Joystick joystick;
    private Victor beltMotorOne, beltMotorTwo, unobtaniumMotor;
    private int intakeMode, previousMode;
    private DriverStation driverStation;

    /**
     * Creates our intake system.
     * @param joystick Joystick of which it is to be controlled by.
     * @param intakeMotorOne First belt motor.
     * @param intakeMotorTwo Second belt motor.
     * @param unobtaniumMotor Unobtanium motor.
     */
    public Intake(Joystick joystick, Victor beltMotorOne, Victor beltMotorTwo, Victor unobtaniumMotor) {
        this.joystick = joystick;
        this.beltMotorOne = beltMotorOne;
        this.beltMotorTwo = beltMotorTwo;
        this.unobtaniumMotor = unobtaniumMotor;

        intakeMode = 0;
        previousMode = 0;
        driverStation = DriverStation.getInstance();
    }

    /**
     * Perform the actions that the mode we are in requires.
     */
    public void doAction() {
        double beltSpeed = 0;
        double unobtaniumSpeed = 0;

        //Set the mode of the system, based on our button input
        if (joystick.getRawButton(2)) {
            //Intake Button
            if (intakeMode == 1) {
                //Mode is at intake, ergo stop.
                intakeMode = 0;
            } else {
                //Mode is not at intake
                intakeMode = 1;
            }
        } else {
            //TODO: Put this function into a function? Maybe...

            //Reverse Button
            if (joystick.getRawButton(3)) {
                //Reverse button was hit
                previousMode = intakeMode;
                intakeMode = -1;
            } else if (!joystick.getRawButton(3) && intakeMode == -1) {
                //We don't want to be in reverse anymore
                intakeMode = previousMode;
                previousMode = 0;
            }
            //Fire Button
            if (joystick.getRawButton(1)) {
                //Fire button was hit
                previousMode = intakeMode;
                intakeMode = 2;
            } else if (!joystick.getRawButton(1) && intakeMode == 2) {
                //We don't want to be firing anymore
                intakeMode = previousMode;
                previousMode = 0;
            }
        }

        //Put our chosen mode into action!
        //TODO: Make sure values are in the correct direction.
        switch (intakeMode) {
            case -1:
                //Reverse mode
                beltSpeed = -1;
                unobtaniumSpeed = 0;
                break;
            case 0:
                //Stop mode
                beltSpeed = 0;
                unobtaniumSpeed = 0;
                break;
            case 1:
                //Intake mode
                beltSpeed = 1;
                unobtaniumSpeed = -0.5;
                break;
            case 2:
                //Fire mode
                //More to it than this, but I can't find the formula
                beltSpeed = driverStation.getAnalogIn(1);
                unobtaniumSpeed = 1;
                break;
            default:
                //Ahhh! mode
                beltSpeed = 0;
                unobtaniumSpeed = 0;
                break;
        }

        //Put mode into action
        setBeltSpeed(beltSpeed);
        setUnobtaniumSpeed(unobtaniumSpeed);
    }

    /**
     * Set the speed of the both belt motors.
     * @param speed Value of motor speed from -1 to 1
     */
    public void setBeltSpeed(double speed) {
        //As a safety measure of un-tested code, the following line is commented out to prevent *boom*
        //beltMotorOne.set(speed);
        beltMotorTwo.set(speed);
    }

    /**
     * Set the speed of the unobtanium motor for easy access.
     * @param speed Value of motor speed from -1 to 1
     */
    public void setUnobtaniumSpeed(double speed) {
        unobtaniumMotor.set(speed);
    }
}

{'fraction_non_alphanumeric': 0.07987951807228916, 'fraction_numerical': 0.00891566265060241, 'mean_word_length': 1.453739284658587, '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': '1740260', 'n_tokens_mistral': 2497, 'n_tokens_neox': 2243, 'n_words': 715}