Add comment explain get Shooter Speed()
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / Shooter.java
index 22239e49ee945c5bd0a9a163d9a9da7160233db2..a9e8d6e8463f8ad341d96e7c1511acf1a45bdb42 100755 (executable)
@@ -2,9 +2,7 @@ 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.AnalogPotentiometer;
 import edu.wpi.first.wpilibj.CANTalon;
 import edu.wpi.first.wpilibj.CounterBase.EncodingType;
 import edu.wpi.first.wpilibj.DoubleSolenoid;
@@ -29,12 +27,10 @@ public class Shooter extends Subsystem {
   private Lidar lidar;
 
   public Shooter() {
-    leftLidar = new AnalogPotentiometer(0);
-    rightLidar = new AnalogPotentiometer(0);
     shooter = new CANTalon(Constants.Shooter.PORT);
     angleAdjuster = new CANTalon(Constants.Shooter.ANGLE_ADJUSTER_PORT);
-    punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD_PORT,
-        Constants.Shooter.PUNCH_REVERSE_PORT);
+    punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD,
+        Constants.Shooter.PUNCH_REVERSE);
 
     encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A,
         Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X);
@@ -69,6 +65,17 @@ public class Shooter extends Subsystem {
     return encoder.getRate();
   }
 
+  /*
+   * We are going to map a lidar distance to a shooter speed that will be set to
+   * the shooter. This function does not yet exist so we will just use y=x but
+   * when testing commences we shall create the function
+   */
+  public double getShooterSpeed() {
+    double distanceToGoal = lidar.getDistance();
+    double shooterSpeed = distanceToGoal; // Function to be determined
+    return shooterSpeed;
+  }
+
   // Use negative # for decrement. Positive for increment.
 
   public void changeSpeed(double change) {
@@ -88,13 +95,4 @@ public class Shooter extends Subsystem {
   @Override
   protected void initDefaultCommand() {
   }
-
-  public double getLeftDistanceToTower() {
-    // TODO: find the method that actually gets distance
-    return leftLidar.get();
-  }
-
-  public double getRightDistanceToTower() {
-    return rightLidar.get();
-  }
 }