<commit_before>/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.templates.Autons.*;
import java.util.Calendar;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class MainRobot extends IterativeRobot {

	public static String logData = "";
	public static boolean shooterInManualMode = false;
	public static boolean targetInManualMode = true;
	public static boolean previousShooterLeft = false;
	public static boolean previousShooterRight = false;
	
	public static Timer timer;
	public static int frames;

	/**
	 * This function is run when the robot is first started up and should be
	 * used for any initialization code.
	 */
	public void robotInit() {
		RobotActuators.initialize();
		RobotSensors.initialize();
		RobotDrive.initialize();
		RobotPickup.initialize();
		RobotShoot.initialize();
		RobotVision.initialize();
		RobotAuton.initialize();
		ControlBox.initialize();
		System.out.println("Initialized");
		//// ADDED: UNDERGLOW FROM THE LINE BELOW
		RobotLights.underglowOn();
	}

	/**
	 * This function is called periodically during autonomous
	 */
	public void autonomousPeriodic() {
		RobotShoot.useAutomatic();
		runCompressor();
		RobotAuton.update();
		RobotDrive.update();
		RobotPickup.update();													// TODO: UNDISABLE WHEN IT CAN DRIVE AGAIN
		RobotShoot.update();
		DashboardPut.put();
	}

	public void teleopInit() {
		SmartDashboard.putNumber("Target Ticks", 1200);
		RobotDrive.enableSmoothing();
		RobotLights.underglowOn();
		timer = new Timer();
		timer.start();
		frames = 0;
	}

	public void disabledInit() {
		StandardOneBallAuton.timer.stop();
		StandardOneBallAuton.timer.reset();
		StandardOneBallAuton.secondTimer.stop();
		StandardOneBallAuton.secondTimer.reset();
		RobotLights.underglowOn();
	}

	/**
	 * This function is called periodically during operator control
	 */
	public void teleopPeriodic() {
		frames++;
		System.out.println("FPS: " + frames / timer.get());
		if (RobotShoot.gameTime.get() == 0) {
			RobotShoot.gameTime.start();
		}

		//SmartDashboard.putBoolean("shooter AUTO ENCODER", ControlBox.getTopSwitch(3));
		if (!targetInManualMode) {
			//Automatic targetting Mode (Using camera to figure out encoder)
			RobotShoot.setTargetTicks(RobotVision.getEncoder());
			// reinstated the vision's encoder
			//RobotShoot.setTargetTicks(1300);
		} else {
			//Manual targetting mode (using driver to tap left and right)
			if (Gamepad.secondary.getA()) {
				RobotShoot.setTargetTicks(1000);
			}
			if (Gamepad.secondary.getB()) {
				RobotShoot.setTargetTicks(1300);
			}

			if (Gamepad.secondary.getLeftX() < -.8 && !previousShooterLeft) {
				previousShooterLeft = true;
				RobotShoot.adjustTargetDown();
			} else {
				previousShooterLeft = false;
			}
			if (Gamepad.secondary.getLeftX() > .8 && !previousShooterRight) {
				previousShooterRight = true;
				RobotShoot.adjustTargetUp();
			} else {
				previousShooterRight = false;
			}
		}

		ControlBox.update();
		RobotDrive.update();
		RobotPickup.update();
		RobotShoot.update();

		RobotPickup.moveToShootPosition();

		RobotTeleop.update();
		//SmartDashboard.putBoolean("TOP SWITCH TWO", ControlBox.getTopSwitch(2));
		if (!shooterInManualMode) {
			RobotShoot.useAutomatic();
		} else {
			RobotShoot.useManual();
		}

		if (Gamepad.secondary.getBack()) {
			shooterInManualMode = true;
		}
		if (Gamepad.secondary.getStart()) {
			shooterInManualMode = false;
		}
		if (Gamepad.primary.getBack()) {
			targetInManualMode = true;
		}
		if (Gamepad.primary.getStart()) {
			targetInManualMode = false;
		}

		if (Gamepad.secondary.getA() && Gamepad.secondary.getB()) {
			RobotShoot.zeroedBefore = false;<commit_msg>Moved Zero Control from 2ndary A,B to 1ary X,Y<commit_after>/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.templates.Autons.*;
import java.util.Calendar;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class MainRobot extends IterativeRobot {

	public static String logData = "";
	public static boolean shooterInManualMode = false;
	public static boolean targetInManualMode = true;
	public static boolean previousShooterLeft = false;
	public static boolean previousShooterRight = false;
	public static Timer timer;
	public static int frames;

	/**
	 * This function is run when the robot is first started up and should be
	 * used for any initialization code.
	 */
	public void robotInit() {
		RobotActuators.initialize();
		RobotSensors.initialize();
		RobotDrive.initialize();
		RobotPickup.initialize();
		RobotShoot.initialize();
		RobotVision.initialize();
		RobotAuton.initialize();
		ControlBox.initialize();
		System.out.println("Initialized");
		//// ADDED: UNDERGLOW FROM THE LINE BELOW
		RobotLights.underglowOn();
	}

	/**
	 * This function is called periodically during autonomous
	 */
	public void autonomousPeriodic() {
		RobotShoot.useAutomatic();
		runCompressor();
		RobotAuton.update();
		RobotDrive.update();
		RobotPickup.update();													// TODO: UNDISABLE WHEN IT CAN DRIVE AGAIN
		RobotShoot.update();
		DashboardPut.put();
	}

	public void teleopInit() {
		SmartDashboard.putNumber("Target Ticks", 1200);
		RobotDrive.enableSmoothing();
		RobotLights.underglowOn();
		timer = new Timer();
		timer.start();
		frames = 0;
	}

	public void disabledInit() {
		StandardOneBallAuton.timer.stop();
		StandardOneBallAuton.timer.reset();
		StandardOneBallAuton.secondTimer.stop();
		StandardOneBallAuton.secondTimer.reset();
		RobotLights.underglowOn();
	}

	/**
	 * This function is called periodically during operator control
	 */
	public void teleopPeriodic() {
		frames++;
		System.out.println("FPS: " + frames / timer.get());
		if (RobotShoot.gameTime.get() == 0) {
			RobotShoot.gameTime.start();
		}

		//SmartDashboard.putBoolean("shooter AUTO ENCODER", ControlBox.getTopSwitch(3));
		if (!targetInManualMode) {
			//Automatic targetting Mode (Using camera to figure out encoder)
			RobotShoot.setTargetTicks(RobotVision.getEncoder());
			// reinstated the vision's encoder
			//RobotShoot.setTargetTicks(1300);
		} else {
			//Manual targetting mode (using driver to tap left and right)
			if (Gamepad.secondary.getA()) {
				RobotShoot.setTargetTicks(1000);
			}
			if (Gamepad.secondary.getB()) {
				RobotShoot.setTargetTicks(1300);
			}

			if (Gamepad.secondary.getLeftX() < -.8 && !previousShooterLeft) {
				previousShooterLeft = true;
				RobotShoot.adjustTargetDown();
			} else {
				previousShooterLeft = false;
			}
			if (Gamepad.secondary.getLeftX() > .8 && !previousShooterRight) {
				previousShooterRight = true;
				RobotShoot.adjustTargetUp();
			} else {
				previousShooterRight = false;
			}
		}

		ControlBox.update();
		RobotDrive.update();
		RobotPickup.update();
		RobotShoot.update();

		RobotPickup.moveToShootPosition();

		RobotTeleop.update();
		//SmartDashboard.putBoolean("TOP SWITCH TWO", ControlBox.getTopSwitch(2));
		if (!shooterInManualMode) {
			RobotShoot.useAutomatic();
		} else {
			RobotShoot.useManual();
		}

		if (Gamepad.secondary.getBack()) {
			shooterInManualMode = true;
		}
		if (Gamepad.secondary.getStart()) {
			shooterInManualMode = false;
		}
		if (Gamepad.primary.getBack()) {
			targetInManualMode = true;
		}
		if (Gamepad.primary.getStart()) {
			targetInManualMode = false;
		}

		if (Gamepad.primary.getX() && Gamepad.primary.getY()) {
			RobotShoot.zeroedBefore = false;
{'fraction_non_alphanumeric': 0.1459870086975669, 'fraction_numerical': 0.0059451722999009134, 'mean_word_length': 3.115994562754871, 'pattern_counts': {'":': 0, '<': 5, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '978515', 'n_tokens_mistral': 3175, 'n_tokens_neox': 2735, 'n_words': 669}