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
;
18 private double[] potAngles
= { 0, 45, 90 };
23 defenseArmPotentiometer
= new AnalogPotentiometer(
24 Constants
.DefenseArm
.ARM_CHANNEL
,
25 Constants
.DefenseArm
.FULL_RANGE
,
26 Constants
.DefenseArm
.OFFSET
);
28 defenseArm
= new CANTalon(Constants
.DefenseArm
.ARM_PORT
);
29 defenseHand
= new CANTalon(Constants
.DefenseArm
.HAND_PORT
);
32 public double getArmPotAngle() {
33 return defenseArmPotentiometer
.get();
36 public double getHandPotAngle() {
37 return defenseHandPotentiometer
.get();
41 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
42 * negative voltage makes the direction of the motor go backwards.
45 * The voltage that you set the motor at. The range of the voltage of
46 * the arm motor is from [-1,1]. A
47 * negative voltage makes the direction of the motor go backwards.
50 public void setArmSpeed(double speed
) {
56 defenseArm
.set(speed
);
60 * This method sets the voltage of the hand motor. The range is from [-1,1]. A
61 * negative voltage makes the direction of the motor go backwards.
64 * The voltage that you set the motor at. The range of the voltage of
65 * the hand motor is from [-1,1]. A
66 * negative voltage makes the direction of the motor go backwards.
69 public void setHandSpeed(double speed
) {
75 defenseHand
.set(speed
);
79 protected void initDefaultCommand() {