every 30th
This commit is contained in:
parent
a18e28f8ca
commit
cace9ce902
|
@ -13,7 +13,7 @@ s.connect((host, port))
|
|||
def send_data(data):
|
||||
response = None
|
||||
if data["reqType"] == 'AddRCC':
|
||||
return
|
||||
# return
|
||||
pass
|
||||
s.send(str.encode(json.dumps(data)))
|
||||
response_data = s.recv(1024)
|
||||
|
@ -25,7 +25,7 @@ def send_data(data):
|
|||
elif data["reqType"] == 'command':
|
||||
# pprint({"request":data["cmdData"], "response":response["cmdReply"]})
|
||||
return response["cmdReply"]
|
||||
elif data["reqType"] == 'AddRCC':
|
||||
elif data["reqType"] == 'AddRCC' and "cmdReply" in response.keys():
|
||||
return response["cmdReply"]
|
||||
else:
|
||||
pprint(response)
|
||||
|
@ -53,15 +53,16 @@ print('axis', axis_coord)
|
|||
print('world', world_coord)
|
||||
print('remote command count', send_data(make_query_data(['RemoteCmdLen'])))
|
||||
|
||||
line_speed = 80.0
|
||||
line_smooth = 9
|
||||
line_speed = 100.0
|
||||
line_smooth = 0
|
||||
line_tool = 1
|
||||
|
||||
global_speed = 50
|
||||
global_speed = 100
|
||||
physical_speed = 8
|
||||
# laser_id = 15
|
||||
laser_id = 14
|
||||
filename = 'half-sphere-no-angle'
|
||||
# filename = 'half-sphere-no-angle'
|
||||
filename = 'half-sphere'
|
||||
|
||||
pass_size = 2
|
||||
|
||||
|
@ -118,14 +119,18 @@ with open(f'data/{filename}.nc.result', 'r') as fp:
|
|||
send_data(make_command_data(['modifyGSPD', str(global_speed * 10)]))
|
||||
send_data(make_addrcc_data([
|
||||
# Включили физическую скорость
|
||||
{"oneshot":"0", "action":"51","isUse":"1","speed":str(physical_speed*1000)},
|
||||
# {"oneshot":"0", "action":"51","isUse":"1","speed":str(physical_speed*1000)},
|
||||
# Поставили Y026 (laser id + 11) в TRUE -- ЛАЗЕР!!!!
|
||||
{"oneshot":"0", "action":"200","type":"0","io_status":"1", "point":str(laser_id)},
|
||||
], 1))
|
||||
|
||||
for i in range(pass_size, len(result) + 1, pass_size):
|
||||
print(f"Отправили на устройство команды {i - pass_size} ... {i}")
|
||||
send_data(make_addrcc_data(result[i-pass_size:i]))
|
||||
res_list = len(result) + 1
|
||||
if res_list > 3000:
|
||||
res_list = 3000
|
||||
|
||||
for i in range(pass_size, res_list, pass_size):
|
||||
print(f"Отправили на устройство команды {i} ... {i + 1}")
|
||||
send_data(make_addrcc_data(result[i:i+1]))
|
||||
|
||||
send_data(make_addrcc_data([
|
||||
{"oneshot":"0", "action":"51","isUse":"0"},
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
59
prepare.py
59
prepare.py
|
@ -1,37 +1,40 @@
|
|||
import glob
|
||||
|
||||
all_files = glob.glob("data/*.NC")
|
||||
file = all_files[0]
|
||||
all_files = glob.glob("data/*.nc")
|
||||
# file = all_files[0]
|
||||
|
||||
def get_value(c, s):
|
||||
[x] = [item.replace(s, '') for item in c if item.startswith(s)] or [0]
|
||||
return float(x)
|
||||
|
||||
with open(file, 'r') as fp:
|
||||
lines = fp.readlines()
|
||||
# print(lines)
|
||||
prev_x = None
|
||||
prev_y = None
|
||||
prev_z = None
|
||||
|
||||
result = []
|
||||
step = None
|
||||
for l in lines[20:]:
|
||||
data = l.strip().split(' ')
|
||||
prep = {}
|
||||
for item in data:
|
||||
prep[item[:1]] = item[1:]
|
||||
if 'G' in prep and prep['G'] == '01':
|
||||
step = prep['G']
|
||||
if step == '01':
|
||||
if 'A' in prep:
|
||||
prep['U'] = float(prep.pop('A')) / 100
|
||||
if 'C' in prep:
|
||||
prep['W'] = float(prep.pop('C')) / 100
|
||||
|
||||
filtered_prep = {p:prep[p] for p in prep if p in ['X', 'Y', 'Z', 'U', 'V', 'W']}
|
||||
if(len(filtered_prep.keys())):
|
||||
result.append([f"{p}{filtered_prep[p]}" for p in filtered_prep])
|
||||
for file in all_files:
|
||||
with open(file, 'r') as fp:
|
||||
lines = fp.readlines()
|
||||
print(file)
|
||||
prev_x = None
|
||||
prev_y = None
|
||||
prev_z = None
|
||||
|
||||
result = []
|
||||
step = None
|
||||
for l in lines[31:-10:30]:
|
||||
data = l.strip().split(' ')
|
||||
prep = {}
|
||||
for item in data:
|
||||
prep[item[:1]] = item[1:]
|
||||
if 'G' in prep and prep['G'] == '01':
|
||||
step = prep['G']
|
||||
if step == '01':
|
||||
if 'A' in prep:
|
||||
prep['U'] = float(prep.pop('A')) / 100
|
||||
if 'B' in prep:
|
||||
prep['V'] = float(prep.pop('B')) / 100
|
||||
if 'C' in prep:
|
||||
prep['W'] = float(prep.pop('C')) / 100
|
||||
|
||||
filtered_prep = {p:prep[p] for p in prep if p in ['X', 'Y', 'Z', 'U', 'V', 'W']}
|
||||
|
||||
if(len(filtered_prep.keys())):
|
||||
result.append([f"{p}{filtered_prep[p]}" for p in filtered_prep])
|
||||
|
||||
with open(f"{file}.result", 'w') as fp:
|
||||
fp.write('\n'.join(' '.join(str(i) for i in x) for x in result))
|
Loading…
Reference in New Issue