3a69eea7fd4cb6ab3e9fa2d33fd4ffb909f60faf
1 package org
.usfirst
.frc3501
.RiceCatRobot
.subsystems
;
3 import java
.util
.ArrayList
;
5 import org
.usfirst
.frc3501
.RiceCatRobot
.RobotMap
;
7 import edu
.wpi
.first
.wpilibj
.CANJaguar
;
8 import edu
.wpi
.first
.wpilibj
.DigitalInput
;
9 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
11 public class Arm
extends Subsystem
{
12 private CANJaguar left
, right
;
13 ArrayList
<DigitalInput
> limitSwitches
;
14 //channel index numbers correspond to limit switches
16 private final int NUM_OF_SWITCHES
= 4;
19 left
= new CANJaguar(RobotMap
.ARM_LEFT
);
20 right
= new CANJaguar(RobotMap
.ARM_RIGHT
);
22 //channels are not known, these are random numbers
23 channels
= new int[]{0, 1, 2, 3};
25 limitSwitches
= new ArrayList
<DigitalInput
>();
27 for(int i
= 0; i
< NUM_OF_SWITCHES
; i
++){
28 DigitalInput d
= limitSwitches
.get(i
);
29 d
= new DigitalInput(channels
[i
]);
34 channels
= new int[NUM_OF_SWITCHES
];
39 public void initDefaultCommand() {
42 public void fineTuneControl(double d
) {
43 if (Math
.abs(d
) < 0.05) {
53 public void setLeft(double speed
) {
57 public void setRight(double speed
) {
61 public void setArmSpeeds(double speed
) {
71 public int getLevel(){
72 //return last past switch