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.commandgroups.ToggleWinch;
import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
public static Joystick leftJoystick;
public static Joystick rightJoystick;
public static Button toggleWinch;
- private boolean isClimbing = false;
public static Button runIndexWheel;
public static Button reverseIndexWheel;
toggleWinch = new JoystickButton(leftJoystick,
Constants.OI.TOGGLE_WINCH_PORT);
- if (!isClimbing) {
- toggleWinch.whenPressed(new RunWinchContinuous());
- isClimbing = true;
- } else {
- toggleWinch.whenPressed(new MaintainClimbedPosition());
- isClimbing = false;
- }
+ /*
+ * if (!Robot.getDriveTrain().isClimbing()) { toggleWinch.whenPressed(new
+ * RunWinchContinuous()); Robot.getDriveTrain().setClimbing(true); } else {
+ * toggleWinch.whenPressed(new MaintainClimbedPosition());
+ * Robot.getDriveTrain().setClimbing(false); }
+ */
+ toggleWinch.whenPressed(new ToggleWinch());
}
public static OI getOI() {
--- /dev/null
+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());
+ }
+ }
+
+}
frontRight.set(-right);
rearRight.set(-right);
+ this.isClimbing = true;
}
public void joystickDrive(final double thrust, final double twist) {
public void stop() {
setMotorValues(0, 0);
+ this.isClimbing = false;
}
public double getLeftMotorVal() {
return this.isClimbing;
}
+ public void setClimbing(boolean isClimbing) {
+ this.isClimbing = isClimbing;
+ }
+
public double getClimbingSpeed() {
return this.CLIMBER_SPEED;
}