-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshooter.py
30 lines (24 loc) · 878 Bytes
/
shooter.py
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
import wpilib
class Shooter:
def __init__(self, motor_controller, shooterRPM): # takes a SPARK MAX motorcontroller
self.controller = motor_controller
# self.controller.setClosedLoopRampRate(1.0)
self.encoder = self.controller.getEncoder()
self.pidController = self.controller.getPIDController()
self.shooterRPM = shooterRPM
def set(self, speed):
self.controller.set(speed)
def get(self):
return self.controller.get()
def getShooterRPM(self):
return self.get()
def setPIDController(self):
kP = 0.00001
kI = 0.00000
kD = 0.00000
kMaxOutput = 0
kMinOutput = -1
self.pidController.setP(kP)
self.pidController.setI(kI)
self.pidController.setD(kD)
self.pidController.setOutputRange(kMinOutput, kMaxOutput)