add commands to run winches continuously
authorLauren Meier <meier.lauren@gmail.com>
Tue, 9 Feb 2016 04:08:43 +0000 (20:08 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 00:22:19 +0000 (16:22 -0800)
src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java [new file with mode: 0644]

diff --git a/src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java
new file mode 100644 (file)
index 0000000..6993527
--- /dev/null
@@ -0,0 +1,39 @@
+package org.usfirst.frc.team3501.robot.commands;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class WinchRobotDownContinuous extends Command {
+  double winchDownSpeed;
+
+  public WinchRobotDownContinuous(double speed) {
+    winchDownSpeed = speed;
+    if (winchDownSpeed > 1)
+      winchDownSpeed = 1;
+    if (winchDownSpeed < -1)
+      winchDownSpeed = -1;
+  }
+
+  @Override
+  protected void initialize() {
+    Robot.scaler.runWinch(winchDownSpeed);
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+  }
+
+  @Override
+  protected void interrupted() {
+  }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java
new file mode 100644 (file)
index 0000000..ea35f24
--- /dev/null
@@ -0,0 +1,39 @@
+package org.usfirst.frc.team3501.robot.commands;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class WinchRobotUpContinuous extends Command {
+  double winchUpSpeed;
+
+  public WinchRobotUpContinuous(double speed) {
+    winchUpSpeed = speed;
+    if (winchUpSpeed > 1)
+      winchUpSpeed = 1;
+    if (winchUpSpeed < -1)
+      winchUpSpeed = -1;
+  }
+
+  @Override
+  protected void initialize() {
+    Robot.scaler.runWinch(winchUpSpeed);
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+  }
+
+  @Override
+  protected void interrupted() {
+  }
+}