From: Shivani Ghanta Date: Sat, 14 Jan 2017 23:26:14 +0000 (-0800) Subject: Implement RunWinch X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=commitdiff_plain;h=6a36392421863a0d06dc2f1aad25c94678274346 Implement RunWinch --- diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 5fbfe40..9d178da 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -27,6 +27,10 @@ public class Robot extends IterativeRobot { return DriveTrain.getDriveTrain(); } + public static Climber getClimber() { + return Climber.getClimber(); + } + public static OI getOI() { return OI.getOI(); } 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 99fb0f1..028e33a 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java @@ -1,5 +1,9 @@ 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.command.Command; /** @@ -9,16 +13,20 @@ import edu.wpi.first.wpilibj.command.Command; * */ public class RunWinch extends Command { + Timer timer; private double time; private double motorVal; public RunWinch(double time, double motorVal) { + requires(Robot.getClimber()); this.time = time; this.motorVal = motorVal; } @Override protected void initialize() { + timer.start(); + Robot.getClimber().setMotorValues(motorVal, motorVal); } @Override @@ -28,15 +36,16 @@ public class RunWinch extends Command { @Override protected boolean isFinished() { - return false; + return timer.get() >= time; } @Override protected void end() { - + Robot.getClimber().stop(); } @Override protected void interrupted() { + end(); } }