-
Notifications
You must be signed in to change notification settings - Fork 0
/
robotMap.py
167 lines (147 loc) · 4.81 KB
/
robotMap.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import wpilib
class RobotMap:
def __init__(self, robot):
self.robot = robot
self.motorMap = MotorMap()
self.PneumaticMap = PneumaticMap()
self.ControlMap = ControlMap()
self.currentConfig = {
'Fly': {
'state': True,
'currentLimit': 25,
'triggerThresh': 35,
'time': 0.5
},
'Drive': {
'state': True,
'currentLimit': 35,
'triggerThresh': 40,
'time': 0.5
}}
class MotorMap:
def __init__(self):
self.motors = {}
self.PWMmotor = {}
"""
Drive Motors
"""
self.motors['RFDrive'] = {
'port': 0,
'inverted': True,
'jobType': 'master',
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
self.motors['RMDrive'] = {
'port': 2,
'inverted': True,
'jobType': 'slave',
'masterPort': 0,
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
self.motors['RBDrive'] = {
'port': 1,
'inverted': True,
'jobType': 'slave',
'masterPort': 0,
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
self.motors['LFDrive'] = {
'port': 5,
'inverted': False,
'jobType': 'master',
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
self.motors['LMDrive'] = {
'port': 4,
'inverted': False,
'jobType': 'slave',
'masterPort': 5,
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
self.motors['LBDrive'] = {
'port': 3,
'inverted': False,
'jobType': 'slave',
'masterPort': 5,
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
"""
Arm Motors
"""
self.motors['RLift'] = {
'port': 11,
'inverted': False,
'jobType': 'master',
'ContType': 'CAN',
'Type': 'TalonSRX',
'CurLimit': False}
self.motors['LLift'] = {
'port': 12,
'inverted': True,
'jobType': 'master',
'ContType': 'CAN',
'Type': 'TalonSRX',
'CurLimit': False}
"""
Shooter Motors
"""
self.motors['RFly'] = {
'port': 6,
'inverted': False,
'jobType': 'master',
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
self.motors['LFly'] = {
'port': 7,
'inverted': True,
'jobType': 'slave',
'masterPort': 10,
'ContType': 'CAN',
'Type': 'TalonFX',
'CurLimit': True}
"""
Intake motors
"""
self.motors['intake'] = {'port': 17, 'inverted': True, 'jobType': 'master',
'ContType': 'CAN', 'Type': 'TalonSRX', 'CurLimit': False}
self.motors['conveyor1'] = {'port': 16, 'inverted': False, 'jobType': 'master',
'ContType': 'CAN', 'Type': 'TalonSRX', 'CurLimit': False}
self.motors['conveyor2'] = {'port': 11, 'inverted': False, 'jobType': 'master',
'ContType': 'CAN', 'Type': 'TalonSRX', 'CurLimit': False}
self.motors['turret'] = {'port': 15, 'inverted': False, 'jobType': 'master',
'ContType': 'CAN', 'Type': 'TalonSRX', 'CurLimit': False}
class PneumaticMap:
def __init__(self):
self.pistons = {}
self.OUT = wpilib.DoubleSolenoid.Value.kForward
self.IN = wpilib.DoubleSolenoid.Value.kReverse
self.CLOSE = wpilib.DoubleSolenoid.Value.kOff
"""
Drive Pistons
"""
self.pistons['shifter'] = {'portA': 0, 'portB': 1, 'Type': 'Double'}
self.pistons['flyShifter'] = {'portA': 2, 'Type': 'single'}
"""
Intake Pistons
"""
self.pistons['intakeArm'] = {'portA': 3, 'portB': 4, 'Type': 'Double'}
self.pistons['ballStopper'] = {'portA': 5, 'portB': 6, 'Type': 'Double'}
self.pistons['liftRelease'] = {'portA': 0, 'portB': 1, 'Type': 'Double'}
class ControlMap:
def __init__(self):
self.Controller = {}
"""
drive controller
"""
self.Controller['xbox'] = {'Id': 0, 'Type': 'xbox', 'jobType': 'main'}
"""
Extra controller for controlling arm
"""
self.Controller['board'] = {'Id': 1, 'Type': 'custom', 'jobType': 'side'}