Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter
authorRohan Rodrigues <rohanrodrigues19@gmail.com>
Wed, 8 Feb 2017 00:46:11 +0000 (16:46 -0800)
committerEric Sandoval <harpnart@gmail.com>
Sun, 19 Feb 2017 18:42:27 +0000 (10:42 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java
src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java

index c2fbf7b121dc7e831d783cf066980d32eb0d4f05..e18c8710a61eaf8454116d28d91e1de5c18abc81 100644 (file)
@@ -44,6 +44,8 @@ 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;
@@ -57,11 +59,15 @@ public class Constants {
     public static final int ENCODER_RIGHT_B = 3;
 
     public static final SPI.Port GYRO_PORT = SPI.Port.kOnboardCS0;
+
+    public final static int TRIGGER_DRIVE_PORT = 0;
   }
 
   public static class Intake {
     public static final int INTAKE_ROLLER_PORT = 8;
 
+    public final static int HOLD_INTAKE_PORT = 0;
+
   }
 
   public static enum Direction {
index 00186000ceb5768b3f0a95a03ba80f3f87105d1c..8b5cdacb84b0a96ea8be573add14da2e85042ef7 100644 (file)
@@ -1,5 +1,7 @@
 package org.usfirst.frc.team3501.robot;
 
+import org.usfirst.frc.team3501.robot.commands.climber.MaintainClimbedPosition;
+import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous;
 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
@@ -19,6 +21,7 @@ public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
   public static Button toggleWinch;
+  private boolean isClimbing = false;
 
   public static Button runIndexWheel;
   public static Button reverseIndexWheel;
@@ -72,6 +75,14 @@ public class OI {
     decreaseShooterSpeed = new JoystickButton(leftJoystick,
         Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
     decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
+
+    if (!isClimbing) {
+      toggleWinch.whenPressed(new RunWinchContinuous());
+      isClimbing = true;
+    } else {
+      toggleWinch.whenPressed(new MaintainClimbedPosition());
+      isClimbing = false;
+    }
   }
 
   public static OI getOI() {
index 210199d86e2cb3dc178fb5d289f0446e4147368f..f1fae231c7fd4370cb4ff2901f63ab63b324ded2 100644 (file)
@@ -18,8 +18,11 @@ 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
@@ -28,12 +31,22 @@ 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
   }
 
   @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 d8d56aa519bae9aa41d0f0563e7ed2a9b08ea904..2a4ccf7788d3f7a44b6d98a28859b3f0af1830f7 100644 (file)
@@ -55,6 +55,9 @@ public class DriveTrain extends Subsystem {
   private PIDController driveController;
   private PIDController gyroController;
 
+  private boolean isClimbing;
+  private static double CLIMBER_SPEED;;
+
   private DriveTrain() {
 
     driveController = new PIDController(driveP, driveI, driveD);
@@ -89,6 +92,8 @@ 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() {
@@ -219,4 +224,13 @@ public class DriveTrain extends Subsystem {
   protected void initDefaultCommand() {
     setDefaultCommand(new JoystickDrive());
   }
+
+  public boolean isClimbing() {
+    return this.isClimbing;
+  }
+
+  public double getClimbingSpeed() {
+    return this.CLIMBER_SPEED;
+  }
+
 }