package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Servo;

/**
 * This class rotates the motor in the direction of the target, based on the
 * relative location of the target as determined by TargetLocator
 *
 * @author (Mark Macerato, Team 3167)
 * @version (March 2, 2014)
 */
class Motor {

    private double acceptableRange;  //The distance to the left or right of the target in inches that is acceptable
    private Servo motor = new Servo(1, 1);  //The Servo that controls the rotating motor that aligns with the target

    public void trackTheTarget() {  //Rotates the motor aligning with the target.  If the camera is too far to the left, it roates the motor right, and vice versa

        if (TargetLocator.getRelPositionOfTarget() > acceptableRange) {  //if the target is too far to the right

            motor.set(1.0);
            dirverStation.print("Turning right...");

        } else if (TargetLocator.getRelPositionOfTarget() < -acceptableRange) {  //if the target is too far to the left

            motor.set(0.0);
            dirverStation.print("Turning left...");
            
        } else if (TargetLocator.getRelPositionOfTarget() < acceptableRange && TargetLocator.getRelPositionOfTarget() > -acceptableRange) {  //If the camera is aligned

            motor.set(motor.get());
            dirverStation.print("Aligned!");

        }

    }
}

@@ -354,16 +354,23 @@
 bleRange
+ = 0.05
 ;  //The
@@ -561,16 +561,105 @@
  target%0D
+%0A    private TargetLocator targetLocator = new TargetLocator(); //Will locate the target%0D
 %0A%0D%0A    p
@@ -827,25 +827,25 @@
         if (
-T
+t
 argetLocator
@@ -845,32 +845,20 @@
 Locator.
-getRelPositionOf
+find
 Target()
@@ -998,24 +998,27 @@
 ng right...%22
+, 1
 );%0D%0A%0D%0A      
@@ -1022,33 +1022,33 @@
      %7D else if (
-T
+t
 argetLocator.get
@@ -1044,32 +1044,20 @@
 Locator.
-getRelPositionOf
+find
 Target()
@@ -1200,16 +1200,19 @@
 left...%22
+, 1
 );%0D%0A    
@@ -1240,17 +1240,17 @@
 lse if (
-T
+t
 argetLoc
@@ -1254,32 +1254,20 @@
 Locator.
-getRelPositionOf
+find
 Target()
@@ -1288,17 +1288,17 @@
 ange && 
-T
+t
 argetLoc
@@ -1306,24 +1306,12 @@
 tor.
-getRelPositionOf
+find
 Targ
@@ -1447,16 +1447,19 @@
 ligned!%22
+, 1
 );%0D%0A%0D%0A  
@@ -1465,16 +1465,170 @@
        %7D
+ else if(targetLocator.findTarget() == 0.0) %7B //If nothing is found%0D%0A            %0D%0A            dirverStation.print(%22No target%22, 1);%0D%0A%0D%0A        %7D%0D%0A        
 %0D%0A%0D%0A    

Update Motor.java