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
;
20 defenseArmPotentiometer
= new AnalogPotentiometer(
21 Constants
.DefenseArm
.ARM_CHANNEL
,
22 Constants
.DefenseArm
.FULL_RANGE
,
23 Constants
.DefenseArm
.OFFSET
);
25 defenseArm
= new CANTalon(Constants
.DefenseArm
.ARM_PORT
);
26 defenseHand
= new CANTalon(Constants
.DefenseArm
.HAND_PORT
);
29 public double getArmPotAngle() {
30 return defenseArmPotentiometer
.get();
33 public double getHandPotAngle() {
34 return defenseHandPotentiometer
.get();
37 public double getDistance(int desiredArmLocation
) {
38 return potAngles
[desiredArmLocation
];
41 public Double
[] putInValues() {
42 for (int i
= 0; i
< 3; i
++) {
43 potAngles
[i
] = (double) (45 * i
);
49 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
50 * negative voltage makes the direction of the motor go backwards.
53 * The voltage that you set the motor at. The range of the voltage of
54 * the arm motor is from [-1,1]. A
55 * negative voltage makes the direction of the motor go backwards.
58 public void setArmSpeed(double speed
) {
64 defenseArm
.set(speed
);
68 * This method sets the voltage of the hand motor. The range is from [-1,1]. A
69 * negative voltage makes the direction of the motor go backwards.
72 * The voltage that you set the motor at. The range of the voltage of
73 * the hand motor is from [-1,1]. A
74 * negative voltage makes the direction of the motor go backwards.
77 public void setHandSpeed(double speed
) {
83 defenseHand
.set(speed
);
87 protected void initDefaultCommand() {