From 59711d9c65d9bb6c346a46278741d59acf4fcc30 Mon Sep 17 00:00:00 2001 From: gitea Date: Tue, 20 Aug 2024 18:03:44 +0800 Subject: [PATCH] =?UTF-8?q?4.=20[main:=20openapi.py]=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20rl=5Ftask.set=5Frun=5Fparams=20=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=8C=E5=8F=AF=E8=AE=BE=E5=AE=9A=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E6=BB=91=E5=9D=97=E4=BB=A5=E5=8F=8A=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=BF=90=E8=A1=8C=205.=20[main:=20do=5Fbrake?= =?UTF-8?q?/do=5Fcurrent/factory=5Ftest.py]=EF=BC=9A=E5=9C=A8=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E8=BF=90=E5=8A=A8=E6=97=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=20`clibs.execution('rl=5Ftask.set=5Frun=5Fparams',=20hr,=20w2t?= =?UTF-8?q?,=20tab=5Fname,=20loop=5Fmode=3DTrue,=20override=3D1.0)`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/README.md | 4 +++- aio/assets/templates/json/rl_task.set_run_params.json | 9 +++++++++ aio/code/automatic_test/do_brake.py | 1 + aio/code/automatic_test/do_current.py | 1 + aio/code/commons/openapi.py | 3 +++ aio/code/durable_action/factory_test.py | 1 + main.py | 0 7 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 aio/assets/templates/json/rl_task.set_run_params.json create mode 100644 main.py diff --git a/aio/README.md b/aio/README.md index fd9b2d5..5adc60c 100644 --- a/aio/README.md +++ b/aio/README.md @@ -146,7 +146,7 @@ pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory . 10. 由于xCore系统问题,运行过程中可能会出现机器人宕机问题,如果遇到,可以手动重启控制柜,重新运行 11. 务必正确填写configs.xlsx中的Target页面,A1单元格可以选择正负方向急停 12. 工程文件可以手动重命名,按照机型存档,或者导出用于自动化测试 -13. 自动化测试前,需要将HMI程序速度设置为100%并同步至控制器,也即左下方速度滑条滑动至最大 +13. (可废弃,但未验证)自动化测试前,需要将HMI程序速度设置为100%并同步至控制器,也即左下方速度滑条滑动至最大 #### 6) 电机电流自动化测试 @@ -625,3 +625,5 @@ v0.2.0.8(2024/08/20) - 在 assets 目录新建 logs 目录,存放日志文件,并增加了相应的逻辑保证正常执行 2. [t_change_ui: aio.py]:增加 App 窗口图标代码 3. [t_change_ui: openapi.py]:将重复输出的网络错误提示,从 textbox 中转移到 debug.log 日志文件中 +4. [main: openapi.py]:新增 rl_task.set_run_params 指令支持,可设定速度滑块以及是否重复运行 +5. [main: do_brake/do_current/factory_test.py]:在初始化运动时增加 `clibs.execution('rl_task.set_run_params', hr, w2t, tab_name, loop_mode=True, override=1.0)` diff --git a/aio/assets/templates/json/rl_task.set_run_params.json b/aio/assets/templates/json/rl_task.set_run_params.json new file mode 100644 index 0000000..8490383 --- /dev/null +++ b/aio/assets/templates/json/rl_task.set_run_params.json @@ -0,0 +1,9 @@ +{ + "id": "xxxxxxxxxxx", + "module": "project", + "command": "rl_task.set_run_params", + "data": { + "loop_mode": true, + "override": 1.0 + } +} \ No newline at end of file diff --git a/aio/code/automatic_test/do_brake.py b/aio/code/automatic_test/do_brake.py index 76a07e9..8a4bf26 100644 --- a/aio/code/automatic_test/do_brake.py +++ b/aio/code/automatic_test/do_brake.py @@ -184,6 +184,7 @@ def run_rl(path, loadsel, hr, md, config_file, result_dirs, w2t): 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) + clibs.execution('rl_task.set_run_params', hr, w2t, tab_name, loop_mode=True, override=1.0) clibs.execution('rl_task.run', hr, w2t, tab_name, tasks=['brake', 'stop0_related']) _t_start = time() while True: diff --git a/aio/code/automatic_test/do_current.py b/aio/code/automatic_test/do_current.py index 0d15ab8..600d03d 100644 --- a/aio/code/automatic_test/do_current.py +++ b/aio/code/automatic_test/do_current.py @@ -290,6 +290,7 @@ def run_rl(path, hr, md, loadsel, w2t): clibs.execution('state.switch_motor_on', hr, w2t, tab_name) # 3. 开始运行程序,单轴运行35s + clibs.execution('rl_task.set_run_params', hr, w2t, tab_name, loop_mode=True, override=1.0) clibs.execution('rl_task.run', hr, w2t, tab_name, tasks=['current']) _t_start = time() while True: diff --git a/aio/code/commons/openapi.py b/aio/code/commons/openapi.py index fa38b66..e8f8a69 100644 --- a/aio/code/commons/openapi.py +++ b/aio/code/commons/openapi.py @@ -599,6 +599,9 @@ class HmiRequest(object): req['data']['tasks'] = kwargs['tasks'] case 'rl_task.pp_to_main' | 'rl_task.run' | 'rl_task.stop': req['data']['tasks'] = kwargs['tasks'] + case 'rl_task.set_run_params': + req['data']['loop_mode'] = kwargs['loop_mode'] + req['data']['override'] = kwargs['override'] case 'diagnosis.set_params': req['data']['display_pdo_params'] = kwargs['display_pdo_params'] case 'diagnosis.open': diff --git a/aio/code/durable_action/factory_test.py b/aio/code/durable_action/factory_test.py index b9c0d71..629d5ac 100644 --- a/aio/code/durable_action/factory_test.py +++ b/aio/code/durable_action/factory_test.py @@ -61,6 +61,7 @@ def run_rl(path, config_file, data_all, hr, md, w2t): clibs.execution('state.switch_motor_on', hr, w2t, tab_name) # 3. 开始运行程序 + clibs.execution('rl_task.set_run_params', hr, w2t, tab_name, loop_mode=True, override=1.0) clibs.execution('rl_task.run', hr, w2t, tab_name, tasks=['current']) _t_start = time() while True: diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29