From 0d4d5dcbf4630c1eab65bc72dc292402c41ca748 Mon Sep 17 00:00:00 2001 From: Lauren Meier Date: Mon, 8 Feb 2016 20:08:43 -0800 Subject: [PATCH] add commands to run winches continuously --- .../commands/WinchRobotDownContinuous.java | 39 +++++++++++++++++++ .../commands/WinchRobotUpContinuous.java | 39 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java diff --git a/src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java new file mode 100644 index 00000000..69935270 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/WinchRobotDownContinuous.java @@ -0,0 +1,39 @@ +package org.usfirst.frc.team3501.robot.commands; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class WinchRobotDownContinuous extends Command { + double winchDownSpeed; + + public WinchRobotDownContinuous(double speed) { + winchDownSpeed = speed; + if (winchDownSpeed > 1) + winchDownSpeed = 1; + if (winchDownSpeed < -1) + winchDownSpeed = -1; + } + + @Override + protected void initialize() { + Robot.scaler.runWinch(winchDownSpeed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java new file mode 100644 index 00000000..ea35f24d --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/WinchRobotUpContinuous.java @@ -0,0 +1,39 @@ +package org.usfirst.frc.team3501.robot.commands; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class WinchRobotUpContinuous extends Command { + double winchUpSpeed; + + public WinchRobotUpContinuous(double speed) { + winchUpSpeed = speed; + if (winchUpSpeed > 1) + winchUpSpeed = 1; + if (winchUpSpeed < -1) + winchUpSpeed = -1; + } + + @Override + protected void initialize() { + Robot.scaler.runWinch(winchUpSpeed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} -- 2.30.2