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 // Defense arm specific constants that relate to the degrees per pulse value
19 // for the potentiometers
20 // private final static double PULSES_PER_ROTATION = 1; // in pulses
25 defenseArmPotentiometer
= new AnalogPotentiometer(
26 Constants
.DefenseArm
.ARM_CHANNEL
,
27 Constants
.DefenseArm
.FULL_RANGE
,
28 Constants
.DefenseArm
.OFFSET
);
30 defenseArm
= new CANTalon(Constants
.DefenseArm
.ARM_PORT
);
31 defenseHand
= new CANTalon(Constants
.DefenseArm
.HAND_PORT
);
34 public double getArmPotAngle() {
35 return defenseArmPotentiometer
.get();
38 public double getHandPotAngle() {
39 return defenseHandPotentiometer
.get();
43 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
44 * negative voltage makes the direction of the motor go backwards.
47 * The voltage that you set the motor at. The range of the voltage of
48 * the arm motor is from [-1,1]. A
49 * negative voltage makes the direction of the motor go backwards.
52 public void setArmSpeed(double speed
) {
58 defenseArm
.set(speed
);
62 * This method sets the voltage of the hand motor. The range is from [-1,1]. A
63 * negative voltage makes the direction of the motor go backwards.
66 * The voltage that you set the motor at. The range of the voltage of
67 * the hand motor is from [-1,1]. A
68 * negative voltage makes the direction of the motor go backwards.
71 public void setHandSpeed(double speed
) {
77 defenseHand
.set(speed
);
81 protected void initDefaultCommand() {