implement ToggleWinch command
authorCindy Zhang <cindyzyx9@gmail.com>
Fri, 10 Feb 2017 03:42:15 +0000 (19:42 -0800)
committerEric Sandoval <harpnart@gmail.com>
Sun, 19 Feb 2017 18:44:36 +0000 (10:44 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/commandgroups/ToggleWinch.java [deleted file]
src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java
src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java
src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java

index e18c8710a61eaf8454116d28d91e1de5c18abc81..20282740a75198a70f6551e0cdf421a661eed187 100644 (file)
@@ -44,8 +44,6 @@ public class Constants {
     public static final Value HIGH_GEAR = DoubleSolenoid.Value.kForward;
     public static final Value LOW_GEAR = DoubleSolenoid.Value.kReverse;
 
-    public static final double CLIMBER_SPEED = 5;
-
     // MOTOR CONTROLLERS
     public static final int FRONT_LEFT = 1;
     public static final int FRONT_RIGHT = 3;
index 40df56df3ae0170c7be6ccf88d3f1e36915411ba..815d0cdbaf5d07d19e11f90ed1839801f014c9be 100644 (file)
@@ -65,7 +65,6 @@ public class OI {
 
     toggleWinch = new JoystickButton(leftJoystick,
         Constants.OI.TOGGLE_WINCH_PORT);
-    toggleWinch.whenPressed(new ToggleWinch());
 
     increaseShooterSpeed = new JoystickButton(leftJoystick,
         Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
@@ -82,6 +81,7 @@ public class OI {
       toggleWinch.whenPressed(new MaintainClimbedPosition());
       isClimbing = false;
     }
+
     /*
      * if (!Robot.getDriveTrain().isClimbing()) { toggleWinch.whenPressed(new
      * RunWinchContinuous()); Robot.getDriveTrain().setClimbing(true); } else {
diff --git a/src/org/usfirst/frc/team3501/robot/commandgroups/ToggleWinch.java b/src/org/usfirst/frc/team3501/robot/commandgroups/ToggleWinch.java
deleted file mode 100644 (file)
index 3766aee..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.usfirst.frc.team3501.robot.commandgroups;
-
-import org.usfirst.frc.team3501.robot.Robot;
-import org.usfirst.frc.team3501.robot.commands.climber.MaintainClimbedPosition;
-import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous;
-
-import edu.wpi.first.wpilibj.command.CommandGroup;
-
-public class ToggleWinch extends CommandGroup {
-
-  public ToggleWinch() {
-    if (!Robot.getDriveTrain().isClimbing()) {
-      Robot.getDriveTrain().setClimbing(true);
-      addSequential(new RunWinchContinuous());
-
-    } else {
-      Robot.getDriveTrain().setClimbing(false);
-      addSequential(new MaintainClimbedPosition());
-    }
-  }
-
-}
index f1fae231c7fd4370cb4ff2901f63ab63b324ded2..88c2f6d8ea3b5310b4e73cc54c2fa8eb585779ea 100644 (file)
@@ -18,11 +18,9 @@ import edu.wpi.first.wpilibj.command.Command;
  *
  */
 public class RunWinchContinuous extends Command {
-<<<<<<< HEAD
+
   DriveTrain driveTrain = Robot.getDriveTrain();
   private double climbingSpeed;
-=======
->>>>>>> Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter
 
   /**
    * See JavaDoc comment in class for details
@@ -31,22 +29,14 @@ public class RunWinchContinuous extends Command {
    *          value range is from -1 to 1
    */
   public RunWinchContinuous() {
-<<<<<<< HEAD
     requires(driveTrain);
     climbingSpeed = driveTrain.CLIMBER_SPEED;
-=======
     requires(Robot.getDriveTrain());
->>>>>>> Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter
+    requires(driveTrain);
   }
 
   @Override
   protected void initialize() {
-<<<<<<< HEAD
-=======
-    Robot.getDriveTrain().setMotorValues(
-        Robot.getDriveTrain().getClimbingSpeed(),
-        Robot.getDriveTrain().getClimbingSpeed());
->>>>>>> Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter
   }
 
   @Override
index 66c8364b1a37e78bcf993b5d4414e29d172322a7..3e60406cc66e332167c465d59dae56d08311b13f 100644 (file)
@@ -34,7 +34,7 @@ public class ToggleWinch extends Command {
 
   @Override
   protected boolean isFinished() {
-    return Robot.getOI().toggleWinch.get();
+    return false;
   }
 
   @Override
index 0718539d16a534e7a4dd3bfc69c21c40b1ec4fdc..ad2c2635980a3bc532b5d79196ac848f7a7bb183 100644 (file)
@@ -57,6 +57,7 @@ public class DriveTrain extends Subsystem {
 
   private boolean isClimbing;
   private static double CLIMBER_SPEED;;
+  public boolean shouldBeClimbing;
 
   private DriveTrain() {
 
@@ -92,8 +93,6 @@ public class DriveTrain extends Subsystem {
     rightGearPiston = new DoubleSolenoid(Constants.DriveTrain.PISTON_MODULE,
         Constants.DriveTrain.RIGHT_GEAR_PISTON_FORWARD,
         Constants.DriveTrain.RIGHT_GEAR_PISTON_REVERSE);
-
-    CLIMBER_SPEED = Constants.DriveTrain.CLIMBER_SPEED;
   }
 
   public PIDController getDriveController() {
@@ -118,7 +117,6 @@ public class DriveTrain extends Subsystem {
 
     frontRight.set(-right);
     rearRight.set(-right);
-    this.isClimbing = true;
   }
 
   public void joystickDrive(final double thrust, final double twist) {
@@ -127,7 +125,6 @@ public class DriveTrain extends Subsystem {
 
   public void stop() {
     setMotorValues(0, 0);
-    this.isClimbing = false;
   }
 
   public double getLeftMotorVal() {
@@ -226,17 +223,4 @@ public class DriveTrain extends Subsystem {
   protected void initDefaultCommand() {
     setDefaultCommand(new JoystickDrive());
   }
-
-  public boolean isClimbing() {
-    return this.isClimbing;
-  }
-
-  public void setClimbing(boolean isClimbing) {
-    this.isClimbing = isClimbing;
-  }
-
-  public double getClimbingSpeed() {
-    return this.CLIMBER_SPEED;
-  }
-
 }