delete angleAdjuster(cantalon), add hood(double solenoid) and methods for hood
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / Shooter.java
index 40a227ce1cb205bd192d4e4731e546e2cda17bfa..f547ab0ee84fa2ae9399eb75898534218615ba07 100755 (executable)
@@ -1,8 +1,8 @@
 package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.sensors.Lidar;
 
-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;
@@ -26,8 +26,6 @@ public class Shooter extends Subsystem {
   private Lidar lidar;
 
   public Shooter() {
-    leftLidar = new AnalogPotentiometer(0);
-    rightLidar = new AnalogPotentiometer(0);
     shooter = new CANTalon(Constants.Shooter.PORT);
     hood = new DoubleSolenoid(Constants.Shooter.HOOD_FORWARD,
         Constants.Shooter.HOOD_REVERSE);
@@ -36,8 +34,6 @@ public class Shooter extends Subsystem {
 
     encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A,
         Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X);
-
-    lidar = new Lidar(Constants.Shooter.LIDAR_I2C_PORT);
   }
 
   /***
@@ -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) {
@@ -85,15 +92,11 @@ public class Shooter extends Subsystem {
     punch.set(Constants.Shooter.retract);
   }
 
-  @Override
-  protected void initDefaultCommand() {
-  }
-
-  public void openHood() {
+  public void raiseHood() {
     hood.set(Constants.Shooter.open);
   }
 
-  public void closeHood() {
+  public void lowerHood() {
     hood.set(Constants.Shooter.closed);
   }