v0.4.0.7 interpreter improvement

This commit is contained in:
2025-05-29 16:15:14 +08:00
parent 66df4edbed
commit eb2463b943
9 changed files with 80 additions and 334 deletions

View File

@ -303,12 +303,15 @@ class CurrentDataProcess(QThread):
if abs(row_end+row_start-2*row_middle) > 1000:
clibs.logger("WARNING", "current", f"{axis} 轴数据占空比异常,处理数据可能有误,需检查!", "purple")
data, first_c, second_c, third_c, fourth_c = [], clibs.c_joint_vel-1, clibs.c_servo_trq-1, clibs.c_sensor_trq-1, clibs.c_estimate_trans_trq-1
data, data_appendix, first_c, second_c, third_c, fourth_c, fifth_c, sixth_c = [], [], clibs.c_joint_vel-1, clibs.c_servo_trq-1, clibs.c_sensor_trq-1, clibs.c_estimate_trans_trq-1, clibs.c_predict_trq_res-1, clibs.c_real_trq_res-1
for row in range(row_start, row_end+1):
data.append(df_origin.iloc[row, first_c])
data.append(df_origin.iloc[row, second_c])
data.append(df_origin.iloc[row, third_c])
data.append(df_origin.iloc[row, fourth_c])
for row in range(row_start, row_end + 1):
data_appendix.append(df_origin.iloc[row, fifth_c])
data_appendix.append(df_origin.iloc[row, sixth_c])
i = 0
for row in ws.iter_rows(min_row=2, min_col=2, max_row=150000, max_col=5):
@ -325,6 +328,19 @@ class CurrentDataProcess(QThread):
cell.value = None
i += 1
i = 0
ws.cell(row=1, column=27).value = "hw_predict_trq_res"
ws.cell(row=1, column=28).value = "hw_real_trq_res"
for row in ws.iter_rows(min_row=2, min_col=27, max_row=250000, max_col=28):
for cell in row:
try:
_ = f"{data_appendix[i]:.2f}"
cell.value = float(_)
except Exception:
cell.value = None
finally:
i += 1
def p_scenario(self, wb, scenario, rrs, dur_time):
clibs.logger("INFO", "current", f"本次处理的是电机电流场景数据,场景运动周期为 {dur_time}s", "blue")
for data_file in scenario:
@ -345,12 +361,15 @@ class CurrentDataProcess(QThread):
if row_end > df.index[-1]:
clibs.logger("ERROR", "current", f"位置超限:{data_file} 共有 {df.index[-1]} 条数据,无法取到第 {row_end} 条数据,需要确认场景周期时间...", "red")
data, first_c, second_c, third_c, fourth_c = [], clibs.c_joint_vel-1, clibs.c_servo_trq-1, clibs.c_sensor_trq-1, clibs.c_estimate_trans_trq-1
data, data_appendix, first_c, second_c, third_c, fourth_c, fifth_c, sixth_c = [], [], clibs.c_joint_vel-1, clibs.c_servo_trq-1, clibs.c_sensor_trq-1, clibs.c_estimate_trans_trq-1, clibs.c_predict_trq_res-1, clibs.c_real_trq_res-1
for row in range(row_start, row_end+1):
data.append(df_origin.iloc[row, first_c])
data.append(df_origin.iloc[row, second_c])
data.append(df_origin.iloc[row, third_c])
data.append(df_origin.iloc[row, fourth_c])
for row in range(row_start, row_end + 1):
data_appendix.append(df_origin.iloc[row, fifth_c])
data_appendix.append(df_origin.iloc[row, sixth_c])
i = 0
for row in ws.iter_rows(min_row=2, min_col=2, max_row=250000, max_col=5):
@ -367,6 +386,19 @@ class CurrentDataProcess(QThread):
ws.cell((i//4)+2, 1).value = None
i += 1
i = 0
ws.cell(row=1, column=27).value = "hw_predict_trq_res"
ws.cell(row=1, column=28).value = "hw_real_trq_res"
for row in ws.iter_rows(min_row=2, min_col=27, max_row=250000, max_col=28):
for cell in row:
try:
_ = f"{data_appendix[i]:.2f}"
cell.value = float(_)
except Exception:
cell.value = None
finally:
i += 1
def get_configs(self, config_file):
try:
if re.match("^[NXEC]B.*", config_file.split("/")[-1]):