X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fclimber%2FRunWinch.java;h=39149abb14fba12c4c77e24d5aaf2d694da20bf6;hb=f74d236db406193b851bff99e4daec7b7abf35e7;hp=d6d047c98f53671e57a77ea9405c0961e0c49a65;hpb=de8c65d38fd643da973fd225808614b13fca9f45;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java index d6d047c..39149ab 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java @@ -1,13 +1,19 @@ package org.usfirst.frc.team3501.robot.commands.climber; import org.usfirst.frc.team3501.robot.Robot; - -import com.sun.glass.ui.Timer; +import org.usfirst.frc.team3501.robot.subsystems.Climber; import edu.wpi.first.wpilibj.command.Command; /** - * This command runs the winch for a given motor value and time in seconds + * 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 @@ -16,36 +22,46 @@ import edu.wpi.first.wpilibj.command.Command; * @author shivanighanta * */ + public class RunWinch extends Command { - Timer timer; + Climber climber = Robot.getClimber(); + private double time; private double motorVal; - public RunWinch(double time, double motorVal) { - requires(Robot.getClimber()); + /** + * 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() { + requires(climber); this.time = time; this.motorVal = motorVal; } @Override protected void initialize() { - timer.start(); - Robot.getClimber().setMotorValue(motorVal); + climber.setCANTalonsBrakeMode(climber.COAST_MODE); } @Override protected void execute() { - + climber.setMotorValues(climber.CLIMBER_SPEED); } @Override protected boolean isFinished() { - return timer.get() >= time; + // return timeSinceInitialized() >= time; + return false; } @Override protected void end() { - Robot.getClimber().stop(); + climber.stop(); } @Override