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