Saved
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinchContinuous.java
index bb2a74e8398aeefc7a2a104a01822af6197b1967..664b201643b113a16b7944a1223d541b3bcb5ee3 100644 (file)
@@ -1,50 +1,56 @@
 package org.usfirst.frc.team3501.robot.commands.climber;
 
+import org.usfirst.frc.team3501.robot.OI;
 import org.usfirst.frc.team3501.robot.Robot;
+import org.usfirst.frc.team3501.robot.subsystems.Climber;
 
 import edu.wpi.first.wpilibj.command.Command;
 
 /**
- * This command will run the winch motor continuously until the button
- * triggering it is released.
+ * This command runs the drive train motors (which runs the winch) continuously
+ * at a specified speed until the button triggering it is released
  *
- * pre-condition: This command must be run by a button in OI. The robot must be
- * attached to the rope.
+ * pre-condition: This command must be run by a button in OI with
+ * button.whileHeld(...). The robot must be attached to the rope.
  *
- * post-condition: Winch motor set to a specified speed.
- *
- * @param motorVal
- *          value range is from -1 to 1
+ * post-condition: Drive train motors set to a specified speed.
  *
  * @author shivanighanta
  *
  */
 public class RunWinchContinuous extends Command {
-  private double motorVal;
-
-  public RunWinchContinuous(double motorVal) {
-    this.motorVal = motorVal;
+  Climber climber = Robot.getClimber();
+  private double climbingSpeed;
+
+  /**
+   * See JavaDoc comment in class for details
+   *
+   * @param motorVal
+   *          value range is from -1 to 1
+   */
+  public RunWinchContinuous() {
+    requires(climber);
+    climbingSpeed = climber.CLIMBER_SPEED;
   }
 
   @Override
   protected void initialize() {
-    Robot.getClimber().setMotorValue(motorVal);
-
   }
 
   @Override
   protected void execute() {
-
+    double thrust = OI.xboxController.getY();
+    climber.setMotorValues(-thrust);
   }
 
   @Override
   protected boolean isFinished() {
-    return !Robot.getOI().toggleWinch.get();
+    return false;
   }
 
   @Override
   protected void end() {
-    Robot.getClimber().stop();
+    climber.stop();
   }
 
   @Override