-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpickupV2.py
229 lines (204 loc) · 6.93 KB
/
pickupV2.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
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
225
226
227
228
229
import rpyc
import os
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.widget import Widget
from kivy.core.audio import SoundLoader
running_on_pie = True # pie or windows
Window.size = (480, 800)
if running_on_pie:
host = '192.168.1.10'
else:
host = '192.168.86.26'
def un_start():
os.system("sudo shutdown -h now")
class Pick(Widget):
def __init__(self, **kwargs):
super(Pick, self).__init__(**kwargs)
self.numberT = ''
self.nums = 0
self.more = False
self.data = ''
self.pops = ''
self.data2 = ''
self.click = SoundLoader.load('click.wav')
self.bot = rpyc.connect(host, port=12345)
def order(self, num):
if len(self.numberT) <= 3:
self.numberT += num
self.ids.number1.text = self.numberT
if self.click:
self.click.play()
def enter_num(self):
if len(self.numberT) >= 4:
test = self.bot.root.order(self.numberT)
if self.numberT == '0000':
un_start()
# App.get_running_app().stop()
if test != 'None':
self.numberT = test
self.look_at()
else:
self.numberT = ''
self.ids.number1.text = 'XXXX'
def end_it(self):
print(self.nums)
App.get_running_app().stop()
def clear_num(self):
self.numberT = ''
self.data = ''
self.pops = ''
self.ids.number1.text = 'XXXX'
def look_at(self):
self.ids.n0.pos = 60, 1460
self.ids.n1.pos = 60, 1460
self.ids.n2.pos = 60, 1460
self.ids.n3.pos = 60, 1460
self.ids.n4.pos = 60, 1460
self.ids.n5.pos = 60, 1460
self.ids.n6.pos = 60, 1460
self.ids.n7.pos = 60, 1460
self.ids.n8.pos = 60, 1460
self.ids.n9.pos = 60, 1460
self.ids.nc.pos = 60, 1460
self.ids.n_back.pos = 60, 1460
self.ids.ent.pos = 60, 1460
self.ids.new.pos = 10, 0
self.ids.orderT.pos = 175, 120
self.ids.star.pos = 170, -30
self.data = self.numberT
if self.data[2] == '1':
self.ids.do1.pos = 80, 400
if self.data[2] == '2':
self.ids.do2.pos = 80, 400
if self.data[2] == '3':
self.ids.do3.pos = 80, 400
if self.data[2] == '4':
self.ids.do4.pos = 80, 400
for m in range(0, int(self.data[3]) - 1):
self.pops += '1'
for m in range(0, int(self.data[4])):
self.pops += '2'
for m in range(0, int(self.data[5])):
self.pops += '3'
for m in range(0, int(self.data[6])):
self.pops += '4'
if len(self.pops) > 0:
# pop number 1
if self.pops[0] == '4':
self.ids.pop1.pos = 150, 200
if self.pops[0] == '3':
self.ids.pop2.pos = 150, 200
if self.pops[0] == '2':
self.ids.pop3.pos = 150, 200
if self.pops[0] == '1':
self.ids.pop4.pos = 150, 200
if len(self.pops) > 1:
# pop number 2
if self.pops[1] == '4':
self.ids.pop11.pos = 250, 200
if self.pops[1] == '3':
self.ids.pop21.pos = 250, 200
if self.pops[1] == '2':
self.ids.pop31.pos = 250, 200
if self.pops[1] == '1':
self.ids.pop41.pos = 250, 200
if len(self.pops) > 2:
# pop number 3
if self.pops[2] == '4':
self.ids.pop12.pos = 350, 200
if self.pops[2] == '3':
self.ids.pop22.pos = 350, 200
if self.pops[2] == '2':
self.ids.pop32.pos = 350, 200
if self.pops[2] == '1':
self.ids.pop42.pos = 350, 200
if len(self.pops) > 3:
# pop number 4
if self.pops[3] == '4':
self.ids.pop13.pos = 50, 200
if self.pops[3] == '3':
self.ids.pop23.pos = 50, 200
if self.pops[3] == '2':
self.ids.pop33.pos = 50, 200
if self.pops[3] == '1':
self.ids.pop43.pos = 50, 200
def reset_all(self):
# move out
self.ids.do1.pos = 80, 4000
self.ids.do2.pos = 80, 4000
self.ids.do3.pos = 80, 4000
self.ids.do4.pos = 80, 4000
self.ids.pop1.pos = 50, 2000
self.ids.pop2.pos = 50, 2000
self.ids.pop3.pos = 50, 2000
self.ids.pop4.pos = 50, 2000
self.ids.pop11.pos = 150, 2000
self.ids.pop21.pos = 150, 2000
self.ids.pop31.pos = 150, 2000
self.ids.pop41.pos = 150, 2000
self.ids.pop12.pos = 250, 2000
self.ids.pop22.pos = 250, 2000
self.ids.pop32.pos = 250, 2000
self.ids.pop42.pos = 250, 2000
self.ids.pop13.pos = 350, 2000
self.ids.pop23.pos = 350, 2000
self.ids.pop33.pos = 350, 2000
self.ids.pop43.pos = 350, 2000
self.ids.new.pos = 0, 1000
self.ids.orderT.pos = 175, 1200
self.ids.star.pos = 180, -3000
self.ids.orderS.pos = 175, 6000
# move in
self.ids.n0.pos = 155, 35
self.ids.n1.pos = 10, 435
self.ids.n2.pos = 155, 435
self.ids.n3.pos = 300, 435
self.ids.n4.pos = 10, 300
self.ids.n5.pos = 155, 300
self.ids.n6.pos = 300, 300
self.ids.n7.pos = 10, 170
self.ids.n8.pos = 155, 170
self.ids.n9.pos = 300, 170
self.ids.nc.pos = 325, 60
self.ids.n_back.pos = 35, 60
self.ids.ent.pos = 110, 580
self.clear_num()
def starting(self):
self.ids.do1.pos = 80, 4000
self.ids.do2.pos = 80, 4000
self.ids.do3.pos = 80, 4000
self.ids.do4.pos = 80, 4000
self.ids.pop1.pos = 50, 2000
self.ids.pop2.pos = 50, 2000
self.ids.pop3.pos = 50, 2000
self.ids.pop4.pos = 50, 2000
self.ids.pop11.pos = 150, 2000
self.ids.pop21.pos = 150, 2000
self.ids.pop31.pos = 150, 2000
self.ids.pop41.pos = 150, 2000
self.ids.pop12.pos = 250, 2000
self.ids.pop22.pos = 250, 2000
self.ids.pop32.pos = 250, 2000
self.ids.pop42.pos = 250, 2000
self.ids.pop13.pos = 350, 2000
self.ids.pop23.pos = 350, 2000
self.ids.pop33.pos = 350, 2000
self.ids.pop43.pos = 350, 2000
self.ids.new.pos = 0, 1000
self.ids.orderT.pos = 175, 1200
self.ids.star.pos = 180, -3000
self.ids.orderS.pos = 175, 600
# Clock.schedule_interval(self.update, 1)
print(self.numberT)
info = self.bot.root.robot(self.numberT)
print(info)
if info == 'started':
self.ids.orderS.text = 'Started.'
if info == 'end':
self.reset_all()
class PickApp(App):
def build(self):
return Pick()
if __name__ == '__main__':
PickApp().run()