| 1 | package org.usfirst.frc.team3501.robot.subsystems; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Constants; |
| 4 | import org.usfirst.frc.team3501.robot.MathLib; |
| 5 | |
| 6 | import com.ctre.CANTalon; |
| 7 | |
| 8 | import edu.wpi.first.wpilibj.command.Subsystem; |
| 9 | |
| 10 | public class Climber extends Subsystem { |
| 11 | public static Climber climber; |
| 12 | |
| 13 | public static final boolean BRAKE_MODE = true; |
| 14 | public static final boolean COAST_MODE = false; |
| 15 | |
| 16 | public static final double CLIMBER_SPEED = 1.0; |
| 17 | public boolean shouldBeClimbing = true; |
| 18 | |
| 19 | private CANTalon winch; |
| 20 | |
| 21 | public Climber() { |
| 22 | winch = new CANTalon(Constants.Climber.WINCH_PORT); |
| 23 | } |
| 24 | |
| 25 | public static Climber getClimber() { |
| 26 | if (climber == null) { |
| 27 | climber = new Climber(); |
| 28 | } |
| 29 | return climber; |
| 30 | } |
| 31 | |
| 32 | public void setMotorValues(double climbingSpeed) { |
| 33 | winch.set(MathLib.limitValue(climbingSpeed, 0.0, 1.0)); |
| 34 | } |
| 35 | |
| 36 | public void stop() { |
| 37 | winch.set(0); |
| 38 | } |
| 39 | |
| 40 | public void setCANTalonsBrakeMode(boolean mode) { |
| 41 | winch.enableBrakeMode(mode); |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | protected void initDefaultCommand() { |
| 46 | } |
| 47 | } |