From: Nadia Anees Date: Sat, 11 Feb 2017 04:02:26 +0000 (-0800) Subject: Implement getter and setter methods for current shooting speed X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=commitdiff_plain;h=09e509d3b1f6e73a06d62e41c5a959e6eed2e5c6 Implement getter and setter methods for current shooting speed --- 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() {