X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fsubsystems%2FShooter.java;h=ab5eb66ffe6831db965cb078366dc21798e6f556;hb=95f05eb0afbbdf719de43f579b6d69e1758b1d3c;hp=3633c04ca10e2fea9e5c63a656427a86642eaea1;hpb=ee31518f357dbc4d63f2790938c0c71dcad088af;p=3501%2Fstronghold-2016 diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index 3633c04c..ab5eb66f 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -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; @@ -24,6 +25,8 @@ public class Shooter extends Subsystem { private DoubleSolenoid hood1, hood2, punch; private Encoder encoder; private Lidar lidar; + private Photogate photogate; + private boolean usePhotoGate; public Shooter() { shooter = new CANTalon(Constants.Shooter.PORT); @@ -36,6 +39,7 @@ public class Shooter extends Subsystem { encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A, Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X); + usePhotoGate = true; } /*** @@ -47,7 +51,10 @@ public class Shooter extends Subsystem { */ public boolean isBallInside() { - return true; + if (usePhotogate()) + return photogate.isBallPresent(); + else + return true; } public void setSpeed(double speed) { @@ -111,6 +118,14 @@ public class Shooter extends Subsystem { return false; } + public boolean usePhotogate() { + return this.usePhotoGate; + } + + public void togglePhotoGate() { + this.usePhotoGate = !this.usePhotoGate; + } + @Override protected void initDefaultCommand() { }