From 49b6d711db3054dfd4e852af572d9212a5a8bf02 Mon Sep 17 00:00:00 2001 From: niyatisriram Date: Wed, 17 Feb 2016 11:03:56 -0800 Subject: [PATCH] Initialize photogate in shooter subsystem --- src/org/usfirst/frc/team3501/robot/Robot.java | 5 +---- src/org/usfirst/frc/team3501/robot/sensors/Photogate.java | 5 +---- src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java | 4 +++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 99f66213..80d78676 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -1,7 +1,6 @@ package org.usfirst.frc.team3501.robot; import org.usfirst.frc.team3501.robot.Constants.Defense; -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; @@ -23,12 +22,10 @@ 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, - positionFourDefense, positionFiveDefense; + positionFourDefense, positionFiveDefense; @Override public void robotInit() { diff --git a/src/org/usfirst/frc/team3501/robot/sensors/Photogate.java b/src/org/usfirst/frc/team3501/robot/sensors/Photogate.java index b1d00398..c9f3d642 100644 --- a/src/org/usfirst/frc/team3501/robot/sensors/Photogate.java +++ b/src/org/usfirst/frc/team3501/robot/sensors/Photogate.java @@ -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; diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index 3633c04c..0d9187a4 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,7 @@ public class Shooter extends Subsystem { private DoubleSolenoid hood1, hood2, punch; private Encoder encoder; private Lidar lidar; + private Photogate photogate; public Shooter() { shooter = new CANTalon(Constants.Shooter.PORT); @@ -47,7 +49,7 @@ public class Shooter extends Subsystem { */ public boolean isBallInside() { - return true; + return photogate.isBallPresent(); } public void setSpeed(double speed) { -- 2.30.2