Compare commits
8 Commits
edafd91567
...
current
Author | SHA1 | Date | |
---|---|---|---|
4d297118e0 | |||
5c5168442f | |||
c9fa3a4473 | |||
880964f675 | |||
3481d3b496 | |||
bebaf292ac | |||
9f78b0e563 | |||
59711d9c65 |
@ -34,7 +34,7 @@
|
|||||||
打包时,只需要修改 clibs.py 中的 PREFIX 即可,调试时再修改回来
|
打包时,只需要修改 clibs.py 中的 PREFIX 即可,调试时再修改回来
|
||||||
|
|
||||||
```
|
```
|
||||||
pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory . --upx-dir "D:/Syncthing/common/A_Program/upx-4.2.4-win64/" --add-data "C:/Users/Administrator/AppData/Local/Programs/Python/Python312/Lib/site-packages/customtkinter;customtkinter/" --add-data "D:/Syncthing/company/D-测试工作/X-自动化测试/01-AIO/rokae/aio/assets/templates:templates" --version-file ../assets/file_version_info.txt -i ../assets/templates/icon.ico ../code/aio.py -p ../code/data_process/brake.py -p ../code/data_process/iso.py -p ../code/data_process/current.py -p ../code/data_process/wavelogger.py -p ../code/commons/openapi.py -p ../code/commons/clibs.py -p ../code/automatic_test/btn_functions.py -p ../code/automatic_test/do_current.py -p ../code/automatic_test/do_brake.py -p ../code/durable_action/factory_test.py
|
pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory . --upx-dir "D:/Syncthing/common/A_Program/upx-4.2.4-win64/" --add-data "C:/Users/Administrator/AppData/Local/Programs/Python/Python312/Lib/site-packages/customtkinter;customtkinter/" --add-data "D:\Syncthing\company\D-测试工作\X-自动化测试\01-Gitea\aio\aio\assets\templates:templates" --version-file ../assets/file_version_info.txt -i ../assets/templates/icon.ico ../code/aio.py -p ../code/data_process/brake.py -p ../code/data_process/iso.py -p ../code/data_process/current.py -p ../code/data_process/wavelogger.py -p ../code/commons/openapi.py -p ../code/commons/clibs.py -p ../code/automatic_test/btn_functions.py -p ../code/automatic_test/do_current.py -p ../code/automatic_test/do_brake.py -p ../code/durable_action/factory_test.py
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -146,7 +146,7 @@ pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory .
|
|||||||
10. 由于xCore系统问题,运行过程中可能会出现机器人宕机问题,如果遇到,可以手动重启控制柜,重新运行
|
10. 由于xCore系统问题,运行过程中可能会出现机器人宕机问题,如果遇到,可以手动重启控制柜,重新运行
|
||||||
11. 务必正确填写configs.xlsx中的Target页面,A1单元格可以选择正负方向急停
|
11. 务必正确填写configs.xlsx中的Target页面,A1单元格可以选择正负方向急停
|
||||||
12. 工程文件可以手动重命名,按照机型存档,或者导出用于自动化测试
|
12. 工程文件可以手动重命名,按照机型存档,或者导出用于自动化测试
|
||||||
13. 自动化测试前,需要将HMI程序速度设置为100%并同步至控制器,也即左下方速度滑条滑动至最大
|
13. (可废弃,但未验证)自动化测试前,需要将HMI程序速度设置为100%并同步至控制器,也即左下方速度滑条滑动至最大
|
||||||
|
|
||||||
#### 6) 电机电流自动化测试
|
#### 6) 电机电流自动化测试
|
||||||
|
|
||||||
@ -625,3 +625,13 @@ v0.2.0.8(2024/08/20)
|
|||||||
- 在 assets 目录新建 logs 目录,存放日志文件,并增加了相应的逻辑保证正常执行
|
- 在 assets 目录新建 logs 目录,存放日志文件,并增加了相应的逻辑保证正常执行
|
||||||
2. [t_change_ui: aio.py]:增加 App 窗口图标代码
|
2. [t_change_ui: aio.py]:增加 App 窗口图标代码
|
||||||
3. [t_change_ui: openapi.py]:将重复输出的网络错误提示,从 textbox 中转移到 debug.log 日志文件中
|
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)`
|
||||||
|
|
||||||
|
v0.2.0.9(2024/10/09)
|
||||||
|
1. [main: do_brake.py] 采集完成后,pending 3s,使速度完全将为 0
|
||||||
|
|
||||||
|
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
|
||||||
|
Binary file not shown.
@ -6,8 +6,8 @@ VSVersionInfo(
|
|||||||
ffi=FixedFileInfo(
|
ffi=FixedFileInfo(
|
||||||
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
||||||
# Set not needed items to zero 0.
|
# Set not needed items to zero 0.
|
||||||
filevers=(0, 2, 0, 8),
|
filevers=(0, 2, 1, 0),
|
||||||
prodvers=(0, 2, 0, 8),
|
prodvers=(0, 2, 1, 0),
|
||||||
# Contains a bitmask that specifies the valid bits 'flags'r
|
# Contains a bitmask that specifies the valid bits 'flags'r
|
||||||
mask=0x3f,
|
mask=0x3f,
|
||||||
# Contains a bitmask that specifies the Boolean attributes of the file.
|
# Contains a bitmask that specifies the Boolean attributes of the file.
|
||||||
@ -31,12 +31,12 @@ VSVersionInfo(
|
|||||||
'040904b0',
|
'040904b0',
|
||||||
[StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'),
|
[StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'),
|
||||||
StringStruct('FileDescription', 'All in one automatic toolbox'),
|
StringStruct('FileDescription', 'All in one automatic toolbox'),
|
||||||
StringStruct('FileVersion', '0.2.0.8 (2024-08-20)'),
|
StringStruct('FileVersion', '0.2.1.0 (2024-12-05)'),
|
||||||
StringStruct('InternalName', 'AIO.exe'),
|
StringStruct('InternalName', 'AIO.exe'),
|
||||||
StringStruct('LegalCopyright', '© 2024-2024 Manford Fan'),
|
StringStruct('LegalCopyright', '© 2024-2024 Manford Fan'),
|
||||||
StringStruct('OriginalFilename', 'AIO.exe'),
|
StringStruct('OriginalFilename', 'AIO.exe'),
|
||||||
StringStruct('ProductName', 'AIO'),
|
StringStruct('ProductName', 'AIO'),
|
||||||
StringStruct('ProductVersion', '0.2.0.8 (2024-08-20)')])
|
StringStruct('ProductVersion', '0.2.1.0 (2024-12-05)')])
|
||||||
]),
|
]),
|
||||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||||
]
|
]
|
||||||
|
@ -1 +1 @@
|
|||||||
0
|
1
|
1
aio/assets/templates/ipaddr.txt
Normal file
1
aio/assets/templates/ipaddr.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
192.168.0.160
|
9
aio/assets/templates/json/rl_task.set_run_params.json
Normal file
9
aio/assets/templates/json/rl_task.set_run_params.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"id": "xxxxxxxxxxx",
|
||||||
|
"module": "project",
|
||||||
|
"command": "rl_task.set_run_params",
|
||||||
|
"data": {
|
||||||
|
"loop_mode": true,
|
||||||
|
"override": 1.0
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
0.2.0.8 @ 08/20/2024
|
0.2.1.0 @ 12/05/2024
|
@ -39,7 +39,7 @@ btns_func = {
|
|||||||
}
|
}
|
||||||
widgets_dp = {
|
widgets_dp = {
|
||||||
'path': {'label': '', 'entry': '', 'row': 0, 'col': 1, 'text': '数据文件夹路径'},
|
'path': {'label': '', 'entry': '', 'row': 0, 'col': 1, 'text': '数据文件夹路径'},
|
||||||
'dur': {'label': '', 'entry': '', 'row': 1, 'col': 1, 'text': '周期时间'},
|
'dur': {'label': '', 'entry': '', 'row': 1, 'col': 9, 'text': '周期时间'},
|
||||||
'vel': {'label': '', 'optionmenu': '', 'row': 1, 'col': 1, 'text': ''},
|
'vel': {'label': '', 'optionmenu': '', 'row': 1, 'col': 1, 'text': ''},
|
||||||
'trq': {'label': '', 'optionmenu': '', 'row': 1, 'col': 3, 'text': ''},
|
'trq': {'label': '', 'optionmenu': '', 'row': 1, 'col': 3, 'text': ''},
|
||||||
'trqh': {'label': '', 'optionmenu': '', 'row': 1, 'col': 5, 'text': ''},
|
'trqh': {'label': '', 'optionmenu': '', 'row': 1, 'col': 5, 'text': ''},
|
||||||
@ -96,7 +96,7 @@ class App(customtkinter.CTk):
|
|||||||
btns_func['log']['btn'].configure(command=lambda: self.thread_it(self.func_log_callback))
|
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))
|
btns_func['end']['btn'].configure(command=lambda: self.thread_it(self.func_end_callback))
|
||||||
# 1.3 create version info
|
# 1.3 create version info
|
||||||
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.2.0.8\nDate: 08/20/2024", font=self.my_font, text_color="#4F4F4F")
|
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.frame_func.rowconfigure(6, weight=1)
|
self.frame_func.rowconfigure(6, weight=1)
|
||||||
self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s')
|
self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s')
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
|
@ -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('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_auto', hr, w2t, tab_name)
|
||||||
clibs.execution('state.switch_motor_on', 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'])
|
clibs.execution('rl_task.run', hr, w2t, tab_name, tasks=['brake', 'stop0_related'])
|
||||||
_t_start = time()
|
_t_start = time()
|
||||||
while True:
|
while True:
|
||||||
@ -256,7 +257,7 @@ def run_rl(path, loadsel, hr, md, config_file, result_dirs, w2t):
|
|||||||
_t_start = time()
|
_t_start = time()
|
||||||
while True:
|
while True:
|
||||||
if md.read_brake_done() == 1:
|
if md.read_brake_done() == 1:
|
||||||
sleep(1) # 保证速度归零
|
sleep(4) # 保证速度归零
|
||||||
md.write_probe(0)
|
md.write_probe(0)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -21,6 +21,12 @@ display_pdo_params = [
|
|||||||
{"name": "device_servo_trq_feedback", "channel": 3},
|
{"name": "device_servo_trq_feedback", "channel": 3},
|
||||||
{"name": "device_servo_trq_feedback", "channel": 4},
|
{"name": "device_servo_trq_feedback", "channel": 4},
|
||||||
{"name": "device_servo_trq_feedback", "channel": 5},
|
{"name": "device_servo_trq_feedback", "channel": 5},
|
||||||
|
{"name": "hw_sensor_trq_feedback", "channel": 0},
|
||||||
|
{"name": "hw_sensor_trq_feedback", "channel": 1},
|
||||||
|
{"name": "hw_sensor_trq_feedback", "channel": 2},
|
||||||
|
{"name": "hw_sensor_trq_feedback", "channel": 3},
|
||||||
|
{"name": "hw_sensor_trq_feedback", "channel": 4},
|
||||||
|
{"name": "hw_sensor_trq_feedback", "channel": 5},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +69,7 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
lines = f_obj.readlines()
|
lines = f_obj.readlines()
|
||||||
_d2d_vel = {'hw_joint_vel_feedback': []}
|
_d2d_vel = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq = {'device_servo_trq_feedback': []}
|
_d2d_trq = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor = {'hw_sensor_trq_feedback': []}
|
||||||
for line in lines[-500:]: # 保留最后25s的数据
|
for line in lines[-500:]: # 保留最后25s的数据
|
||||||
data = eval(line.strip())['data']
|
data = eval(line.strip())['data']
|
||||||
for item in data:
|
for item in data:
|
||||||
@ -74,10 +81,13 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
_d2d_vel['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == channel and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == channel and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == channel and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
|
|
||||||
df1 = DataFrame.from_dict(_d2d_vel)
|
df1 = DataFrame.from_dict(_d2d_vel)
|
||||||
df2 = DataFrame.from_dict(_d2d_trq)
|
df2 = DataFrame.from_dict(_d2d_trq)
|
||||||
df = concat([df1, df2], axis=1)
|
df3 = DataFrame.from_dict(_d2d_sensor)
|
||||||
|
df = concat([df1, df2, df3], axis=1)
|
||||||
_filename = f'{path}\\single\\j{channel+1}_single_{time()}.data'
|
_filename = f'{path}\\single\\j{channel+1}_single_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
elif channel in list(range(6, 9)):
|
elif channel in list(range(6, 9)):
|
||||||
@ -85,16 +95,22 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
lines = f_obj.readlines()
|
lines = f_obj.readlines()
|
||||||
_d2d_vel_0 = {'hw_joint_vel_feedback': []}
|
_d2d_vel_0 = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq_0 = {'device_servo_trq_feedback': []}
|
_d2d_trq_0 = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor_0 = {'hw_sensor_trq_feedback': []}
|
||||||
_d2d_vel_1 = {'hw_joint_vel_feedback': []}
|
_d2d_vel_1 = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq_1 = {'device_servo_trq_feedback': []}
|
_d2d_trq_1 = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor_1 = {'hw_sensor_trq_feedback': []}
|
||||||
_d2d_vel_2 = {'hw_joint_vel_feedback': []}
|
_d2d_vel_2 = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq_2 = {'device_servo_trq_feedback': []}
|
_d2d_trq_2 = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor_2 = {'hw_sensor_trq_feedback': []}
|
||||||
_d2d_vel_3 = {'hw_joint_vel_feedback': []}
|
_d2d_vel_3 = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq_3 = {'device_servo_trq_feedback': []}
|
_d2d_trq_3 = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor_3 = {'hw_sensor_trq_feedback': []}
|
||||||
_d2d_vel_4 = {'hw_joint_vel_feedback': []}
|
_d2d_vel_4 = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq_4 = {'device_servo_trq_feedback': []}
|
_d2d_trq_4 = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor_4 = {'hw_sensor_trq_feedback': []}
|
||||||
_d2d_vel_5 = {'hw_joint_vel_feedback': []}
|
_d2d_vel_5 = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq_5 = {'device_servo_trq_feedback': []}
|
_d2d_trq_5 = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor_5 = {'hw_sensor_trq_feedback': []}
|
||||||
for line in lines:
|
for line in lines:
|
||||||
data = eval(line.strip())['data']
|
data = eval(line.strip())['data']
|
||||||
for item in data:
|
for item in data:
|
||||||
@ -106,60 +122,78 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
_d2d_vel_0['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel_0['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 0 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == 0 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq_0['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq_0['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == 0 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor_0['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 1 and item.get('name', None) == 'hw_joint_vel_feedback':
|
elif item.get('channel', None) == 1 and item.get('name', None) == 'hw_joint_vel_feedback':
|
||||||
_d2d_vel_1['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel_1['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 1 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == 1 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq_1['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq_1['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == 1 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor_1['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 2 and item.get('name', None) == 'hw_joint_vel_feedback':
|
elif item.get('channel', None) == 2 and item.get('name', None) == 'hw_joint_vel_feedback':
|
||||||
_d2d_vel_2['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel_2['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 2 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == 2 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq_2['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq_2['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == 3 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor_2['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 3 and item.get('name', None) == 'hw_joint_vel_feedback':
|
elif item.get('channel', None) == 3 and item.get('name', None) == 'hw_joint_vel_feedback':
|
||||||
_d2d_vel_3['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel_3['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 3 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == 3 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq_3['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq_3['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == 3 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor_3['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 4 and item.get('name', None) == 'hw_joint_vel_feedback':
|
elif item.get('channel', None) == 4 and item.get('name', None) == 'hw_joint_vel_feedback':
|
||||||
_d2d_vel_4['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel_4['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 4 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == 4 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq_4['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq_4['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == 4 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor_4['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 5 and item.get('name', None) == 'hw_joint_vel_feedback':
|
elif item.get('channel', None) == 5 and item.get('name', None) == 'hw_joint_vel_feedback':
|
||||||
_d2d_vel_5['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel_5['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == 5 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == 5 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq_5['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq_5['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == 5 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor_5['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
|
|
||||||
df_01 = DataFrame.from_dict(_d2d_vel_0)
|
df_01 = DataFrame.from_dict(_d2d_vel_0)
|
||||||
df_02 = DataFrame.from_dict(_d2d_trq_0)
|
df_02 = DataFrame.from_dict(_d2d_trq_0)
|
||||||
df = concat([df_01, df_02], axis=1)
|
df_03 = DataFrame.from_dict(_d2d_sensor_0)
|
||||||
|
df = concat([df_01, df_02, df_03], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j1_s_{channel-5}_{scenario_time}_{time()}.data'
|
_filename = f'{path}\\s_{channel-5}\\j1_s_{channel-5}_{scenario_time}_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
df_01 = DataFrame.from_dict(_d2d_vel_1)
|
df_01 = DataFrame.from_dict(_d2d_vel_1)
|
||||||
df_02 = DataFrame.from_dict(_d2d_trq_1)
|
df_02 = DataFrame.from_dict(_d2d_trq_1)
|
||||||
df = concat([df_01, df_02], axis=1)
|
df_03 = DataFrame.from_dict(_d2d_sensor_1)
|
||||||
|
df = concat([df_01, df_02, df_03], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j2_s_{channel-5}_{scenario_time}_{time()}.data'
|
_filename = f'{path}\\s_{channel-5}\\j2_s_{channel-5}_{scenario_time}_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
df_01 = DataFrame.from_dict(_d2d_vel_2)
|
df_01 = DataFrame.from_dict(_d2d_vel_2)
|
||||||
df_02 = DataFrame.from_dict(_d2d_trq_2)
|
df_02 = DataFrame.from_dict(_d2d_trq_2)
|
||||||
df = concat([df_01, df_02], axis=1)
|
df_03 = DataFrame.from_dict(_d2d_sensor_2)
|
||||||
|
df = concat([df_01, df_02, df_03], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j3_s_{channel-5}_{scenario_time}_{time()}.data'
|
_filename = f'{path}\\s_{channel-5}\\j3_s_{channel-5}_{scenario_time}_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
df_01 = DataFrame.from_dict(_d2d_vel_3)
|
df_01 = DataFrame.from_dict(_d2d_vel_3)
|
||||||
df_02 = DataFrame.from_dict(_d2d_trq_3)
|
df_02 = DataFrame.from_dict(_d2d_trq_3)
|
||||||
df = concat([df_01, df_02], axis=1)
|
df_03 = DataFrame.from_dict(_d2d_sensor_3)
|
||||||
|
df = concat([df_01, df_02, df_03], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j4_s_{channel-5}_{scenario_time}_{time()}.data'
|
_filename = f'{path}\\s_{channel-5}\\j4_s_{channel-5}_{scenario_time}_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
df_01 = DataFrame.from_dict(_d2d_vel_4)
|
df_01 = DataFrame.from_dict(_d2d_vel_4)
|
||||||
df_02 = DataFrame.from_dict(_d2d_trq_4)
|
df_02 = DataFrame.from_dict(_d2d_trq_4)
|
||||||
df = concat([df_01, df_02], axis=1)
|
df_03 = DataFrame.from_dict(_d2d_sensor_4)
|
||||||
|
df = concat([df_01, df_02, df_03], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j5_s_{channel-5}_{scenario_time}_{time()}.data'
|
_filename = f'{path}\\s_{channel-5}\\j5_s_{channel-5}_{scenario_time}_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
df_01 = DataFrame.from_dict(_d2d_vel_5)
|
df_01 = DataFrame.from_dict(_d2d_vel_5)
|
||||||
df_02 = DataFrame.from_dict(_d2d_trq_5)
|
df_02 = DataFrame.from_dict(_d2d_trq_5)
|
||||||
df = concat([df_01, df_02], axis=1)
|
df_03 = DataFrame.from_dict(_d2d_sensor_5)
|
||||||
|
df = concat([df_01, df_02, df_03], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j6_s_{channel-5}_{scenario_time}_{time()}.data'
|
_filename = f'{path}\\s_{channel-5}\\j6_s_{channel-5}_{scenario_time}_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
elif channel in list(range(9, 15)):
|
elif channel in list(range(9, 15)):
|
||||||
@ -167,6 +201,7 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
lines = f_obj.readlines()
|
lines = f_obj.readlines()
|
||||||
_d2d_vel = {'hw_joint_vel_feedback': []}
|
_d2d_vel = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq = {'device_servo_trq_feedback': []}
|
_d2d_trq = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor = {'hw_sensor_trq_feedback': []}
|
||||||
for line in lines[-300:]: # 保留最后15s的数据
|
for line in lines[-300:]: # 保留最后15s的数据
|
||||||
data = eval(line.strip())['data']
|
data = eval(line.strip())['data']
|
||||||
for item in data:
|
for item in data:
|
||||||
@ -178,10 +213,13 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
_d2d_vel['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == channel-9 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == channel-9 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == channel-9 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_sensor['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
|
|
||||||
df1 = DataFrame.from_dict(_d2d_vel)
|
df1 = DataFrame.from_dict(_d2d_vel)
|
||||||
df2 = DataFrame.from_dict(_d2d_trq)
|
df2 = DataFrame.from_dict(_d2d_trq)
|
||||||
df = concat([df1, df2], axis=1)
|
df3 = DataFrame.from_dict(_d2d_sensor)
|
||||||
|
df = concat([df1, df2, df3], axis=1)
|
||||||
_filename = f'{path}\\single\\j{channel-8}_hold_{time()}.data'
|
_filename = f'{path}\\single\\j{channel-8}_hold_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
@ -191,6 +229,7 @@ def data_proc_inertia(path, filename, channel):
|
|||||||
lines = f_obj.readlines()
|
lines = f_obj.readlines()
|
||||||
_d2d_vel = {'hw_joint_vel_feedback': []}
|
_d2d_vel = {'hw_joint_vel_feedback': []}
|
||||||
_d2d_trq = {'device_servo_trq_feedback': []}
|
_d2d_trq = {'device_servo_trq_feedback': []}
|
||||||
|
_d2d_sensor = {'hw_sensor_trq_feedback': []}
|
||||||
for line in lines:
|
for line in lines:
|
||||||
data = eval(line.strip())['data']
|
data = eval(line.strip())['data']
|
||||||
for item in data:
|
for item in data:
|
||||||
@ -202,10 +241,13 @@ def data_proc_inertia(path, filename, channel):
|
|||||||
_d2d_vel['hw_joint_vel_feedback'].extend(item['value'])
|
_d2d_vel['hw_joint_vel_feedback'].extend(item['value'])
|
||||||
elif item.get('channel', None) == channel+3 and item.get('name', None) == 'device_servo_trq_feedback':
|
elif item.get('channel', None) == channel+3 and item.get('name', None) == 'device_servo_trq_feedback':
|
||||||
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
elif item.get('channel', None) == channel+3 and item.get('name', None) == 'hw_sensor_trq_feedback':
|
||||||
|
_d2d_trq['hw_sensor_trq_feedback'].extend(item['value'])
|
||||||
|
|
||||||
df1 = DataFrame.from_dict(_d2d_vel)
|
df1 = DataFrame.from_dict(_d2d_vel)
|
||||||
df2 = DataFrame.from_dict(_d2d_trq)
|
df2 = DataFrame.from_dict(_d2d_trq)
|
||||||
df = concat([df1, df2], axis=1)
|
df3 = DataFrame.from_dict(_d2d_sensor)
|
||||||
|
df = concat([df1, df2, df3], axis=1)
|
||||||
_filename = f'{path}\\inertia\\j{channel+4}_inertia_{time()}.data'
|
_filename = f'{path}\\inertia\\j{channel+4}_inertia_{time()}.data'
|
||||||
df.to_csv(_filename, sep='\t', index=False)
|
df.to_csv(_filename, sep='\t', index=False)
|
||||||
|
|
||||||
@ -290,6 +332,7 @@ def run_rl(path, hr, md, loadsel, w2t):
|
|||||||
clibs.execution('state.switch_motor_on', hr, w2t, tab_name)
|
clibs.execution('state.switch_motor_on', hr, w2t, tab_name)
|
||||||
|
|
||||||
# 3. 开始运行程序,单轴运行35s
|
# 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'])
|
clibs.execution('rl_task.run', hr, w2t, tab_name, tasks=['current'])
|
||||||
_t_start = time()
|
_t_start = time()
|
||||||
while True:
|
while True:
|
||||||
|
@ -8,16 +8,15 @@ from logging import getLogger
|
|||||||
from logging.config import dictConfig
|
from logging.config import dictConfig
|
||||||
import concurrent_log_handler
|
import concurrent_log_handler
|
||||||
|
|
||||||
ip_addr = '192.168.0.160' # for product
|
|
||||||
# ip_addr = '192.168.84.129' # for test
|
|
||||||
RADIAN = 57.3 # 180 / 3.1415926
|
RADIAN = 57.3 # 180 / 3.1415926
|
||||||
MAX_FRAME_SIZE = 1024
|
MAX_FRAME_SIZE = 1024
|
||||||
TIMEOUT = 5
|
TIMEOUT = 5
|
||||||
setdefaulttimeout(TIMEOUT)
|
setdefaulttimeout(TIMEOUT)
|
||||||
tab_names = {'dp': 'Data Process', 'at': 'Automatic Test', 'da': 'Duration Action', 'op': 'openapi'}
|
tab_names = {'dp': 'Data Process', 'at': 'Automatic Test', 'da': 'Duration Action', 'op': 'openapi'}
|
||||||
# PREFIX = '' # for pyinstaller packaging
|
# PREFIX = '' # for pyinstaller packaging
|
||||||
PREFIX = '../assets/' # for source code debug
|
PREFIX = '../assets/' # for source code testing and debug
|
||||||
app_icon = f'{PREFIX}templates/icon.ico'
|
app_icon = f'{PREFIX}templates/icon.ico'
|
||||||
|
ip_file = f'{PREFIX}templates/ipaddr.txt'
|
||||||
log_path = f'{PREFIX}templates/logs/'
|
log_path = f'{PREFIX}templates/logs/'
|
||||||
log_data_hmi = f'{PREFIX}templates/logs/c_msg.log'
|
log_data_hmi = f'{PREFIX}templates/logs/c_msg.log'
|
||||||
log_data_debug = f'{PREFIX}templates/logs/debug.log'
|
log_data_debug = f'{PREFIX}templates/logs/debug.log'
|
||||||
@ -42,6 +41,14 @@ durable_data_current_max = {
|
|||||||
'axis5': [0 for _ in range(18)],
|
'axis5': [0 for _ in range(18)],
|
||||||
'axis6': [0 for _ in range(18)],
|
'axis6': [0 for _ in range(18)],
|
||||||
}
|
}
|
||||||
|
try:
|
||||||
|
with open(ip_file, mode="r", encoding="utf-8") as f_ipaddr:
|
||||||
|
ip_addr = f_ipaddr.read().strip()
|
||||||
|
except:
|
||||||
|
ip_addr = '192.168.0.160'
|
||||||
|
|
||||||
|
# ip_addr = '192.168.0.160' # for product
|
||||||
|
# ip_addr = '192.168.84.129' # for test
|
||||||
|
|
||||||
if not exists(log_path):
|
if not exists(log_path):
|
||||||
mkdir(log_path)
|
mkdir(log_path)
|
||||||
|
@ -19,7 +19,7 @@ class ModbusRequest(object):
|
|||||||
self.host = clibs.ip_addr
|
self.host = clibs.ip_addr
|
||||||
self.port = 502
|
self.port = 502
|
||||||
self.interval = 0.3
|
self.interval = 0.3
|
||||||
self.c = ModbusTcpClient(self.host, self.port)
|
self.c = ModbusTcpClient(host=self.host, port=self.port)
|
||||||
self.c.connect()
|
self.c.connect()
|
||||||
|
|
||||||
def motor_off(self):
|
def motor_off(self):
|
||||||
@ -599,6 +599,9 @@ class HmiRequest(object):
|
|||||||
req['data']['tasks'] = kwargs['tasks']
|
req['data']['tasks'] = kwargs['tasks']
|
||||||
case 'rl_task.pp_to_main' | 'rl_task.run' | 'rl_task.stop':
|
case 'rl_task.pp_to_main' | 'rl_task.run' | 'rl_task.stop':
|
||||||
req['data']['tasks'] = kwargs['tasks']
|
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':
|
case 'diagnosis.set_params':
|
||||||
req['data']['display_pdo_params'] = kwargs['display_pdo_params']
|
req['data']['display_pdo_params'] = kwargs['display_pdo_params']
|
||||||
case 'diagnosis.open':
|
case 'diagnosis.open':
|
||||||
|
@ -33,7 +33,8 @@ def initialization(path, sub, w2t):
|
|||||||
else:
|
else:
|
||||||
if not (match('j[1-7].*\\.data', filename) or match('j[1-7].*\\.csv', filename)):
|
if not (match('j[1-7].*\\.data', filename) or match('j[1-7].*\\.csv', filename)):
|
||||||
msg = f"不合规 {data_file}\n"
|
msg = f"不合规 {data_file}\n"
|
||||||
msg += f"所有数据文件必须以 jx_ 开头,以 .data/csv 结尾(x取值1-7),配置文件需要命名为\"configs.xlsx\",结果文件需要命名为\"T_电机电流.xlsx\",请检查后重新运行。"
|
msg += f"所有数据文件必须以 jx_ 开头,以 .data/csv 结尾(x取值1-7),配置文件需要命名为\"configs.xlsx\",结果文件需要命名为\"T_电机电流.xlsx\",请检查后重新运行。\n"
|
||||||
|
msg += "使用max/avg功能时,需要有配置文件表格\"configs.xlsx\";使用cycle功能时,需要有电机电流数据处理\"T_电机电流.xlsx\"和配置文件\"configs.xlsx\"两个表格,确认后重新运行!"
|
||||||
w2t(msg, 0, 6, 'red')
|
w2t(msg, 0, 6, 'red')
|
||||||
|
|
||||||
if not ((sub == 'cycle' and count == 2) or (sub != 'cycle' and count == 1)):
|
if not ((sub == 'cycle' and count == 2) or (sub != 'cycle' and count == 1)):
|
||||||
@ -186,7 +187,6 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
|
|||||||
else:
|
else:
|
||||||
return _row_s, _row_e
|
return _row_s, _row_e
|
||||||
else:
|
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, 0, 'red')
|
||||||
elif flag == 'gt':
|
elif flag == 'gt':
|
||||||
while _row_e > end_point:
|
while _row_e > end_point:
|
||||||
@ -198,7 +198,6 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
|
|||||||
else:
|
else:
|
||||||
return _row_s, _row_e
|
return _row_s, _row_e
|
||||||
else:
|
else:
|
||||||
# w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red')
|
|
||||||
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, 0, 'red')
|
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, 0, 'red')
|
||||||
|
|
||||||
|
|
||||||
@ -234,6 +233,7 @@ def p_single(wb, single, vel, trq, rpms, rrs, w2t):
|
|||||||
df_1 = df[col_names[vel-1]].multiply(rpm*addition)
|
df_1 = df[col_names[vel-1]].multiply(rpm*addition)
|
||||||
df_2 = df[col_names[trq-1]].multiply(scale)
|
df_2 = df[col_names[trq-1]].multiply(scale)
|
||||||
# print(df_1.abs().max())
|
# print(df_1.abs().max())
|
||||||
|
df_origin = df
|
||||||
df = concat([df_1, df_2], axis=1)
|
df = concat([df_1, df_2], axis=1)
|
||||||
|
|
||||||
_step = 5 if data_file.endswith('.csv') else 50
|
_step = 5 if data_file.endswith('.csv') else 50
|
||||||
@ -270,11 +270,12 @@ def p_single(wb, single, vel, trq, rpms, rrs, w2t):
|
|||||||
row_start = _row_s + _adjust
|
row_start = _row_s + _adjust
|
||||||
data = []
|
data = []
|
||||||
for row in range(row_start, row_end):
|
for row in range(row_start, row_end):
|
||||||
data.append(df.iloc[row, 0])
|
data.append(df_origin.iloc[row, 0])
|
||||||
data.append(df.iloc[row, 1])
|
data.append(df_origin.iloc[row, 1])
|
||||||
|
data.append(df_origin.iloc[row, 2])
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for row in ws.iter_rows(min_row=2, min_col=2, max_row=150000, max_col=3):
|
for row in ws.iter_rows(min_row=2, min_col=2, max_row=150000, max_col=4):
|
||||||
for cell in row:
|
for cell in row:
|
||||||
try:
|
try:
|
||||||
_ = f"{data[i]:.2f}"
|
_ = f"{data[i]:.2f}"
|
||||||
@ -326,7 +327,7 @@ def p_scenario(wb, single, vel, trq, rpms, rrs, dur, w2t):
|
|||||||
data.append(df.iloc[row, 1])
|
data.append(df.iloc[row, 1])
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for row in ws.iter_rows(min_row=2, min_col=2, max_row=150000, max_col=3):
|
for row in ws.iter_rows(min_row=2, min_col=2, max_row=250000, max_col=3):
|
||||||
for cell in row:
|
for cell in row:
|
||||||
try:
|
try:
|
||||||
_ = f"{data[i]:.2f}"
|
_ = f"{data[i]:.2f}"
|
||||||
|
@ -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)
|
clibs.execution('state.switch_motor_on', hr, w2t, tab_name)
|
||||||
|
|
||||||
# 3. 开始运行程序
|
# 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'])
|
clibs.execution('rl_task.run', hr, w2t, tab_name, tasks=['current'])
|
||||||
_t_start = time()
|
_t_start = time()
|
||||||
while True:
|
while True:
|
||||||
|
Reference in New Issue
Block a user