<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.wpi.first.wpilibj.templates;

/**
 *
 * @author Tyler
 */
public class RobotAuton {
    
    public static double averageEncoder;
    
    public static void autonOne() {
    }
    
    public static void update() {
	averageEncoder = (RobotSensors.leftDriveEncoder.get() + RobotSensors.rightDriveEncoder.get())/2.0;
    }
}<commit_msg>RobotAuton<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Timer;


/**
 *
 * @author Tyler
 */
public class RobotAuton {
    
    //// VARIABLES -------------------------------------------------------------
    public static double averageEncoder;
    public static double distanceMultiplier;
    public static final double STRAIGHT_DISTANCE = 50; // needs to be found in testing
    public static final int SHOOTER_TOLERANCE = 2;
    public static boolean movingBack;
    public static boolean atPosition;
    public static boolean shot;
    public static Timer time;
    
    // initiates everything
    public static void initiate() {
	averageEncoder = 0.0;
	time = new Timer();
	time.start();
    }
    
    // does auton #1
    public static void autonOne() {
	atPosition = (STRAIGHT_DISTANCE < averageEncoder);
	if (!atPosition && !movingBack) {
	    RobotDrive.driveStraight(1.0);
	    RobotPickup.moveToCatchPosition();
	} else if (atPosition && !movingBack) {
	    RobotDrive.stop();
	    shoot();
	} else if (movingBack) {
	    RobotDrive.driveStraight(-1.0);
	}
	
	if (shot && distanceMultiplier * STRAIGHT_DISTANCE < averageEncoder) {
	    movingBack = true;
	}
    }
    
    // update method
    public static void update() {
	averageEncoder = (RobotSensors.leftDriveEncoder.get() + RobotSensors.rightDriveEncoder.get())/2.0;
    }
    
    // shoots
    private static void shoot() {
	if ((Vision.isHot() || time.get() >= 5) && pickupInRange()) {
	    RobotShoot.automatedShoot();
	}
	shot = true;
    }
    
    // tells whether or not the pickup system is in a tollerable range
    private static boolean pickupInRange() {
	return (RobotSensors.pickupSystemEncoder.get() + SHOOTER_TOLERANCE < RobotPickup.TARGET_SHOOT_POSITION && RobotSensors.pickupSystemEncoder.get() - SHOOTER_TOLERANCE > RobotPickup.TARGET_SHOOT_POSITION);
    }
}
{'fraction_non_alphanumeric': 0.12356979405034325, 'fraction_numerical': 0.005720823798627002, 'mean_word_length': 2.968229954614221, 'pattern_counts': {'":': 0, '<': 6, '<?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': '4668051', 'n_tokens_mistral': 839, 'n_tokens_neox': 794, 'n_words': 217}