-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmSubsystem.java
More file actions
54 lines (38 loc) · 1.35 KB
/
ArmSubsystem.java
File metadata and controls
54 lines (38 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package frc.robot.subsystems.arm;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.commands.*;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.motorcontrol.MotorController;
import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX;
public class ArmSubsystem extends SubsystemBase {
//add motors here
public static final double PlaceDistance = 0.1;
public static final double BackAwayDistance = 0.6;
private PWMVictorSPX motor;
private DigitalInput limitswitch;
public ArmSubsystem() {
motor = new PWMVictorSPX(4);
addChild("motor",motor);
motor.setInverted(false);
limitswitch = new DigitalInput(4);
addChild("limit switch", limitswitch);
}
//consider what methods are necessary for the motor to run effectively
public void open(double speed) {
motor.set(speed);
}
public void stop() {
motor.set(0.0);
}
public boolean isGripping() {
return limitswitch.get();
}
public double whatSpeed() {
return motor.get();
}
// I was very confused so I "consulted" the wpilib source material
@Override
public void periodic() {}
}