Initialize photogate in shooter subsystem
authorniyatisriram <niyatisriram@gmail.com>
Wed, 17 Feb 2016 19:03:56 +0000 (11:03 -0800)
committerniyatisriram <niyatisriram@gmail.com>
Wed, 17 Feb 2016 19:03:56 +0000 (11:03 -0800)
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/sensors/Photogate.java
src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java

index 905844120d2bba3ebfbae9ace7670b060c4b0a83..8fd099fb2999081e999638cb08d2e46b9872297f 100644 (file)
@@ -2,7 +2,6 @@ package org.usfirst.frc.team3501.robot;
 
 import org.usfirst.frc.team3501.robot.Constants.Defense;
 import org.usfirst.frc.team3501.robot.sensors.GyroLib;
-import org.usfirst.frc.team3501.robot.sensors.Photogate;
 import org.usfirst.frc.team3501.robot.subsystems.DefenseArm;
 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
 import org.usfirst.frc.team3501.robot.subsystems.IntakeArm;
@@ -25,8 +24,6 @@ public class Robot extends IterativeRobot {
   public static IntakeArm intakeArm;
   public static DefenseArm defenseArm;
 
-  public static Photogate photogate;
-
   // Sendable Choosers send a drop down menu to the Smart Dashboard.
   SendableChooser positionChooser;
   SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense,
index b1d003988e908fd038a1d1c27453014612f0602e..c9f3d642fdabf1a74af6caee467d918ae3518aef 100644 (file)
@@ -2,9 +2,6 @@ package org.usfirst.frc.team3501.robot.sensors;
 
 import edu.wpi.first.wpilibj.AnalogInput;
 
-// TODO: Change certain reactions based on testing, ie what value(s) return true
-// and what value(s) return false.
-
 /***
  * The photogate is a pair of IR LED and phototransistor sensor that uses a
  * reflective method to sense the presence of the boulder within the robot's
@@ -44,7 +41,7 @@ public class Photogate extends AnalogInput {
 
   /***
    * @param threshold
-   *          (range [0, 4095]
+   *          (range [0, 4095])
    */
   public void setThreshold(int threshold) {
     this.threshold = threshold;
index bcce7bcdc2df74ff7de1491ff96cb5dc12d97b51..60452a0c9080bfe4bf61beb2c129ce0be2b37717 100755 (executable)
@@ -2,6 +2,7 @@ package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
 import org.usfirst.frc.team3501.robot.sensors.Lidar;
+import org.usfirst.frc.team3501.robot.sensors.Photogate;
 
 import edu.wpi.first.wpilibj.CANTalon;
 import edu.wpi.first.wpilibj.CounterBase.EncodingType;
@@ -25,6 +26,7 @@ public class Shooter extends Subsystem {
   private DoubleSolenoid hood, punch;
   private Encoder encoder;
   private Lidar lidar;
+  private Photogate photogate;
 
   public Shooter() {
     shooter = new CANTalon(Constants.Shooter.PORT);
@@ -45,7 +47,7 @@ public class Shooter extends Subsystem {
    */
 
   public boolean isBallInside() {
-    return true;
+    return photogate.isBallPresent();
   }
 
   public void setSpeed(double speed) {