import org.usfirst.frc.team3501.robot.Robot;
-import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.command.Command;
/**
* This command runs the winch at a specified speed and time in seconds when the
- * button triggering it is pressed. This command also runs the drive train.
+ * 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.
*/
public class RunWinch extends Command {
- Timer timer;
private double time;
private double motorVal;
* @param time
* time in seconds to run the winch
* @param motorVal
- * value range is from -1 to 1
+ * value range is frosm -1 to 1
*/
public RunWinch(double time, double motorVal) {
requires(Robot.getDriveTrain());
@Override
protected void initialize() {
- timer.start();
}
@Override
@Override
protected boolean isFinished() {
- return timer.get() >= time;
+ return timeSinceInitialized() >= time;
}
@Override
protected void end() {
Robot.getDriveTrain().stop();
-
}
@Override