Initialize timer
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinch.java
index 028e33a23a314fa3fc05329f432e6c30c8617d17..2428aff2345244364035e842c40042626d27c74d 100644 (file)
@@ -2,23 +2,43 @@ package org.usfirst.frc.team3501.robot.commands.climber;
 
 import org.usfirst.frc.team3501.robot.Robot;
 
-import com.sun.glass.ui.Timer;
-
+import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
 
 /**
- * Runs the winch for a given time and motor value
+ * This command runs the winch at a specified speed and time in seconds when the
+ * button triggering it is pressed. This command also makes the drive train
+ * motors run because the winch is controlled by the drive train.
+ *
+ * pre-condition: This command is run by a button in OI. The robot must be
+ * attached to the rope.
  *
+ * post-condition: Winch motor set to a specified speed for a specified time.
+ *
+ * @param motorVal
+ *          value range is from -1 to 1
+ * @param time
+ *          in seconds
  * @author shivanighanta
  *
  */
+
 public class RunWinch extends Command {
   Timer timer;
   private double time;
   private double motorVal;
 
+  /**
+   * See JavaDoc comment in class for details
+   *
+   * @param time
+   *          time in seconds to run the winch
+   * @param motorVal
+   *          value range is from -1 to 1
+   */
   public RunWinch(double time, double motorVal) {
-    requires(Robot.getClimber());
+    requires(Robot.getDriveTrain());
+    timer = new Timer();
     this.time = time;
     this.motorVal = motorVal;
   }
@@ -26,11 +46,11 @@ public class RunWinch extends Command {
   @Override
   protected void initialize() {
     timer.start();
-    Robot.getClimber().setMotorValues(motorVal, motorVal);
   }
 
   @Override
   protected void execute() {
+    Robot.getDriveTrain().setMotorValues(motorVal, motorVal);
 
   }
 
@@ -41,7 +61,7 @@ public class RunWinch extends Command {
 
   @Override
   protected void end() {
-    Robot.getClimber().stop();
+    Robot.getDriveTrain().stop();
   }
 
   @Override