add skeleton code for calculating angle to turn for shooting
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / Shooter.java
index 3b91bfe03c451333cdcdd8ef2035071b71a6af3a..98131673509e3089bb5bf861062225cfe807423d 100755 (executable)
@@ -1,8 +1,6 @@
 package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
-import org.usfirst.frc.team3501.robot.Lidar;
-import org.usfirst.frc.team3501.robot.MathLib;
 
 import edu.wpi.first.wpilibj.CANTalon;
 import edu.wpi.first.wpilibj.CounterBase.EncodingType;
@@ -11,10 +9,11 @@ import edu.wpi.first.wpilibj.Encoder;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 /***
- * The Shooter consists of a platform and wheel, each controlled by separate
- * motors. The piston controlling the platform pushes the ball onto the wheel.
- * The wheel is controlled by a motor, which is running before the ball is
- * pushed onto the wheel. The spinning wheel propels the ball.
+ * The Shooter consists of a platform and wheel, each controlled by
+ * separate motors. The piston controlling the platform pushes the ball onto the
+ * wheel. The wheel is controlled by a motor, which is running before the ball
+ * is pushed
+ * onto the wheel. The spinning wheel propels the ball.
  *
  * @author superuser
  *
@@ -52,15 +51,12 @@ public class Shooter extends Subsystem {
   }
 
   public void setSpeed(double speed) {
-    speed = MathLib.constrain(speed, -1, 1);
-    shooter.set(speed);
-  }
-
-  // This getDistance() will return the distance using the lidar from the
-  // desired target during match. This distance is returned in units of
-  // CENTIMETERS.
-  public double getDistance() {
-    return lidar.getDistance();
+    if (speed > 1.0)
+      shooter.set(1.0);
+    else if (speed < -1.0)
+      shooter.set(-1.0);
+    else
+      shooter.set(speed);
   }
 
   public void stop() {
@@ -79,7 +75,7 @@ public class Shooter extends Subsystem {
   }
 
   // Punch Commands
-  public void punch() {
+  public void extendPunch() {
     punch.set(Constants.Shooter.punch);
   }