<commit_before>// RobotBuilder Version: 0.0.2
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in th future.
package org.usfirst.frc330.Beachbot2013Java.commands;
import com.sun.squawk.util.MathUtils;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.buttons.NetworkButton;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.usfirst.frc330.Beachbot2013Java.Robot;
/**
 *
 */
public class  ControlLEDs extends Command {
    
    public ControlLEDs() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
	
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
        requires(Robot.vision);
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
        setRunWhenDisabled(true);
    }
    // Called just before this Command runs the first time
    protected void initialize() {
        Robot.vision.turnOffHighShooterLED();
        Robot.vision.turnOffLowShooterLED();
    }
    // Called repeatedly when this Command is scheduled to run
    protected void execute() {       
        if (Robot.vision.getLEDEnable() || DriverStation.getInstance().isFMSAttached())
        {              
            double gyroAngle = Robot.chassis.getAngle();
            while (gyroAngle > 180)
            {
                gyroAngle -= 360;  
            }
            while (gyroAngle < -180)
            {
                gyroAngle += 360;
            }
            SmartDashboard.putNumber("VisionGyroAngle: ",gyroAngle);
            //TODO: make a preference for angles. Currently +/- 45 deg for turning off and +/- 35 degrees for turning on
            if (Robot.vision.getHighLEDState())
            {
                if (gyroAngle < 135 || gyroAngle > -135)
                {
                    Robot.vision.turnOffHighShooterLED();
                }   
            }
            else
            {
                if (gyroAngle > 145 || gyroAngle < - 145)
                {
                    Robot.vision.turnOnHighShooterLED();
                }
            }
            
            if (Robot.vision.getLowLEDState())
            {
                if (gyroAngle > 45 || gyroAngle < -45)
                {
                    Robot.vision.turnOffLowShooterLED();
                }
            }
            else
            {
                if (gyroAngle < 35 && gyroAngle > -35)
                {
                    Robot.vision.turnOnLowShooterLED();
                }
            }
        }
        else if (Robot.vision.getLEDOverride())
        {
            Robot.vision.turnOnHighShooterLED();
            Robot.vision.turnOnLowShooterLED();
        }
        else
        {
            Robot.vision.turnOffHighShooterLED();
            Robot.vision.turnOffLowShooterLED();
        }
    }
    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }
    // Called once after isFinished returns true
    protected void end() {
    }
    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}<commit_msg>Made LEDOnangle and LEDOffangle preferences<commit_after>// RobotBuilder Version: 0.0.2
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in th future.
package org.usfirst.frc330.Beachbot2013Java.commands;
import com.sun.squawk.util.MathUtils;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Preferences;
import edu.wpi.first.wpilibj.buttons.NetworkButton;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.usfirst.frc330.Beachbot2013Java.Robot;
/**
 *
 */
public class  ControlLEDs extends Command {
    
    public ControlLEDs() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
	
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
        requires(Robot.vision);
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
        setRunWhenDisabled(true);
    }
    // Called just before this Command runs the first time
    double LEDOffangle = Robot.vision.turnOffLEDAngle();
    double LEDOnangle = Robot.vision.turnOnLEDAngle();
    protected void initialize() {
        Robot.vision.turnOffHighShooterLED();
        Robot.vision.turnOffLowShooterLED();
    }
    // Called repeatedly when this Command is scheduled to run
    protected void execute() {       
        if (Robot.vision.getLEDEnable() || DriverStation.getInstance().isFMSAttached())
        {              
            double gyroAngle = Robot.chassis.getAngle();
            while (gyroAngle > 180)
            {
                gyroAngle -= 360;  
            }
            while (gyroAngle < -180)
            {
                gyroAngle += 360;
            }
            SmartDashboard.putNumber("VisionGyroAngle: ",gyroAngle);
            //TODO: make a preference for angles. Currently +/- 45 deg for turning off and +/- 35 degrees for turning on
            if (Robot.vision.getHighLEDState())
            {
                if (gyroAngle < 180 - LEDOffangle || gyroAngle > -180 + LEDOffangle)
                {
                    Robot.vision.turnOffHighShooterLED();
                }   
            }
            else
            {
                if (gyroAngle > 180 - LEDOnangle || gyroAngle < -180 + LEDOnangle)
                {
                    Robot.vision.turnOnHighShooterLED();
                }
            }
            
            if (Robot.vision.getLowLEDState())
            {
                if (gyroAngle > LEDOffangle || gyroAngle < LEDOffangle)
                {
                    Robot.vision.turnOffLowShooterLED();
                }
            }
            else
            {
                if (gyroAngle < LEDOnangle && gyroAngle > -LEDOnangle)
                {
                    Robot.vision.turnOnLowShooterLED();
                }
            }
        }
        else if (Robot.vision.getLEDOverride())
        {
            Robot.vision.turnOnHighShooterLED();
            Robot.vision.turnOnLowShooterLED();
        }
        else
        {
            Robot.vision.turnOffHighShooterLED();
            Robot.vision.turnOffLowShooterLED();
        }
    }
    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }
    // Called once after isFinished returns true
    protected void end() {
    }
    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}
{'fraction_non_alphanumeric': 0.08569161597460989, 'fraction_numerical': 0.012959534514678656, 'mean_word_length': 1.7876889052709177, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6000079', 'n_tokens_mistral': 2194, 'n_tokens_neox': 2026, 'n_words': 546}