1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
5 import edu
.wpi
.first
.wpilibj
.AnalogPotentiometer
;
6 import edu
.wpi
.first
.wpilibj
.CANTalon
;
7 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
9 public class DefenseArm
extends Subsystem
{
10 private AnalogPotentiometer defenseArmPotentiometer
;
11 private AnalogPotentiometer defenseHandPotentiometer
;
12 private CANTalon defenseArm
;
13 private CANTalon defenseHand
;
14 private double hookHeight
;
15 private double footHeight
;
16 private Double
[] potAngles
;
19 defenseArmPotentiometer
= new AnalogPotentiometer(
20 Constants
.DefenseArm
.ARM_CHANNEL
,
21 Constants
.DefenseArm
.FULL_RANGE
,
22 Constants
.DefenseArm
.OFFSET
);
24 defenseArm
= new CANTalon(Constants
.DefenseArm
.ARM_PORT
);
25 defenseHand
= new CANTalon(Constants
.DefenseArm
.HAND_PORT
);
28 public double getArmPotAngle() {
29 return defenseArmPotentiometer
.get();
32 public double getHandPotAngle() {
33 return defenseHandPotentiometer
.get();
36 public double getDistance(int desiredArmLocation
) {
37 return potAngles
[desiredArmLocation
];
40 public Double
[] putInValues() {
41 for (int i
= 0; i
< 3; i
++) {
42 potAngles
[i
] = (double) (45 * i
);
48 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
49 * negative voltage makes the direction of the motor go backwards.
52 * The voltage that you set the motor at. The range of the voltage of
53 * the arm motor is from [-1,1]. A
54 * negative voltage makes the direction of the motor go backwards.
57 public void setArmSpeed(double speed
) {
63 defenseArm
.set(speed
);
67 * This method sets the voltage of the hand motor. The range is from [-1,1]. A
68 * negative voltage makes the direction of the motor go backwards.
71 * The voltage that you set the motor at. The range of the voltage of
72 * the hand motor is from [-1,1]. A
73 * negative voltage makes the direction of the motor go backwards.
76 public void setHandSpeed(double speed
) {
82 defenseHand
.set(speed
);
86 protected void initDefaultCommand() {