Commit | Line | Data |
---|---|---|
f11ce98e KZ |
1 | package org.usfirst.frc3501.RiceCatRobot.subsystems; |
2 | ||
3 | import org.usfirst.frc3501.RiceCatRobot.RobotMap; | |
4 | ||
6cc00a79 | 5 | import edu.wpi.first.wpilibj.AnalogInput; |
7c863cf5 | 6 | import edu.wpi.first.wpilibj.AnalogPotentiometer; |
f11ce98e KZ |
7 | import edu.wpi.first.wpilibj.CANJaguar; |
8 | import edu.wpi.first.wpilibj.command.Subsystem; | |
9 | ||
10 | public class Arm extends Subsystem { | |
e3bfff96 | 11 | private CANJaguar left, right; |
7c863cf5 | 12 | public AnalogPotentiometer analogPotentiometer; |
fa9e81da | 13 | static final double ANGLE_RANGE = 360; |
14 | static final double INITIAL_ANGLE = 30; | |
e3bfff96 KZ |
15 | |
16 | public Arm() { | |
17 | left = new CANJaguar(RobotMap.ARM_LEFT); | |
18 | right = new CANJaguar(RobotMap.ARM_RIGHT); | |
fa9e81da | 19 | AnalogInput analogInput = new AnalogInput(1); |
20 | analogPotentiometer = new AnalogPotentiometer(analogInput, ANGLE_RANGE, INITIAL_ANGLE); | |
e3bfff96 KZ |
21 | } |
22 | ||
23 | public void initDefaultCommand() { | |
24 | } | |
25 | ||
26 | public void fineTuneControl(double d) { | |
27 | if (Math.abs(d) < 0.05) { | |
28 | d = 0; | |
29 | } else if (d > 0) { | |
30 | d *= d; | |
31 | } else { | |
32 | d *= -d; | |
f11ce98e | 33 | } |
e3bfff96 KZ |
34 | setArmSpeeds(d); |
35 | } | |
36 | ||
37 | public void setLeft(double speed) { | |
38 | left.set(-speed); | |
39 | } | |
40 | ||
41 | public void setRight(double speed) { | |
42 | right.set(-speed); | |
43 | } | |
44 | ||
45 | public void setArmSpeeds(double speed) { | |
46 | setLeft(speed); | |
47 | setRight(speed); | |
48 | } | |
49 | ||
50 | public void stop() { | |
51 | left.set(0); | |
52 | right.set(0); | |
53 | } | |
7c863cf5 | 54 | |
b72e169c | 55 | } |