From 09e509d3b1f6e73a06d62e41c5a959e6eed2e5c6 Mon Sep 17 00:00:00 2001 From: Nadia Anees Date: Fri, 10 Feb 2017 20:02:26 -0800 Subject: [PATCH] Implement getter and setter methods for current shooting speed --- .../robot/commands/shooter/DecreaseShootingSpeed.java | 4 ++-- .../robot/commands/shooter/IncreaseShootingSpeed.java | 3 ++- .../robot/commands/shooter/ResetShootingSpeed.java | 2 +- .../frc/team3501/robot/commands/shooter/RunFlyWheel.java | 2 +- .../robot/commands/shooter/RunFlyWheelContinuous.java | 2 +- .../usfirst/frc/team3501/robot/subsystems/Shooter.java | 8 ++++++++ 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java index 3bd4efd..2edc9ec 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java @@ -21,8 +21,8 @@ public class DecreaseShootingSpeed extends Command { @Override protected void initialize() { - shooter.CURRENT_SHOOTING_SPEED -= shooter.SHOOTING_SPEED_INCREMENT; - + shooter.setCurrentShootingSpeed( + shooter.getCurrentShootingSpeed() - shooter.SHOOTING_SPEED_INCREMENT); } @Override diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java index 85bd3bd..dcd4aa7 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java @@ -21,7 +21,8 @@ public class IncreaseShootingSpeed extends Command { @Override protected void initialize() { - shooter.CURRENT_SHOOTING_SPEED += shooter.SHOOTING_SPEED_INCREMENT; + shooter.setCurrentShootingSpeed( + shooter.getCurrentShootingSpeed() + shooter.SHOOTING_SPEED_INCREMENT); } @Override diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/ResetShootingSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/ResetShootingSpeed.java index 7a2f950..d8f0162 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/ResetShootingSpeed.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/ResetShootingSpeed.java @@ -20,7 +20,7 @@ public class ResetShootingSpeed extends Command { @Override protected void initialize() { - shooter.CURRENT_SHOOTING_SPEED = shooter.DEFAULT_SHOOTING_SPEED; + shooter.setCurrentShootingSpeed(shooter.DEFAULT_SHOOTING_SPEED); } @Override diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheel.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheel.java index a20af8e..442897a 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheel.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheel.java @@ -34,7 +34,7 @@ public class RunFlyWheel extends Command { this.wheelController.setDoneRange(0.5); this.wheelController.setMaxOutput(1.0); this.wheelController.setMinDoneCycles(3); - this.target = this.shooter.CURRENT_SHOOTING_SPEED; + this.target = this.shooter.getCurrentShootingSpeed(); } // Called just before this Command runs the first time diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java index 2ae906c..ff4f659 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java @@ -36,7 +36,7 @@ public class RunFlyWheelContinuous extends Command { this.wheelController.setDoneRange(0.5); this.wheelController.setMaxOutput(1.0); this.wheelController.setMinDoneCycles(3); - this.target = this.shooter.CURRENT_SHOOTING_SPEED; + this.target = this.shooter.getCurrentShootingSpeed(); } @Override diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index 4869775..b9ccb42 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -79,6 +79,14 @@ public class Shooter extends Subsystem { indexWheel.set(0); } + public double getCurrentShootingSpeed() { + return CURRENT_SHOOTING_SPEED; + } + + public void setCurrentShootingSpeed(double Value) { + CURRENT_SHOOTING_SPEED = Value; + } + @Override protected void initDefaultCommand() { -- 2.30.2