every 30th

This commit is contained in:
unknown 2024-09-17 16:48:57 +03:00
parent a18e28f8ca
commit cace9ce902
4 changed files with 47 additions and 21715 deletions

View File

@ -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

View File

@ -1,22 +1,22 @@
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: with open(file, 'r') as fp:
lines = fp.readlines() lines = fp.readlines()
# print(lines) print(file)
prev_x = None prev_x = None
prev_y = None prev_y = None
prev_z = None prev_z = None
result = [] result = []
step = None step = None
for l in lines[20:]: for l in lines[31:-10:30]:
data = l.strip().split(' ') data = l.strip().split(' ')
prep = {} prep = {}
for item in data: for item in data:
@ -26,10 +26,13 @@ with open(file, 'r') as fp:
if step == '01': if step == '01':
if 'A' in prep: if 'A' in prep:
prep['U'] = float(prep.pop('A')) / 100 prep['U'] = float(prep.pop('A')) / 100
if 'B' in prep:
prep['V'] = float(prep.pop('B')) / 100
if 'C' in prep: if 'C' in prep:
prep['W'] = float(prep.pop('C')) / 100 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']} 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])