This repository was archived by the owner on Feb 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoi.py
More file actions
132 lines (111 loc) · 4.18 KB
/
oi.py
File metadata and controls
132 lines (111 loc) · 4.18 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# vim: set sw=4 noet ts=4 fileencoding=utf-8:
import wpilib
from wpilib.buttons import JoystickButton
from wpilib import XboxController
from wpilib.buttons import Trigger
from sys import path
path.append('../commands')
# Button commands
#from command_intake_pickup import Command_Intake_Pickup
#from command_shoot import Command_Shoot
#from do_big_climb import Do_Big_Climb
#from do_little_climb import Do_Little_Climb
#from do_winch import Do_Winch
#from command_climb_up import Command_Climb_Up
#from command_climb_down import Command_Climb_Down
#XXX For testing
from do_shoot import Do_Shoot
#from do_activate_feeder import Do_Activate_Feeder
from do_carrier import Do_Carrier
from do_intake import Do_Intake
from do_feeder import Do_Feeder
#from do_big_climb_test import Do_Big_Climb_Test
#from do_little_climb_test import Do_Little_Climb_Test
from do_four_bar import Do_Four_Bar
# from do_backwards_shoot import Do_Backwards_Shoot
# from do_backwards_feeder import Do_Backwards_Feeder
# from do_backwards_carrier import Do_Backwards_Carrier
#from do_stupid_intake import Do_Stupid_Intake
# Non-button commands
class OI():
def __init__(self, robot):
self.robot = robot
self.left_joy = self.robot.left_joy
self.right_joy = self.robot.right_joy
self.xbox = self.robot.xbox
# First character indicates self.right or self.left,
# second indicates position,
# third indicates which button of the position specified
# Ex: ltop0 is self.left top 0
'''
JoystickButton and Xbox button assignments
'''
# I think ltop1 is left trigger. Vice versa for right
ltop1 = JoystickButton(self.left_joy, 1)
ltop2 = JoystickButton(self.left_joy, 2)
ltop3 = JoystickButton(self.left_joy, 3)
ltop4 = JoystickButton(self.left_joy, 4)
ltop5 = JoystickButton(self.left_joy, 5)
ltop6 = JoystickButton(self.left_joy, 6)
rtop1 = JoystickButton(self.right_joy, 1)
rtop2 = JoystickButton(self.right_joy, 2)
rtop3 = JoystickButton(self.right_joy, 3)
rtop4 = JoystickButton(self.right_joy, 4)
rtop5 = JoystickButton(self.right_joy, 5)
rtop6 = JoystickButton(self.right_joy, 6)
xboxX = JoystickButton(self.xbox, 3)
xboxY = JoystickButton(self.xbox, 4)
xboxB = JoystickButton(self.xbox, 2)
xboxA = JoystickButton(self.xbox, 1)
xboxLB = JoystickButton(self.xbox, 5)
xboxRB = JoystickButton(self.xbox, 6)
#xbox_left_XY = self.xbox.getY(9)
#self.xbox_XY = JoystickButton(self.xbox, 9)
self.xbox_left_XY = self.xbox.getX()
xboxBACK = JoystickButton(self.xbox, 7)
xboxSTART = JoystickButton(self.xbox, 8)
# # whenActive and whenInactive allows toggle between 2 commands
'''
Joystick 0 / Left Joystick Commands
'''
# ltop1.whileHeld(Do_Four_Bar(self.robot))
'''
Joystick 1 / Right Joystick Commands
'''
# rtop1.whileHeld(Do_Feeder(self.robot))
# rtop2.whileHeld(Do_Backwards_Feeder(self.robot))
# ltop2.whileHeld(Do_Backwards_Carrier(self.robot))
# # Button 2 toggles shifters
# rtop2.toggleWhenPressed(Do_Shifters_Toggle(self.robot))
#
'''
Joystick 2 / Xbox Controller Commands
'''
# # In frame
#XXX The INTENDED commands for comp
#xboxY.whileHeld(Do_Winch(self.robot))
#XXX do_activate_feeder does not override conditional command
#xboxX.whileHeld(Command_Shoot(self.robot))
#xboxA.whileHeld(Do_Big_Climb(self.robot))
#xboxB.whileHeld(Do_Little_Climb(self.robot))
#xboxRB.whileHeld(Command_Intake_Pickup(self.robot))
#xboxLB.whileHeld(Do_Carrier(self.robot))
#xboxX.whileHeld(Command_Shoot(self.robot))
#XXX debugging motor controller positions
#XXX Do_Activate_Feeder needs testing
xboxA.whileHeld(Do_Feeder(self.robot))
xboxB.whileHeld(Do_Carrier(self.robot))
xboxX.whileHeld(Do_Shoot(self.robot))
xboxRB.whileHeld(Do_Intake(self.robot))
xboxLB.whileHeld(Do_Four_Bar(self.robot))
#xboxBACK.whileHeld(Do_Backwards_Shoot(self.robot))
#xboxRB.whileHeld(Do_Stupid_Intake(self.robot))
# CLIMBER
# A was actuating biggum
#xboxA.whileHeld(Command_Climb_Up(self.robot))
# B was unactuating biggum
#xboxA.whenReleased(Command_Climb_Down(self.robot))
# on second try, A actuated both and B unactuated both
# before, A was big and B was little
#xboxA.whileHeld(Do_Big_Climb_Test(self.robot))
#xboxB.whileHeld(Do_Little_Climb_Test(self.robot))