<commit_before>package org.usfirst.frc2832.Robot2017.autonCommands;

import org.usfirst.frc2832.Robot2017.DriveEncoders;
import org.usfirst.frc2832.Robot2017.Robot;
import org.usfirst.frc2832.Robot2017.subsystems.DriveTrain;
import org.usfirst.frc2832.Robot2017.subsystems.NavX;

import edu.wpi.first.wpilibj.command.Command;

/**
 *
 */
public class RotateNavX extends Command {

	private double rot, initDeg;
	
    public RotateNavX(double rot) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis)
    	this.rot = rot;
    	requires(Robot.driveTrain);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    	//System.out.println("RotateNavX Start");
    	initDeg = NavX.getHeading();
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	if(rot > 0) {
    		DriveTrain.robotDrive.arcadeDrive(0.1, 0.6);
    		//Robot.driveTrain.setTankDriveCommand(0.5, -0.5);
    		//System.out.println(">");
    		//Robot.driveTrain.setTankDriveCommand(-0.2 * (rot - initDeg), 0.2 * (initDeg - rot));
    	} else {
    		DriveTrain.robotDrive.arcadeDrive(0.1, -0.6);
    		//Robot.driveTrain.setTankDriveCommand(-0.5, 0.5);
    		//System.out.println("<");
    		//Robot.driveTrain.setTankDriveCommand(-0.2 * (initDeg - rot), 0.2 * (initDeg - rot));
    	}
    	System.out.println(NavX.getHeading() + ":	" + initDeg + ":	" + rot);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
    	if (rot > 0) {
    		return NavX.getHeading() > normalize(initDeg + rot);
    	} else {
    		return NavX.getHeading() < normalize(initDeg + rot);
    	}
    }<commit_msg>Added debugging. End condition will fail in certain start positions, need to review math.<commit_after>package org.usfirst.frc2832.Robot2017.autonCommands;

import org.usfirst.frc2832.Robot2017.DriveEncoders;
import org.usfirst.frc2832.Robot2017.Robot;
import org.usfirst.frc2832.Robot2017.subsystems.DriveTrain;
import org.usfirst.frc2832.Robot2017.subsystems.NavX;

import edu.wpi.first.wpilibj.command.Command;

/**
 *
 */
public class RotateNavX extends Command {

	private double rot, initDeg;
	
    public RotateNavX(double rot) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis)
    	this.rot = rot;
    	requires(Robot.driveTrain);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    	//System.out.println("RotateNavX Start");
    	initDeg = NavX.getHeading();
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	if(rot > 0) {
    		DriveTrain.robotDrive.arcadeDrive(0.1, 0.6);
    		//Robot.driveTrain.setTankDriveCommand(0.5, -0.5);
    		//System.out.println(">");
    		//Robot.driveTrain.setTankDriveCommand(-0.2 * (rot - initDeg), 0.2 * (initDeg - rot));
    	} else {
    		DriveTrain.robotDrive.arcadeDrive(0.1, -0.6);
    		//Robot.driveTrain.setTankDriveCommand(-0.5, 0.5);
    		//System.out.println("<");
    		//Robot.driveTrain.setTankDriveCommand(-0.2 * (initDeg - rot), 0.2 * (initDeg - rot));
    	}
    	//System.out.println(NavX.getHeading() + ":	" + initDeg + ":	" + rot);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
    	if (rot > 0) {
    		return NavX.getHeading() > normalize(initDeg + rot);
    	} else {
    		return NavX.getHeading() < normalize(initDeg + rot);
    	}
    }
{'fraction_non_alphanumeric': 0.13656509695290858, 'fraction_numerical': 0.03656509695290859, 'mean_word_length': 2.882795698924731, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 11, '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': '3955511', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1261, 'n_words': 253}