-
Notifications
You must be signed in to change notification settings - Fork 1
/
oi.py
49 lines (34 loc) · 1.19 KB
/
oi.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import wpilib
from wpilib import SmartDashboard
from wpilib.buttons import JoystickButton
#import subsystems
from subsystems.drivetrain import DriveTrain
from subsystems.lift import LiftMech
from subsystems.pneumatics_comp import Pneumatics
#import commands
from commands.speed_toggle import SpeedToggle
from commands.pull_intake import PullIntake
from commands.lift_arm import MoveArm
from commands.armup import armUp
class OI:
def __init__(self, robot):
#Xbox controller
self.joy = wpilib.Joystick(0)
#Actual Joystick
self.joy_lift = wpilib.Joystick(1)
#Buttons for Xbox controller
self.r_trig = JoystickButton(self.joy, 6) #I think
#buttons for actual joystick
self.btn3 = JoystickButton(self.joy_lift, 3)
#self.btn4 = JoystickButton(self.joy_lift, 4)
self.btn7 = JoystickButton(self.joy_lift, 7)
#bind buttons on Xbox controller to commands
self.r_trig.toggleWhenPressed(SpeedToggle(robot.pneumatics_comp))
#bind buttons on Joystick to commands
# self.btn3.whileHeld(PullIntake(robot.intake))
self.btn7.whenPressed(armUp(robot.lift))
#self.btn3.whenPressed(PullIntake(Intake))
def getJoystick(self):
return self.joy
def getLiftstick(self):
return self.joy_lift