<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.slidellrobotics.reboundrumble.commands;

import com.slidellrobotics.reboundrumble.subsystems.TrackingCamera;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 *
 * @author 10491477
 */
public class FindAngle extends CommandBase {
    private static double lastTime = 0;
    private static double thisTime;
    private static double timeLapse;
    
    public FindAngle() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(lazySusan);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        if (TrackingCamera.targetGoal == null){
            lazySusan.setRelay(Relay.Value.kOff);   //turn off
            SmartDashboard.putString("LazySusan", "Off");
            System.out.println("No target set");
            return;
        }
        
        TrackingCamera.horCenter = (TrackingCamera.totalWidth / 2);     //Finds the pixel value of the horizontal center
        TrackingCamera.targetLocale = TrackingCamera.targetGoal.center_mass_x;        //Finds the center of our target
        TrackingCamera.targetDiff = Math.abs(TrackingCamera.targetLocale - TrackingCamera.horCenter); // see how far away we are

        //TODO: tune the 10 pixels to the right number
        //there is always going to be a little error, but we want some small window
        //where the lazy suzan stops moving to we can make an accurate shot.

        lastTime = Timer.getFPGATimestamp();
        if (TrackingCamera.targetDiff < 150) {
            lazySusan.setRelay(Relay.Value.kOff);   //turn off<commit_msg>Syncing Code<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.slidellrobotics.reboundrumble.commands;

import com.slidellrobotics.reboundrumble.subsystems.TrackingCamera;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 *
 * @author 10491477
 */
public class FindAngle extends CommandBase {
    private static double lastTime = 0;
    private static double thisTime;
    private static double timeLapse;
    
    public FindAngle() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(lazySusan);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        if (TrackingCamera.targetGoal == null){
            lazySusan.setRelay(Relay.Value.kOff);   //turn off
            SmartDashboard.putString("LazySusan", "Off");
            System.out.println("No target set");
            return;
        }
        
        TrackingCamera.horCenter = (TrackingCamera.totalWidth / 2);     //Finds the pixel value of the horizontal center
        TrackingCamera.targetLocale = TrackingCamera.targetGoal.center_mass_x;        //Finds the center of our target
        TrackingCamera.targetDiff = Math.abs(TrackingCamera.targetLocale - TrackingCamera.horCenter); // see how far away we are

        //TODO: tune the 10 pixels to the right number
        //there is always going to be a little error, but we want some small window
        //where the lazy suzan stops moving to we can make an accurate shot.

        lastTime = Timer.getFPGATimestamp();
        if (TrackingCamera.targetDiff < 15) {
            lazySusan.setRelay(Relay.Value.kOff);   //turn off
{'fraction_non_alphanumeric': 0.08657534246575342, 'fraction_numerical': 0.007945205479452055, 'mean_word_length': 2.763917525773196, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6201140', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1034, 'n_words': 308}