From d35858e14eb174cd2f4f90b57b058a0ccc3466cc Mon Sep 17 00:00:00 2001 From: gitea Date: Sat, 13 Jul 2024 15:40:13 +0800 Subject: [PATCH] =?UTF-8?q?v0.1.9.2(2024/07/13)=201.=20[APIs:=20do=5Fcurre?= =?UTF-8?q?nt.py]=20=20=20=20-=20=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=BA=8F=E7=9F=AB=E6=AD=A3=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=E2=80=94=E2=80=94item['value'].reverse()=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E7=9A=84=E6=9B=B2=E7=BA=BF=E4=B8=BA=E5=B9=B3?= =?UTF-8?q?=E6=BB=91=E7=9A=84=E8=87=AA=E7=84=B6=E9=A1=BA=E5=BA=8F=202.=20[?= =?UTF-8?q?current:=20current.py]=20=20=20=20-=20max=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91=E7=9F=AB=E6=AD=A3=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E6=98=AF=E5=8F=96=E7=BB=9D=E5=AF=B9=E5=80=BC?= =?UTF-8?q?=E7=9A=84=E6=9C=80=E5=A4=A7=E5=80=BC=20=20=20=20-=20=E6=95=B4?= =?UTF-8?q?=E4=BD=93=E6=A2=B3=E7=90=86=E4=BA=86trq/trqh=E7=9A=84=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E8=B7=AF=E5=BE=84=EF=BC=8C=E7=8E=B0=E5=B7=B2=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/README.md | 6 +++++- aio/code/automatic_test/do_current.py | 2 -- aio/code/data_process/current.py | 20 +++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/aio/README.md b/aio/README.md index 47d4631..c367c30 100644 --- a/aio/README.md +++ b/aio/README.md @@ -473,5 +473,9 @@ v0.1.9.2(2024/07/13) - 调整单轴测试时间为35s,适配大负载机型,调整堵转电流持续时间15s,适当减少测试时间 - 将act信号置为False的动作放在初始化,增加程序健壮性 - 修改所有输出文件的命名,在扩展名之前加入时间戳 -3. [current: current.py]: 在find_point函数种,当无法找到正确点位时,继续执行,而不是直接终止执行 + - 删除多余的时序矫正语句——item['value'].reverse(),使输出的曲线为平滑的自然顺序 +3. [current: current.py] + - 在find_point函数种,当无法找到正确点位时,继续执行,而不是直接终止执行 + - max功能计算逻辑矫正,应该是取绝对值的最大值 + - 整体梳理了trq/trqh的传递路径,现已修正完毕 diff --git a/aio/code/automatic_test/do_current.py b/aio/code/automatic_test/do_current.py index 583f7ae..245fe0f 100644 --- a/aio/code/automatic_test/do_current.py +++ b/aio/code/automatic_test/do_current.py @@ -120,10 +120,8 @@ def data_proc_regular(path, filename, channel, scenario_time): for item in data: item['value'].reverse() if item.get('channel', None) == channel and item.get('name', None) == 'hw_joint_vel_feedback': - item['value'].reverse() _d2d_vel['hw_joint_vel_feedback'].extend(item['value']) elif item.get('channel', None) == channel and item.get('name', None) == 'device_servo_trq_feedback': - item['value'].reverse() _d2d_trq['device_servo_trq_feedback'].extend(item['value']) df1 = pandas.DataFrame.from_dict(_d2d_vel) diff --git a/aio/code/data_process/current.py b/aio/code/data_process/current.py index b7cd024..cef7a6b 100644 --- a/aio/code/data_process/current.py +++ b/aio/code/data_process/current.py @@ -79,7 +79,7 @@ def initialization(path, sub, w2t): return data_files -def current_max(data_files, rcs, trqh, w2t): +def current_max(data_files, rcs, trq, w2t): current = {1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: []} for data_file in data_files: if data_file.endswith('.data'): @@ -93,8 +93,8 @@ def current_max(data_files, rcs, trqh, w2t): axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j')) rca = rcs[axis-1] - col = df.columns.values[trqh-1] - c_max = df[col].max() + col = df.columns.values[trq-1] + c_max = df[col].abs().max() scale = 1 if data_file.endswith('.csv') else 1000 _ = abs(c_max/scale*rca) @@ -118,7 +118,7 @@ def current_max(data_files, rcs, trqh, w2t): return current -def current_avg(data_files, rcs, trqh, w2t): +def current_avg(data_files, rcs, trq, w2t): current = {1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: []} for data_file in data_files: if data_file.endswith('.data'): @@ -132,7 +132,7 @@ def current_avg(data_files, rcs, trqh, w2t): axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j')) rca = rcs[axis-1] - col = df.columns.values[trqh - 1] + col = df.columns.values[trq-1] c_std = df[col].std() c_avg = df[col].mean() @@ -223,8 +223,7 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol else: return _row_s, _row_e else: - # w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, exitcode, 'red') - w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, 0, 'red') + w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, exitcode, 'red') elif flag == 'gt': while _row_e > end_point: speed_avg = df.iloc[_row_s:_row_e, 0].abs().mean() @@ -235,8 +234,7 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol else: return _row_s, _row_e else: - # w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red') - w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, 0, 'red') + w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red') def p_single(wb, single, vel, trq, rpms, w2t): @@ -395,9 +393,9 @@ def main(path, sub, dur, vel, trq, trqh, w2t): data_files = initialization(path, sub, w2t) rpms, rcs = get_configs(path + '\\configs.xlsx', w2t) if sub == 'max': - current_max(data_files, rcs, trqh, w2t) + current_max(data_files, rcs, trq, w2t) elif sub == 'avg': - current_avg(data_files, rcs, trqh, w2t) + current_avg(data_files, rcs, trq, w2t) elif sub == 'cycle': current_cycle(dur, data_files, rcs, vel, trq, trqh, rpms, w2t) else: