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 // Defense arm related objects
11 private AnalogPotentiometer defenseArmPotentiometer
;
12 private AnalogPotentiometer defenseHandPotentiometer
;
13 private CANTalon defenseArm
;
14 private CANTalon defenseHand
;
15 private double hookHeight
;
16 private double footHeight
;
17 private Double
[] potAngles
; // change name, 5 to another #
21 defenseArmPotentiometer
= new AnalogPotentiometer(
22 Constants
.DefenseArm
.ARM_CHANNEL
,
23 Constants
.DefenseArm
.FULL_RANGE
,
24 Constants
.DefenseArm
.OFFSET
);
26 defenseArm
= new CANTalon(Constants
.DefenseArm
.ARM_PORT
);
27 defenseHand
= new CANTalon(Constants
.DefenseArm
.HAND_PORT
);
30 public double getArmPotAngle() {
31 return defenseArmPotentiometer
.get();
34 public double getHandPotAngle() {
35 return defenseHandPotentiometer
.get();
38 public double getDistance(int desiredArmLocation
) {
39 return potAngles
[desiredArmLocation
];
42 public Double
[] putInValues() {
43 for (int i
= 0; i
< 3; i
++) {
44 potAngles
[i
] = (double) (45 * i
);
50 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
51 * negative voltage makes the direction of the motor go backwards.
54 * The voltage that you set the motor at. The range of the voltage of
55 * the arm motor is from [-1,1]. A
56 * negative voltage makes the direction of the motor go backwards.
59 public void setArmSpeed(double speed
) {
65 defenseArm
.set(speed
);
69 * This method sets the voltage of the hand motor. The range is from [-1,1]. A
70 * negative voltage makes the direction of the motor go backwards.
73 * The voltage that you set the motor at. The range of the voltage of
74 * the hand motor is from [-1,1]. A
75 * negative voltage makes the direction of the motor go backwards.
78 public void setHandSpeed(double speed
) {
84 defenseHand
.set(speed
);
88 protected void initDefaultCommand() {