package org.usfirst.frc178.custom;

import org.usfirst.frc178.components.*;
import org.usfirst.frc178.devices.*;

public class VisionProcessing implements Runnable {

	private Drivetrain drivetrain;
	private Shooter shooter;
	private HumanControl humanControl;
	private OculusClient oculusClient;

	public VisionProcessing(Drivetrain drivetrain, Shooter shooter, HumanControl humanControl, OculusClient oculusClient) {
		this.drivetrain = drivetrain;
		this.shooter = shooter;
		this.humanControl = humanControl;
		this.oculusClient = oculusClient;
	}

	public void run() {
		while(true) {
			if (humanControl.joystickMain.getTrigger()) { // X
				this.turn();
			}
		}
	}

	public void turn() {
		String str_x = oculusClient.request().substring(0, 5);
		double x = Double.parseDouble(str_x);
		drivetrain.turn(x);
	}

}
@@ -107,16 +107,49 @@
 ces.*;%0A%0A
+import edu.wpi.first.wpilibj.*;%0A%0A
 public c
@@ -324,16 +324,67 @@
 lient;%0A%0A
+%09private Timer timer;%0A%09private boolean connected;%0A%0A
 %09public 
@@ -625,16 +625,94 @@
 sClient;
+%0A%0A%09%09this.timer = new Timer();%0A%09%09this.connected = false;%0A%0A%09%09this.timer.start();
 %0A%09%7D%0A%0A%09pu
@@ -729,16 +729,17 @@
 run() %7B%0A
+%0A
 %09%09while(
@@ -746,16 +746,170 @@
 true) %7B%0A
+%09%09%09if (this.timer.get() %3C 5 && !this.connected) %7B%0A%09%09%09%09this.oculusClient.connect();%0A%09%09%09%09this.connected = true;%0A%09%09%09%09System.out.println(%22connecting%22);%0A%09%09%09%7D%0A%0A
 %09%09%09if (h

Connect after 5 seconds