1 package org
.usfirst
.frc
.team3501
.robot
.commands
.climber
;
3 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
5 import edu
.wpi
.first
.wpilibj
.Timer
;
6 import edu
.wpi
.first
.wpilibj
.command
.Command
;
9 * This command runs the winch at a specified speed and time in seconds when the
10 * button triggering it is pressed. This command also makes the drive train
11 * motors run because the winch is controlled by the drive train.
13 * pre-condition: This command is run by a button in OI. The robot must be
14 * attached to the rope.
16 * post-condition: Winch motor set to a specified speed for a specified time.
18 * @author shivanighanta
22 public class RunWinch
extends Command
{
25 private double motorVal
;
28 * See JavaDoc comment in class for details
31 * time in seconds to run the winch
33 * value range is from -1 to 1
35 public RunWinch(double time
, double motorVal
) {
36 <<<<<<< a5147d5928f01620d8e10f2e9cdea079526d2db3
37 requires(Robot
.getDriveTrain());
39 requires(Robot
.getClimber());
40 >>>>>>> Implement RunWinch
42 this.motorVal
= motorVal
;
46 protected void initialize() {
48 <<<<<<< a5147d5928f01620d8e10f2e9cdea079526d2db3
50 Robot
.getClimber().setMotorValues(motorVal
, motorVal
);
51 >>>>>>> Implement RunWinch
55 protected void execute() {
56 Robot
.getDriveTrain().setMotorValues(motorVal
, motorVal
);
61 protected boolean isFinished() {
62 return timer
.get() >= time
;
66 protected void end() {
67 <<<<<<< a5147d5928f01620d8e10f2e9cdea079526d2db3
68 Robot
.getDriveTrain().stop();
71 Robot
.getClimber().stop();
72 >>>>>>> Implement RunWinch
76 protected void interrupted() {