From: EvanYap Date: Thu, 21 Jan 2016 04:46:48 +0000 (-0800) Subject: Make style edits X-Git-Url: http://challenge-bot.com/repos/?a=commitdiff_plain;h=8e5f83d9a921e04739ad20e468ec6b4c1ef345f7;hp=7a94939429ce650be29d217a3d3206201346436e;p=3501%2Fstronghold-2016 Make style edits --- diff --git a/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java b/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java index b4b24234..a256bad4 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java +++ b/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java @@ -16,6 +16,7 @@ public class ShooterTest extends Command { @Override protected void initialize() { + Robot.shooter.setSpeed(0.5); } @Override @@ -34,11 +35,11 @@ public class ShooterTest extends Command { } if (leftSidePressed == true) { - Robot.shooter.setDecrementSpeed(0.1); + Robot.shooter.decrementSpeed(0.1); } if (rightSidePressed == true) { - Robot.shooter.setIncrementSpeed(0.1); + Robot.shooter.incrementSpeed(0.1); } if (thumbPressed == true) { diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index 614fe059..c562b20a 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -20,30 +20,29 @@ public class Shooter extends Subsystem { wheel.set(speed); } - public void setIncrementSpeed(double increment) { - double newSpeed = getCurrentSpeed() + increment; - - if (getCurrentSpeed() >= 1.0) { + public void incrementSpeed(double increment) { + if (getCurrentSpeed() >= 1.0) wheel.set(1.0); - } else if (getCurrentSpeed() <= -1.0) { + else if (getCurrentSpeed() <= -1.0) wheel.set(-1.0); + else { + double newSpeed = getCurrentSpeed() + increment; + wheel.set(newSpeed); } - - wheel.set(newSpeed); } // THIS DECREMENT METHOD TAKES ONLY POSITIVE VALUES SINCE IT ACCOUNTS FOR // SUBTRACTING THE CURRENT MOTOR SPEED! - public void setDecrementSpeed(double decrement) { - double newSpeed = getCurrentSpeed() - decrement; + public void decrementSpeed(double decrement) { - if (getCurrentSpeed() >= 1.0) { + if (getCurrentSpeed() >= 1.0) wheel.set(1.0); - } else if (getCurrentSpeed() <= -1.0) { + else if (getCurrentSpeed() <= -1.0) wheel.set(-1.0); + else { + double newSpeed = getCurrentSpeed() - decrement; + wheel.set(newSpeed); } - - wheel.set(newSpeed); } @Override