-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshopbot_base_programs.py
More file actions
224 lines (188 loc) · 5.59 KB
/
shopbot_base_programs.py
File metadata and controls
224 lines (188 loc) · 5.59 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
## updated for test9.sbp
##################################################################
## This is the OpenSBP used for controlling the end effector, ##
## written by Grace and Greenfield, with some tweaking by all 3 ##
## of us. It's called by buildRectangles.py ##
## DO NOT EDIT THIS WITHOUT GREENFIELD'S PERMISSION. ##
##################################################################
off_camera = 300 #coordinate used to send end effector off camera for voxel and bolt reloading
header = "\nSA \'\'\'\'sets absolute coordinates\n"
end_effector_programs = """
OpenJaws:
SO, 6, 1
SO, 2, 1
SO, 3, 0
SO, 5, 0
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 1
RETURN
CloseJaws:
SO, 6, 1
SO, 2, 0
SO, 3, 1
SO, 5, 0
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 1
RETURN
Bolt:
SO, 6, 1
SO, 2, 1
SO, 3, 1
SO, 5, 0
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 8
RETURN
EngageGripper:
SO, 6, 1
SO, 2, 0
SO, 3, 0
SO, 5, 1
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 3
RETURN
DisengageGripper:
SO, 6, 1
SO, 2, 1
SO, 3, 0
SO, 5, 1
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 1.5
RETURN
OpenJawsHalf:
SO, 6, 1
SO, 2, 0
SO, 3, 1
SO, 5, 1
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 1
RETURN
CloseJawsHalf:
SO, 6, 1
SO, 2, 1
SO, 3, 1
SO, 5, 1
SO, 7, 0
PAUSE 1
SO, 6, 0
PAUSE 1
RETURN
Unbolt:
SO, 6, 1
SO, 2, 0
SO, 3, 0
SO, 5, 0
SO, 7, 1
PAUSE 1
SO, 6, 0
PAUSE 6
RETURN
"""
def position_attach_z(dx,dy,dz):
return """
M5 """ + str(-75) + """, """ + str(-off_camera) + """, """ + str(75) + """, 0, 0
\'\'Reload bolt and voxel
PAUSE 5
GOSUB EngageGripper
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 0
M5 """ + str(-30+dx) + """, """ + str(-30+dy) + """, """ + str(24+dz) + """, 0, 0
M5 """ + str(-15+dx) + """, """ + str(-15+dy) + """, """ + str(3+dz) + """, 0, 0
M5 """ + str(dx) + " , " + str(dy) + ", " + str(dz) + """, 0, 0
PAUSE 0.5
GOSUB CloseJaws
GOSUB Bolt
GOSUB OpenJaws
GOSUB DisengageGripper
PAUSE 1
M5 """ + str(-15+dx) + """, """ + str(-15+dy) + """, """ + str(3+dz) + """, 0, 0
GOSUB CloseJaws
M5 """ + str(-30+dx) + """, """ + str(-30+dy) + """, """ + str(24+dz) + """, 0, 0
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 0
GOSUB OpenJawsHalf"""
def position_attach_x(dx,dy,dz):
return """
M5 """ + str(-75) + """, """ + str(-off_camera) + """, """ + str(75) + """, 0, 120
\'\'Reload bolt and voxel
PAUSE 5
GOSUB EngageGripper
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 120
M5 """ + str(-24+dx) + """, """ + str(-30+dy) + """, """ + str(30+dz) + """, 0, 120
M5 """ + str(-3+dx) + """, """ + str(-15+dy) + """, """ + str(15+dz) + """, 0, 120
M5 """ + str(dx) + " , " + str(dy) + ", " + str(dz) + """, 0, 120
PAUSE 0.5
GOSUB CloseJaws
GOSUB Bolt
GOSUB OpenJaws
GOSUB DisengageGripper
PAUSE 1
M5 """ + str(-3+dx) + """, """ + str(-15+dy) + """, """ + str(15+dz) + """, 0, 120
GOSUB CloseJaws
M5 """ + str(-24+dx) + """, """ + str(-30+dy) + """, """ + str(30+dz) + """, 0, 120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 120
GOSUB OpenJawsHalf"""
def position_attach_y(dx,dy,dz):
return """
M5 """ + str(-75) + """, """ + str(-off_camera) + """, """ + str(75) + """, 0, -120
\'\'Reload bolt and voxel
PAUSE 5
GOSUB EngageGripper
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, -120
M5 """ + str(-30+dx) + """, """ + str(-24+dy) + """, """ + str(30+dz) + """, 0, -120
M5 """ + str(-15+dx) + """, """ + str(-3+dy) + """, """ + str(15+dz) + """, 0, -120
M5 """ + str(dx) + " , " + str(dy) + ", " + str(dz) + """, 0, -120
PAUSE 0.5
GOSUB CloseJaws
GOSUB Bolt
GOSUB OpenJaws
GOSUB DisengageGripper
PAUSE 1
M5 """ + str(-15+dx) + """, """ + str(-3+dy) + """, """ + str(15+dz) + """, 0, -120
GOSUB CloseJaws
M5 """ + str(-30+dx) + """, """ + str(-24+dy) + """, """ + str(30+dz) + """, 0, -120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, -120
GOSUB OpenJawsHalf"""
#print position_attach_z
def attach_x(dx,dy,dz):
return """
M5 """ + str(-75) + """, """ + str(-off_camera) + """, """ + str(75) + """, 0, 0
\'\'\'Reload bolt
PAUSE 5
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 120
M5 """ + str(0+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 120
M5 """ + str(0+dx) + """, """+ str(-34.8109+dy) + """, """ + str(34.8109+dz) + """, 0, 120
M5 """ + str(0+dx) + """, """+ str(0+dy) + """, """ + str(0+dz) + """, 0, 120
PAUSE 0.5
GOSUB CloseJaws
GOSUB Bolt
GOSUB OpenJawsHalf
M5 """ + str(0+dx) + """, """ + str(-34.8109+dy) + """, """ + str(34.8109+dz) + """, 0, 120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, 120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75) + """, 0, 0"""
def attach_y(dx,dy,dz):
return """
M5 """ + str(-75) + """, """ + str(-off_camera) + """, """ + str(75) + """, 0, 0
\'\'\'Reload bolt
PAUSE 5
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, -120
M5 """ + str(-75+dx) + """, """ + str(0+dy) + """, """ + str(75+dz) + """, 0, -120
M5 """ + str(-34.8109+dx) + """, """+ str(0+dy) + """, """ + str(34.8109+dz) + """, 0, -120
M5 """ + str(0+dx) + """, """+ str(0+dy) + """, """ + str(0+dz) + """, 0, -120
PAUSE 0.5
GOSUB CloseJaws
GOSUB Bolt
GOSUB OpenJawsHalf
M5 """ + str(-75+dx) + """, """ + str(0+dy) + """, """ + str(75+dz) + """, 0, -120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75+dz) + """, 0, -120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75) + """, 0, -120
M5 """ + str(-75+dx) + """, """ + str(-75+dy) + """, """ + str(75) + """, 0, 0"""