Change SetMotorValue
authorShivani Ghanta <shivani.oghanta@gmail.com>
Mon, 16 Jan 2017 23:24:41 +0000 (15:24 -0800)
committerCindy Zhang <cindyzyx9@gmail.com>
Wed, 25 Jan 2017 03:40:38 +0000 (19:40 -0800)
src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java
src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java
src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/subsystems/Climber.java [new file with mode: 0644]

index c790a6cf70e7f39670d2dd382991562f8fea2798..c8b8b8deb03df2bdc561413793b60c3c834bdba1 100644 (file)
@@ -33,11 +33,7 @@ public class RunWinch extends Command {
    *          value range is from -1 to 1
    */
   public RunWinch(double time, double motorVal) {
-<<<<<<< a5147d5928f01620d8e10f2e9cdea079526d2db3
     requires(Robot.getDriveTrain());
-=======
-    requires(Robot.getClimber());
->>>>>>> Implement RunWinch
     this.time = time;
     this.motorVal = motorVal;
   }
@@ -45,10 +41,6 @@ public class RunWinch extends Command {
   @Override
   protected void initialize() {
     timer.start();
-<<<<<<< a5147d5928f01620d8e10f2e9cdea079526d2db3
-=======
-    Robot.getClimber().setMotorValues(motorVal, motorVal);
->>>>>>> Implement RunWinch
   }
 
   @Override
@@ -64,12 +56,7 @@ public class RunWinch extends Command {
 
   @Override
   protected void end() {
-<<<<<<< a5147d5928f01620d8e10f2e9cdea079526d2db3
     Robot.getDriveTrain().stop();
-
-=======
-    Robot.getClimber().stop();
->>>>>>> Implement RunWinch
   }
 
   @Override
index 1a9e2d68a1a0eda046128a632350abbdea075ddc..e0a6700115c1b77234cb3d14db5e516b7a3e64ae 100644 (file)
@@ -34,7 +34,6 @@ public class RunWinchContinuous extends Command {
   @Override
   protected void initialize() {
     Robot.getDriveTrain().setMotorValues(motorVal, motorVal);
-
   }
 
   @Override
diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java b/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java
new file mode 100644 (file)
index 0000000..31a5b55
--- /dev/null
@@ -0,0 +1,42 @@
+package org.usfirst.frc.team3501.robot.commands.climber;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ * Stops the winch
+ *
+ * @author shivanighanta
+ *
+ */
+public class StopWinch extends Command {
+
+  public StopWinch() {
+    requires(Robot.getClimber());
+  }
+
+  @Override
+  protected void initialize() {
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+    Robot.getClimber().stop();
+
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Climber.java b/src/org/usfirst/frc/team3501/robot/subsystems/Climber.java
new file mode 100644 (file)
index 0000000..3426dad
--- /dev/null
@@ -0,0 +1,24 @@
+package org.usfirst.frc.team3501.robot.subsystems;
+
+public class Climber {
+  private static Climber climber;
+
+  private Climber() {
+
+  }
+
+  public static Climber getClimber() {
+    if (climber == null) {
+      climber = new Climber();
+    }
+    return climber;
+  }
+
+  public void stop() {
+    setMotorValues(0);
+  }
+
+  public void setMotorValues(final double val) {
+
+  }
+}