From: Cindy Zhang Date: Fri, 10 Feb 2017 03:42:15 +0000 (-0800) Subject: implement ToggleWinch command X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=commitdiff_plain;h=cb9496635ee35ecd3ea31cd840cf1f822be64bc4 implement ToggleWinch command --- diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index e18c871..2028274 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -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; diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 40df56d..815d0cd 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -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 index 3766aee..0000000 --- a/src/org/usfirst/frc/team3501/robot/commandgroups/ToggleWinch.java +++ /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()); - } - } - -} 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 f1fae23..88c2f6d 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java @@ -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 diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java b/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java index 66c8364..3e60406 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java @@ -34,7 +34,7 @@ public class ToggleWinch extends Command { @Override protected boolean isFinished() { - return Robot.getOI().toggleWinch.get(); + return false; } @Override diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index 0718539..ad2c263 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -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; - } - }