From: Rohan Rodrigues Date: Wed, 8 Feb 2017 00:46:11 +0000 (-0800) Subject: Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=commitdiff_plain;h=ffb43c5cfe2c48cdb82ba0a3ee4e853dc9f5ae58 Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter --- diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index c2fbf7b..e18c871 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -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 { diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 0018600..8b5cdac 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -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() { diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java index 210199d..f1fae23 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java @@ -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 diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index d8d56aa..2a4ccf7 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -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; + } + }