X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fclimber%2FRunWinch.java;h=5a76b5c182b377c6892b64c75572ca0857fa44ec;hb=150f450f2b4f9e6094d71007507a7b877e05328a;hp=e7e71f30d8a48a484c25628eb917aa3e4fb86f92;hpb=45d8eb0f41893409a972c7e3b0665ee3726c331b;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 e7e71f3..5a76b5c 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java @@ -1,8 +1,8 @@ package org.usfirst.frc.team3501.robot.commands.climber; import org.usfirst.frc.team3501.robot.Robot; +import org.usfirst.frc.team3501.robot.subsystems.Climber; -import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.command.Command; /** @@ -15,12 +15,17 @@ import edu.wpi.first.wpilibj.command.Command; * * 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; + Climber climber = Robot.getClimber(); + private double time; private double motorVal; @@ -33,31 +38,28 @@ public class RunWinch extends Command { * value range is from -1 to 1 */ public RunWinch(double time, double motorVal) { - requires(Robot.getDriveTrain()); + requires(climber); this.time = time; this.motorVal = motorVal; } @Override protected void initialize() { - timer.start(); } @Override protected void execute() { - Robot.getDriveTrain().setMotorValues(motorVal, motorVal); - + climber.setMotorValues(motorVal); } @Override protected boolean isFinished() { - return timer.get() >= time; + return timeSinceInitialized() >= time; } @Override protected void end() { - Robot.getDriveTrain().stop(); - + climber.stop(); } @Override