Commit | Line | Data |
---|---|---|
150f450f CZ |
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 | import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous; | |
6 | ||
7 | import com.ctre.CANTalon; | |
8 | ||
9 | import edu.wpi.first.wpilibj.command.Subsystem; | |
10 | ||
11 | public class Climber extends Subsystem { | |
12 | public static Climber climber; | |
13 | ||
14 | public static final boolean BRAKE_MODE = true; | |
15 | public static final boolean COAST_MODE = false; | |
16 | ||
17 | public static final double CLIMBER_SPEED = 0; | |
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 | setDefaultCommand(new RunWinchContinuous()); | |
47 | } | |
48 | } |