From 14f6d430278905cdc42964c097316f0942d1e207 Mon Sep 17 00:00:00 2001 From: gitea Date: Mon, 16 Dec 2024 13:51:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=20[main:=20do=5Fbrake.py]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=20SSH=20=E7=9A=84=E5=9B=BA=E5=AE=9A=20IP=20?= =?UTF-8?q?=E4=B8=BA=20clibs=20=E4=B8=AD=E8=AF=BB=E5=8F=96=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=8C=E5=B9=B6=E5=88=A0=E9=99=A4=E4=BA=86?= =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E9=83=BD=20reload=20=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E4=BD=9C=EF=BC=8C=E6=94=B9=E4=B8=BA=E5=8F=AA?= =?UTF-8?q?=E5=9C=A8=E4=BF=AE=E6=94=B9=20RL=20=E5=B7=A5=E7=A8=8B=E6=97=B6?= =?UTF-8?q?=20reload=20=E4=B8=80=E6=AC=A1=EF=BC=8C=E6=97=A8=E5=9C=A8?= =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=9C=80=E8=BF=91=E9=A2=91=E7=B9=81=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=9A=84=E2=80=9C=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?overview.reload-xxxxxx=E2=80=9D=E8=AF=B7=E6=B1=82=E7=9A=84?= =?UTF-8?q?=E5=93=8D=E5=BA=94=EF=BC=8C=E5=88=9D=E6=AD=A5=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=20xCore=20=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E9=9D=9E=20AIO=20=E9=97=AE=E9=A2=98=EF=BC=8C=E5=B7=B2=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=E5=BE=85=E7=89=88=E6=9C=AC=E4=BF=AE=E5=A4=8D=202.=20[?= =?UTF-8?q?main:=20wavelogger.py]=20=E6=96=B0=E5=A2=9E=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A0=A1=E9=AA=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 --- aio/README.md | 6 ++++++ aio/assets/file_version_info.txt | 8 ++++---- aio/assets/templates/heartbeat | 2 +- aio/assets/vers | 2 +- aio/code/aio.py | 2 +- aio/code/automatic_test/do_brake.py | 6 +++--- aio/code/data_process/wavelogger.py | 26 +++++++++++++++++++++----- 8 files changed, 37 insertions(+), 18 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 28d3427..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rokae - -测试内容自动化处理 \ No newline at end of file diff --git a/aio/README.md b/aio/README.md index a95e87e..b0a7912 100644 --- a/aio/README.md +++ b/aio/README.md @@ -635,3 +635,9 @@ v0.2.1.0(2024/12/05) 1. [current: do_current.py] 增加了 hw_sensor_trq_feedback 曲线的采集 2. [current: current.py] 增加了 hw_sensor_trq_feedback 曲线数据的处理,以及修改了之前数据处理的逻辑 3. [current: clibs.py] 新增可手动修改连接 IP 地址的功能,存储在 assets/templates/ipaddr.txt 中,默认是 192.168.0.160 + +v0.2.1.1(2024/12/16) +1. [main: do_brake.py] 修改了 SSH 的固定 IP 为 clibs 中读取的内容,并删除了每次都 reload 工程的动作,改为只在修改 RL 工程时 reload 一次,旨在减少最近频繁出现的“无法获取overview.reload-xxxxxx”请求的响应,初步判断是 xCore 的问题,非 AIO 问题,已反馈待版本修复 +2. [main: wavelogger.py] 新增异常数据校验功能 + + diff --git a/aio/assets/file_version_info.txt b/aio/assets/file_version_info.txt index eab1995..faf5707 100644 --- a/aio/assets/file_version_info.txt +++ b/aio/assets/file_version_info.txt @@ -6,8 +6,8 @@ VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. - filevers=(0, 2, 1, 0), - prodvers=(0, 2, 1, 0), + filevers=(0, 2, 1, 1), + prodvers=(0, 2, 1, 1), # Contains a bitmask that specifies the valid bits 'flags'r mask=0x3f, # Contains a bitmask that specifies the Boolean attributes of the file. @@ -31,12 +31,12 @@ VSVersionInfo( '040904b0', [StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'), StringStruct('FileDescription', 'All in one automatic toolbox'), - StringStruct('FileVersion', '0.2.1.0 (2024-12-05)'), + StringStruct('FileVersion', '0.2.1.1 (2024-12-16)'), StringStruct('InternalName', 'AIO.exe'), StringStruct('LegalCopyright', '© 2024-2024 Manford Fan'), StringStruct('OriginalFilename', 'AIO.exe'), StringStruct('ProductName', 'AIO'), - StringStruct('ProductVersion', '0.2.1.0 (2024-12-05)')]) + StringStruct('ProductVersion', '0.2.1.1 (2024-12-16)')]) ]), VarFileInfo([VarStruct('Translation', [1033, 1200])]) ] diff --git a/aio/assets/templates/heartbeat b/aio/assets/templates/heartbeat index 56a6051..c227083 100644 --- a/aio/assets/templates/heartbeat +++ b/aio/assets/templates/heartbeat @@ -1 +1 @@ -1 \ No newline at end of file +0 \ No newline at end of file diff --git a/aio/assets/vers b/aio/assets/vers index 395de5a..21d7477 100644 --- a/aio/assets/vers +++ b/aio/assets/vers @@ -1 +1 @@ -0.2.1.0 @ 12/05/2024 \ No newline at end of file +0.2.1.1 @ 12/16/2024 \ No newline at end of file diff --git a/aio/code/aio.py b/aio/code/aio.py index 9278c01..460f301 100644 --- a/aio/code/aio.py +++ b/aio/code/aio.py @@ -96,7 +96,7 @@ class App(customtkinter.CTk): btns_func['log']['btn'].configure(command=lambda: self.thread_it(self.func_log_callback)) btns_func['end']['btn'].configure(command=lambda: self.thread_it(self.func_end_callback)) # 1.3 create version info - self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.2.1.0\nDate: 12/05/2024", font=self.my_font, text_color="#4F4F4F") + self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.2.1.1\nDate: 12/16/2024", font=self.my_font, text_color="#4F4F4F") self.frame_func.rowconfigure(6, weight=1) self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s') # ===================================================================== diff --git a/aio/code/automatic_test/do_brake.py b/aio/code/automatic_test/do_brake.py index 400ca0d..eba2cff 100644 --- a/aio/code/automatic_test/do_brake.py +++ b/aio/code/automatic_test/do_brake.py @@ -155,10 +155,10 @@ def run_rl(path, loadsel, hr, md, config_file, result_dirs, w2t): sleep(write_diagnosis) # 软急停超差后,等待写诊断时间,可通过configs.xlsx配置 while count == 1: - # 2. 修改未要执行的场景 + # 2. 修改要执行的场景 ssh = SSHClient() ssh.set_missing_host_key_policy(AutoAddPolicy()) - ssh.connect('192.168.0.160', 22, username='luoshi', password='luoshi2019') + ssh.connect(hostname=clibs.ip_addr, port=22, username='luoshi', password='luoshi2019') if ws.cell(row=1, column=1).value == 'positive': _rl_cmd = f"brake_E(j{axis}_{_reach}_p, j{axis}_{_reach}_n, p_speed, p_tool)" elif ws.cell(row=1, column=1).value == 'negative': @@ -238,7 +238,7 @@ def run_rl(path, loadsel, hr, md, config_file, result_dirs, w2t): md.reset_estop() # 其实没必要 md.clear_alarm() - clibs.execution('overview.reload', hr, w2t, tab_name, prj_path=prj_path, tasks=['brake', 'stop0_related']) + # clibs.execution('overview.reload', hr, w2t, tab_name, prj_path=prj_path, tasks=['brake', 'stop0_related']) clibs.execution('rl_task.pp_to_main', hr, w2t, tab_name, tasks=['brake', 'stop0_related']) clibs.execution('state.switch_auto', hr, w2t, tab_name) clibs.execution('state.switch_motor_on', hr, w2t, tab_name) diff --git a/aio/code/data_process/wavelogger.py b/aio/code/data_process/wavelogger.py index b1e53cf..a5f6633 100644 --- a/aio/code/data_process/wavelogger.py +++ b/aio/code/data_process/wavelogger.py @@ -13,7 +13,7 @@ def find_point(bof, step, pos, data_file, flag, df, row, w2t): # flag: greater than or lower than if flag == 'gt': while 0 < row < df.index[-1]-100: - _value = df.iloc[row, 2] + _value = float(df.iloc[row, 2]) if _value > 2: if bof == 'backward': row -= step @@ -33,7 +33,7 @@ def find_point(bof, step, pos, data_file, flag, df, row, w2t): row_target = row + 100 elif flag == 'lt': while 0 < row < df.index[-1]-100: - _value = df.iloc[row, 2] + _value = float(df.iloc[row, 2]) if _value < 2: if bof == 'backward': row -= step @@ -61,14 +61,19 @@ def get_cycle_info(data_file, df, row, step, w2t): # 1. 从最后读取数据,无论是大于1还是小于1,都舍弃,找到相反的值的起始点 # 2. 从起始点,继续往前寻找,找到与之数值相反的中间点 # 3. 从中间点,继续往前寻找,找到与之数值相反的结束点,至此,得到了高低数值的时间区间以及一轮的周期时间 - if df.iloc[row, 2] < 2: + # print(f"row = {row}") + # print(df.iloc[row, 2]) + if float(df.iloc[row, 2]) < 2: row = find_point('backward', step, 'a1', data_file, 'lt', df, row, w2t) _row = find_point('backward', step, 'a2', data_file, 'gt', df, row, w2t) _row = find_point('backward', step, 'a3', data_file, 'lt', df, _row, w2t) row_end = find_point('backward', step, 'a4', data_file, 'gt', df, _row, w2t) + # print(f"row_end = {row_end}") row_middle = find_point('backward', step, 'a5', data_file, 'lt', df, row_end, w2t) + # print(f"row_middle = {row_middle}") row_start = find_point('backward', step, 'a6', data_file, 'gt', df, row_middle, w2t) + # print(f"row_start = {row_start}") return row_end-row_middle, row_middle-row_start, row_end-row_start @@ -95,13 +100,14 @@ def preparation(data_file, wb, w2t): begin = int(row[1]) break df = read_csv(data_file, sep=',', encoding='gbk', skip_blank_lines=False, header=begin - 1, on_bad_lines='warn') + # print(f"df = {df}") low, high, cycle = get_cycle_info(data_file, df, df.index[-1]-110, 5, w2t) return ws, df, low, high, cycle def single_file_proc(ws, data_file, df, low, high, cycle, w2t): - _row = _row_lt = _row_gt = count = 1 + _row = _row_lt = _row_gt = count = count_i = 1 _step = 5 _data = {} row_max = df.index[-1]-100 @@ -110,19 +116,29 @@ def single_file_proc(ws, data_file, df, low, high, cycle, w2t): if count not in _data.keys(): _data[count] = [] - _value = df.iloc[_row, 2] + _value = float(df.iloc[_row, 2]) if _value < 2: _row_lt = find_point('forward', _step, 'c'+str(_row), data_file, 'lt', df, _row, w2t) + # print(f"_row_lt = {_row_lt}") _start = int(_row_gt + (_row_lt - _row_gt - 50) / 2) + # print(f"_start = {_start}") _end = _start + 50 + # print(f"_end = {_end}") + # print("========================================\n") value = df.iloc[_start:_end, 2].mean() + 3 * df.iloc[_start:_end, 2].std() + if value > 1: + w2t(f"{data_file} 文件第 {count} 轮 第 {count_i} 个数据可能有问题,需人工手动确认,确认有问题可删除,无问题则保留", 0, 0, 'orange') _data[count].append(value) + count_i += 1 else: _row_gt = find_point('forward', _step, 'c'+str(_row), data_file, 'gt', df, _row, w2t) + # print(f"_row_gt = {_row_gt}") if _row_gt - _row_lt > cycle * 2: count += 1 + count_i = 1 _row = max(_row_gt, _row_lt) + # print(f"_row = {_row}") for i in range(2, 10): ws.cell(row=1, column=i).value = f"第{i-1}次测试"