Merge branch 'main' of gitea.rustle.cc:gitea/rokae into profile
fetch the newest codes of main
This commit is contained in:
commit
f4a70a0034
@ -132,13 +132,16 @@ pyinstaller --noconfirm --onedir --windowed --add-data "C:/Users/Administrator/A
|
|||||||
|
|
||||||
> **需要注意的点**
|
> **需要注意的点**
|
||||||
|
|
||||||
1. 使用之前需要手动修改点位信息,确保所有点位不会发生撞击之后,再进行自动化测试
|
1. 【重要】使用之前需要手动修改!!负载信息!!点位信息!!,确保所有点位不会发生撞击,确保所有程序正常运行之后,导出工程,再进行自动化测试
|
||||||
2. 工程文件不能手动重命名,需要重命名存档,可以导入HMI,然后另存为
|
2. 工程文件不能手动重命名,需要重命名存档,可以导入HMI,然后另存为
|
||||||
3. 务必正确填写configs.xlsx中的Target页面,A1单元格可以选择正负方向急停,但不完全保证100%,大概有95%左右的准确度
|
3. 务必正确填写configs.xlsx中的Target页面,A1单元格可以选择正负方向急停,但不完全保证100%,大概有95%左右的准确度
|
||||||
4. 由于xCore系统问题,运行过程中可能会出现机器人宕机问题,如果遇到,可以手动重启控制柜,重新运行
|
4. 由于xCore系统问题,运行过程中可能会出现机器人宕机问题,如果遇到,可以手动重启控制柜,重新运行
|
||||||
5. 运行过程中,如果是因为机器问题无法达到额定百分比速度,会在日志输出框提示,注意观察
|
5. 运行过程中,如果是因为机器问题无法达到额定百分比速度,会在日志输出框提示,注意观察
|
||||||
6. 运行自动化程序之前,确保机器处于正常状态,无故障,未触发急停
|
6. 运行自动化程序之前,确保机器处于正常状态,无故障,未触发急停
|
||||||
7. 需要额外硬件接线,详细参考configs.xlsx中急停接线图sheet页
|
7. 需要额外硬件接线,详细参考configs.xlsx中急停接线图sheet页
|
||||||
|
8. 注意观察二轴100%臂展时,是否可以获取到正确的数据
|
||||||
|
9. 将autotest.xml导入到寄存器,并新建一个modbus,命名为autotest
|
||||||
|
10. 针对五轴机型,六轴数据可以填写1-5轴任意一轴的点位信息
|
||||||
|
|
||||||
#### 6) 电机电流自动化测试
|
#### 6) 电机电流自动化测试
|
||||||
|
|
||||||
@ -451,3 +454,29 @@ v0.1.9.0(2024/07/10)
|
|||||||
1. 完成了制动性能的自动化采集
|
1. 完成了制动性能的自动化采集
|
||||||
2. 完善了modbus浮点数读写相关的功能
|
2. 完善了modbus浮点数读写相关的功能
|
||||||
3. 修改了target.zip工程,该工程目前适配电机电流和制动性能
|
3. 修改了target.zip工程,该工程目前适配电机电流和制动性能
|
||||||
|
|
||||||
|
v0.1.9.1(2024/07/12)
|
||||||
|
1. [APIs: do_brake.py]
|
||||||
|
- 修改正负方向拍急停的逻辑,基本原理为:运行之前发送正负方向信号pon给RL,RL根据信号以及速度正负号运作
|
||||||
|
- 由于上述修改,正负方向急停准确率可达100%
|
||||||
|
2. [APIs: aio.py]
|
||||||
|
- 修改write2textbox的输出逻辑,实现更加灵活的自定义输出,同时修改相关部分
|
||||||
|
3. [APIs: openapi.py]
|
||||||
|
- modbus类新增指示政府方向急停的信号pon,将modbus类入参中的tab_name删除,并修改tab_name的值为'openapi'
|
||||||
|
- socket类种修改tab_name的值为'openapi'
|
||||||
|
|
||||||
|
v0.1.9.2(2024/07/13)
|
||||||
|
1. [APIs: do_brake.py]
|
||||||
|
- 修改ready_to_go信号的接收逻辑,适配大负载机型
|
||||||
|
2. [APIs: do_current.py]
|
||||||
|
- 修改ready_to_go信号的接收逻辑,适配大负载机型
|
||||||
|
- 调整单轴测试时间为35s,适配大负载机型,调整堵转电流持续时间15s,适当减少测试时间
|
||||||
|
- 将act信号置为False的动作放在初始化,增加程序健壮性
|
||||||
|
- 修改所有输出文件的命名,在扩展名之前加入时间戳
|
||||||
|
- 删除多余的时序矫正语句——item['value'].reverse(),使输出的曲线为平滑的自然顺序
|
||||||
|
3. [current: current.py]
|
||||||
|
- 在find_point函数种,当无法找到正确点位时,继续执行,而不是直接终止执行
|
||||||
|
- max功能计算逻辑矫正,应该是取绝对值的最大值
|
||||||
|
- 整体梳理了trq/trqh的传递路径,现已修正完毕
|
||||||
|
- 减速比rr数据源修改为configs.xlsx
|
||||||
|
4. 在current工程main函数增加 VelSet 100语句
|
||||||
|
@ -943,6 +943,7 @@
|
|||||||
<c name="type" type="10" value="float"/>
|
<c name="type" type="10" value="float"/>
|
||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value="0"/>
|
<c name="value_single" type="10" value="0"/>
|
||||||
|
<c name="bias" type="2" value="0"/>
|
||||||
</l>
|
</l>
|
||||||
<l>
|
<l>
|
||||||
<c name="addr" type="2" value="41004"/>
|
<c name="addr" type="2" value="41004"/>
|
||||||
@ -950,7 +951,7 @@
|
|||||||
<c name="addr_2nd" type="2" value="0"/>
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
<c name="bit_bias" type="2" value="0"/>
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
<c name="byte_bias" type="4" value="0"/>
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
<c name="description" type="10" value="触发或者接触急停"/>
|
<c name="description" type="10" value="【弃用】触发或者接触急停"/>
|
||||||
<c name="dev_name" type="10" value="autotest"/>
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
<c name="dev_type" type="10" value="MODBUS"/>
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
<c name="end_addr" type="2" value="41004"/>
|
<c name="end_addr" type="2" value="41004"/>
|
||||||
@ -961,7 +962,8 @@
|
|||||||
<c name="rw" type="10" value="rd"/>
|
<c name="rw" type="10" value="rd"/>
|
||||||
<c name="type" type="10" value="bool"/>
|
<c name="type" type="10" value="bool"/>
|
||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value="true"/>
|
<c name="value_single" type="10" value=""/>
|
||||||
|
<c name="bias" type="2" value="0"/>
|
||||||
</l>
|
</l>
|
||||||
<l>
|
<l>
|
||||||
<c name="addr" type="2" value="41005"/>
|
<c name="addr" type="2" value="41005"/>
|
||||||
@ -969,7 +971,7 @@
|
|||||||
<c name="addr_2nd" type="2" value="0"/>
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
<c name="bit_bias" type="2" value="0"/>
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
<c name="byte_bias" type="4" value="0"/>
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
<c name="description" type="10" value=""/>
|
<c name="description" type="10" value="pc to robot,指定工况下的速度值"/>
|
||||||
<c name="dev_name" type="10" value="autotest"/>
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
<c name="dev_type" type="10" value="MODBUS"/>
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
<c name="end_addr" type="2" value="41006"/>
|
<c name="end_addr" type="2" value="41006"/>
|
||||||
@ -980,7 +982,8 @@
|
|||||||
<c name="rw" type="10" value="rd"/>
|
<c name="rw" type="10" value="rd"/>
|
||||||
<c name="type" type="10" value="float"/>
|
<c name="type" type="10" value="float"/>
|
||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value="0"/>
|
<c name="value_single" type="10" value=""/>
|
||||||
|
<c name="bias" type="2" value="0"/>
|
||||||
</l>
|
</l>
|
||||||
<l>
|
<l>
|
||||||
<c name="addr" type="2" value="41007"/>
|
<c name="addr" type="2" value="41007"/>
|
||||||
@ -988,7 +991,7 @@
|
|||||||
<c name="addr_2nd" type="2" value="0"/>
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
<c name="bit_bias" type="2" value="0"/>
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
<c name="byte_bias" type="4" value="0"/>
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
<c name="description" type="10" value=""/>
|
<c name="description" type="10" value="robot to pc,已触发急停标志"/>
|
||||||
<c name="dev_name" type="10" value="autotest"/>
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
<c name="dev_type" type="10" value="MODBUS"/>
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
<c name="end_addr" type="2" value="41007"/>
|
<c name="end_addr" type="2" value="41007"/>
|
||||||
@ -999,7 +1002,8 @@
|
|||||||
<c name="rw" type="10" value="rdwr"/>
|
<c name="rw" type="10" value="rdwr"/>
|
||||||
<c name="type" type="10" value="bool"/>
|
<c name="type" type="10" value="bool"/>
|
||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value="true"/>
|
<c name="value_single" type="10" value=""/>
|
||||||
|
<c name="bias" type="2" value="0"/>
|
||||||
</l>
|
</l>
|
||||||
<l>
|
<l>
|
||||||
<c name="addr" type="2" value="41008"/>
|
<c name="addr" type="2" value="41008"/>
|
||||||
@ -1007,7 +1011,7 @@
|
|||||||
<c name="addr_2nd" type="2" value="0"/>
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
<c name="bit_bias" type="2" value="0"/>
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
<c name="byte_bias" type="4" value="0"/>
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
<c name="description" type="10" value=""/>
|
<c name="description" type="10" value="pc to robot,轴的位置"/>
|
||||||
<c name="dev_name" type="10" value="autotest"/>
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
<c name="dev_type" type="10" value="MODBUS"/>
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
<c name="end_addr" type="2" value="41009"/>
|
<c name="end_addr" type="2" value="41009"/>
|
||||||
@ -1019,6 +1023,7 @@
|
|||||||
<c name="type" type="10" value="int32"/>
|
<c name="type" type="10" value="int32"/>
|
||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value=""/>
|
<c name="value_single" type="10" value=""/>
|
||||||
|
<c name="bias" type="2" value="0"/>
|
||||||
</l>
|
</l>
|
||||||
<l>
|
<l>
|
||||||
<c name="addr" type="2" value="41010"/>
|
<c name="addr" type="2" value="41010"/>
|
||||||
@ -1026,7 +1031,7 @@
|
|||||||
<c name="addr_2nd" type="2" value="0"/>
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
<c name="bit_bias" type="2" value="0"/>
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
<c name="byte_bias" type="4" value="0"/>
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
<c name="description" type="10" value=""/>
|
<c name="description" type="10" value="pc to robot,急停开始标志"/>
|
||||||
<c name="dev_name" type="10" value="autotest"/>
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
<c name="dev_type" type="10" value="MODBUS"/>
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
<c name="end_addr" type="2" value="41010"/>
|
<c name="end_addr" type="2" value="41010"/>
|
||||||
@ -1038,5 +1043,25 @@
|
|||||||
<c name="type" type="10" value="bool"/>
|
<c name="type" type="10" value="bool"/>
|
||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value=""/>
|
<c name="value_single" type="10" value=""/>
|
||||||
|
<c name="bias" type="2" value="0"/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="41011"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value="pc to robot,指示正负方向拍急停"/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="41011"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="pon"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
</l>
|
</l>
|
||||||
</m>
|
</m>
|
||||||
|
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, 1, 9, 0),
|
filevers=(0, 1, 9, 2),
|
||||||
prodvers=(0, 1, 9, 0),
|
prodvers=(0, 1, 9, 2),
|
||||||
# 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.1.9.0 (2024-07-10)'),
|
StringStruct('FileVersion', '0.1.9.2 (2024-07-13)'),
|
||||||
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.1.9.0 (2024-07-10)')])
|
StringStruct('ProductVersion', '0.1.9.2 (2024-07-13)')])
|
||||||
]),
|
]),
|
||||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||||
]
|
]
|
||||||
|
Binary file not shown.
@ -1 +1 @@
|
|||||||
0.1.9.0 @ 07/10/2024
|
0.1.9.2 @ 07/13/2024
|
@ -49,8 +49,7 @@ class App(customtkinter.CTk):
|
|||||||
self.my_font = customtkinter.CTkFont(family="Consolas", size=16, weight="bold")
|
self.my_font = customtkinter.CTkFont(family="Consolas", size=16, weight="bold")
|
||||||
self.w_param = 84
|
self.w_param = 84
|
||||||
self.hr = None
|
self.hr = None
|
||||||
self.md_at = None
|
self.md = None
|
||||||
self.md_dp = None
|
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
# configure window
|
# configure window
|
||||||
self.title("AIO - All in one automatic toolbox")
|
self.title("AIO - All in one automatic toolbox")
|
||||||
@ -77,7 +76,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))
|
||||||
# create version info
|
# create version info
|
||||||
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.1.9.0\nDate: 07/10/2024", font=self.my_font, text_color="#4F4F4F")
|
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.1.9.2\nDate: 07/13/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')
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
@ -209,7 +208,7 @@ class App(customtkinter.CTk):
|
|||||||
else:
|
else:
|
||||||
for _func in _btn_funcs:
|
for _func in _btn_funcs:
|
||||||
if _btn_funcs[_func] == value:
|
if _btn_funcs[_func] == value:
|
||||||
btn_functions.main(self.hr, self.md_at, _func, self.write2textbox)
|
btn_functions.main(self.hr, self.md, _func, self.write2textbox)
|
||||||
break
|
break
|
||||||
|
|
||||||
self.seg_button.configure(state='normal')
|
self.seg_button.configure(state='normal')
|
||||||
@ -219,8 +218,7 @@ class App(customtkinter.CTk):
|
|||||||
with open(f"{current_path}/../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb:
|
with open(f"{current_path}/../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb:
|
||||||
f_hb.write('0')
|
f_hb.write('0')
|
||||||
self.hr = openapi.HmiRequest(self.write2textbox)
|
self.hr = openapi.HmiRequest(self.write2textbox)
|
||||||
self.md_at = openapi.ModbusRequest(self, 'Automatic Test')
|
self.md = openapi.ModbusRequest(self.write2textbox)
|
||||||
self.md_dp = openapi.ModbusRequest(self, 'Data Process')
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
with open(f'{current_path}/../assets/templates/heartbeat', 'r', encoding='utf-8') as f_hb:
|
with open(f'{current_path}/../assets/templates/heartbeat', 'r', encoding='utf-8') as f_hb:
|
||||||
@ -229,7 +227,6 @@ class App(customtkinter.CTk):
|
|||||||
self.progressbar.configure(progress_color=pb_color)
|
self.progressbar.configure(progress_color=pb_color)
|
||||||
self.progressbar_pr.configure(progress_color=pb_color)
|
self.progressbar_pr.configure(progress_color=pb_color)
|
||||||
if c_state == '0':
|
if c_state == '0':
|
||||||
# self.textbox.delete(index1='1.0', index2='end')
|
|
||||||
self.hr.t_bool = False
|
self.hr.t_bool = False
|
||||||
sleep(3)
|
sleep(3)
|
||||||
del self.hr
|
del self.hr
|
||||||
@ -238,7 +235,6 @@ class App(customtkinter.CTk):
|
|||||||
|
|
||||||
def tabview_click(self):
|
def tabview_click(self):
|
||||||
self.initialization()
|
self.initialization()
|
||||||
# self.textbox.delete(index1='1.0', index2='end')
|
|
||||||
|
|
||||||
tab_name = self.tabview.get()
|
tab_name = self.tabview.get()
|
||||||
if tab_name == 'Data Process':
|
if tab_name == 'Data Process':
|
||||||
@ -386,6 +382,20 @@ class App(customtkinter.CTk):
|
|||||||
self.textbox.insert(index='end', text=text + '\n', tags=color)
|
self.textbox.insert(index='end', text=text + '\n', tags=color)
|
||||||
self.textbox.update()
|
self.textbox.update()
|
||||||
self.textbox.see('end')
|
self.textbox.see('end')
|
||||||
|
elif tab_name == 'openapi' and tab_name_cur == 'Automatic Test':
|
||||||
|
if wait != 0:
|
||||||
|
self.textbox.insert(index='end', text=text, tags=color)
|
||||||
|
self.textbox.update()
|
||||||
|
self.textbox.see('end')
|
||||||
|
elif exitcode != 0:
|
||||||
|
self.textbox.insert(index='end', text=text + '\n', tags=color)
|
||||||
|
self.textbox.update()
|
||||||
|
self.textbox.see('end')
|
||||||
|
raise Exception(f"Error code: {exitcode}")
|
||||||
|
else:
|
||||||
|
self.textbox.insert(index='end', text=text + '\n', tags=color)
|
||||||
|
self.textbox.update()
|
||||||
|
self.textbox.see('end')
|
||||||
|
|
||||||
def is_float(self, flag, *args):
|
def is_float(self, flag, *args):
|
||||||
for item in args:
|
for item in args:
|
||||||
@ -494,10 +504,10 @@ class App(customtkinter.CTk):
|
|||||||
func_dict[flag](path=args[0], w2t=self.write2textbox)
|
func_dict[flag](path=args[0], w2t=self.write2textbox)
|
||||||
elif flag == 5:
|
elif flag == 5:
|
||||||
self.pre_warning()
|
self.pre_warning()
|
||||||
func_dict[flag](path=args[0], hr=self.hr, md=self.md_at, loadsel=args[1], w2t=self.write2textbox)
|
func_dict[flag](path=args[0], hr=self.hr, md=self.md, loadsel=args[1], w2t=self.write2textbox)
|
||||||
elif flag == 6:
|
elif flag == 6:
|
||||||
self.pre_warning()
|
self.pre_warning()
|
||||||
func_dict[flag](path=args[0], hr=self.hr, md=self.md_at, loadsel=args[1], w2t=self.write2textbox)
|
func_dict[flag](path=args[0], hr=self.hr, md=self.md, loadsel=args[1], w2t=self.write2textbox)
|
||||||
else:
|
else:
|
||||||
tkinter.messagebox.showerror(title="参数错误", message="请检查对应参数是否填写正确!", )
|
tkinter.messagebox.showerror(title="参数错误", message="请检查对应参数是否填写正确!", )
|
||||||
|
|
||||||
|
@ -168,6 +168,13 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
|||||||
]
|
]
|
||||||
wb = load_workbook(config_file, read_only=True)
|
wb = load_workbook(config_file, read_only=True)
|
||||||
ws = wb['Target']
|
ws = wb['Target']
|
||||||
|
if ws.cell(row=1, column=1).value == 'positive':
|
||||||
|
md.write_pon(True)
|
||||||
|
elif ws.cell(row=1, column=1).value == 'negative':
|
||||||
|
md.write_pon(False)
|
||||||
|
else:
|
||||||
|
w2t("configs.xlsx中Target页面A1单元格填写不正确,检查后重新运行...", 0, 111, 'red', 'Automatic Test')
|
||||||
|
|
||||||
for condition in result_dirs:
|
for condition in result_dirs:
|
||||||
_reach = condition.split('_')[0].removeprefix('reach')
|
_reach = condition.split('_')[0].removeprefix('reach')
|
||||||
_load = condition.split('_')[1].removeprefix('load')
|
_load = condition.split('_')[1].removeprefix('load')
|
||||||
@ -196,17 +203,17 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
|||||||
ssh.set_missing_host_key_policy(AutoAddPolicy())
|
ssh.set_missing_host_key_policy(AutoAddPolicy())
|
||||||
ssh.connect('192.168.0.160', 22, username='luoshi', password='luoshi2019')
|
ssh.connect('192.168.0.160', 22, username='luoshi', password='luoshi2019')
|
||||||
if ws.cell(row=1, column=1).value == 'positive':
|
if ws.cell(row=1, column=1).value == 'positive':
|
||||||
_rl_cmd = f"brake_E(j{axis}_{_reach}_n, j{axis}_{_reach}_p, p_speed, p_tool)"
|
|
||||||
elif ws.cell(row=1, column=1).value == 'negative':
|
|
||||||
_rl_cmd = f"brake_E(j{axis}_{_reach}_p, j{axis}_{_reach}_n, p_speed, p_tool)"
|
_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':
|
||||||
|
_rl_cmd = f"brake_E(j{axis}_{_reach}_n, j{axis}_{_reach}_p, p_speed, p_tool)"
|
||||||
else:
|
else:
|
||||||
w2t("configs.xlsx中Target页面A1单元格填写不正确,检查后重新运行...", 0, 111, 'red', 'Automatic Test')
|
w2t("configs.xlsx中Target页面A1单元格填写不正确,检查后重新运行...", 0, 111, 'red', 'Automatic Test')
|
||||||
_rl_speed = f"VelSet {_speed}"
|
_rl_speed = f"VelSet {_speed}"
|
||||||
cmd = 'cd /home/luoshi/bin/controller/; '
|
cmd = 'cd /home/luoshi/bin/controller/; '
|
||||||
cmd += 'sudo sed -i "/brake_E/d" projects/target/_build/brake/main.mod; '
|
cmd += 'sudo sed -i "/brake_E/d" projects/target/_build/brake/main.mod; '
|
||||||
cmd += f'sudo sed -i "/DONOTDELETE/i {_rl_cmd}" projects/target/_build/brake/main.mod; '
|
cmd += f'sudo sed -i "/DONOTDELETE/i {_rl_cmd}" projects/target/_build/brake/main.mod; '
|
||||||
cmd += f'sudo sed -i "/VelSet/d" projects/target/_build/brake/main.mod; '
|
cmd += 'sudo sed -i "/VelSet/d" projects/target/_build/brake/main.mod; '
|
||||||
cmd += f'sudo sed -i "/MoveAbsJ/i {_rl_speed}" projects/target/_build/brake/main.mod; '
|
cmd += f'sudo sed -i "/MoveAbsJ/i {_rl_speed}" projects/target/_build/brake/main.mod'
|
||||||
stdin, stdout, stderr = ssh.exec_command(cmd, get_pty=True)
|
stdin, stdout, stderr = ssh.exec_command(cmd, get_pty=True)
|
||||||
stdin.write('luoshi2019' + '\n')
|
stdin.write('luoshi2019' + '\n')
|
||||||
stdin.flush()
|
stdin.flush()
|
||||||
@ -220,20 +227,21 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
|||||||
_response = execution('state.switch_auto', hr, w2t)
|
_response = execution('state.switch_auto', hr, w2t)
|
||||||
_response = execution('state.switch_motor_on', hr, w2t)
|
_response = execution('state.switch_motor_on', hr, w2t)
|
||||||
_response = execution('rl_task.run', hr, w2t, tasks=['brake', 'stop0_related'])
|
_response = execution('rl_task.run', hr, w2t, tasks=['brake', 'stop0_related'])
|
||||||
for i in range(3):
|
_t_start = time()
|
||||||
|
while True:
|
||||||
if md.read_ready_to_go() == 1:
|
if md.read_ready_to_go() == 1:
|
||||||
md.write_act(True)
|
md.write_act(True)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
sleep(1)
|
if (time() - _t_start) // 20 > 1:
|
||||||
else:
|
w2t("20s内未收到机器人的运行信号,需要确认RL程序编写正确并正常执行...", 0, 111, 'red', 'Automatic Test')
|
||||||
w2t("未收到机器人的运行信号,需要确认RL程序编写正确并正常执行...", 0, 111, 'red', 'Automatic Test')
|
else:
|
||||||
|
sleep(1)
|
||||||
# 4. 第一次打开诊断曲线,并执行采集8s,之后触发软急停,关闭曲线采集,找出最大速度,传递给RL程序,最后清除相关记录
|
# 4. 第一次打开诊断曲线,并执行采集8s,之后触发软急停,关闭曲线采集,找出最大速度,传递给RL程序,最后清除相关记录
|
||||||
if count == 1:
|
if count == 1:
|
||||||
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
||||||
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
||||||
sleep(8) # 前八秒获取实际最大速度
|
sleep(10) # 前10秒获取实际最大速度
|
||||||
|
|
||||||
md.trigger_estop()
|
md.trigger_estop()
|
||||||
_response = execution('diagnosis.open', hr, w2t, open=False, display_open=False)
|
_response = execution('diagnosis.open', hr, w2t, open=False, display_open=False)
|
||||||
@ -277,7 +285,7 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
|||||||
|
|
||||||
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
||||||
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
||||||
# sleep(randint(3, 6))
|
sleep(randint(3, 6))
|
||||||
md.write_probe(True)
|
md.write_probe(True)
|
||||||
_t_start = time()
|
_t_start = time()
|
||||||
while True:
|
while True:
|
||||||
@ -288,8 +296,12 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
|||||||
sleep(1) # 保证所有数据均已返回
|
sleep(1) # 保证所有数据均已返回
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if (time() - _t_start) // 60 > 1:
|
if (time() - _t_start) > 30:
|
||||||
w2t(f"规定时间内未找到合适的点触发急停,需要确认RL/Python程序编写正确并正常执行...", 0, 111, 'red', 'Automatic Test')
|
w2t(f"30s内未触发急停,该条数据无效,需要确认RL/Python程序编写正确并正常执行,或者判别是否是机器本体问题...", 0, 0, 'red', 'Automatic Test')
|
||||||
|
md.write_probe(False)
|
||||||
|
_response = execution('diagnosis.open', hr, w2t, open=False, display_open=False)
|
||||||
|
sleep(1) # 保证所有数据均已返回
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
|
@ -120,16 +120,14 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
for item in data:
|
for item in data:
|
||||||
item['value'].reverse()
|
item['value'].reverse()
|
||||||
if item.get('channel', None) == channel and item.get('name', None) == 'hw_joint_vel_feedback':
|
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'])
|
_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':
|
||||||
item['value'].reverse()
|
|
||||||
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
_d2d_trq['device_servo_trq_feedback'].extend(item['value'])
|
||||||
|
|
||||||
df1 = pandas.DataFrame.from_dict(_d2d_vel)
|
df1 = pandas.DataFrame.from_dict(_d2d_vel)
|
||||||
df2 = pandas.DataFrame.from_dict(_d2d_trq)
|
df2 = pandas.DataFrame.from_dict(_d2d_trq)
|
||||||
df = pandas.concat([df1, df2], axis=1)
|
df = pandas.concat([df1, df2], axis=1)
|
||||||
_filename = f'{path}\\single\\j{channel+1}_single.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)):
|
||||||
with open(filename, 'r', encoding='utf-8') as f_obj:
|
with open(filename, 'r', encoding='utf-8') as f_obj:
|
||||||
@ -178,37 +176,37 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
df_01 = pandas.DataFrame.from_dict(_d2d_vel_0)
|
df_01 = pandas.DataFrame.from_dict(_d2d_vel_0)
|
||||||
df_02 = pandas.DataFrame.from_dict(_d2d_trq_0)
|
df_02 = pandas.DataFrame.from_dict(_d2d_trq_0)
|
||||||
df = pandas.concat([df_01, df_02], axis=1)
|
df = pandas.concat([df_01, df_02], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j1_s_{channel-5}_{scenario_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 = pandas.DataFrame.from_dict(_d2d_vel_1)
|
df_01 = pandas.DataFrame.from_dict(_d2d_vel_1)
|
||||||
df_02 = pandas.DataFrame.from_dict(_d2d_trq_1)
|
df_02 = pandas.DataFrame.from_dict(_d2d_trq_1)
|
||||||
df = pandas.concat([df_01, df_02], axis=1)
|
df = pandas.concat([df_01, df_02], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j2_s_{channel-5}_{scenario_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 = pandas.DataFrame.from_dict(_d2d_vel_2)
|
df_01 = pandas.DataFrame.from_dict(_d2d_vel_2)
|
||||||
df_02 = pandas.DataFrame.from_dict(_d2d_trq_2)
|
df_02 = pandas.DataFrame.from_dict(_d2d_trq_2)
|
||||||
df = pandas.concat([df_01, df_02], axis=1)
|
df = pandas.concat([df_01, df_02], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j3_s_{channel-5}_{scenario_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 = pandas.DataFrame.from_dict(_d2d_vel_3)
|
df_01 = pandas.DataFrame.from_dict(_d2d_vel_3)
|
||||||
df_02 = pandas.DataFrame.from_dict(_d2d_trq_3)
|
df_02 = pandas.DataFrame.from_dict(_d2d_trq_3)
|
||||||
df = pandas.concat([df_01, df_02], axis=1)
|
df = pandas.concat([df_01, df_02], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j4_s_{channel-5}_{scenario_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 = pandas.DataFrame.from_dict(_d2d_vel_4)
|
df_01 = pandas.DataFrame.from_dict(_d2d_vel_4)
|
||||||
df_02 = pandas.DataFrame.from_dict(_d2d_trq_4)
|
df_02 = pandas.DataFrame.from_dict(_d2d_trq_4)
|
||||||
df = pandas.concat([df_01, df_02], axis=1)
|
df = pandas.concat([df_01, df_02], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j5_s_{channel-5}_{scenario_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 = pandas.DataFrame.from_dict(_d2d_vel_5)
|
df_01 = pandas.DataFrame.from_dict(_d2d_vel_5)
|
||||||
df_02 = pandas.DataFrame.from_dict(_d2d_trq_5)
|
df_02 = pandas.DataFrame.from_dict(_d2d_trq_5)
|
||||||
df = pandas.concat([df_01, df_02], axis=1)
|
df = pandas.concat([df_01, df_02], axis=1)
|
||||||
_filename = f'{path}\\s_{channel-5}\\j6_s_{channel-5}_{scenario_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)):
|
||||||
with open(filename, 'r', encoding='utf-8') as f_obj:
|
with open(filename, 'r', encoding='utf-8') as f_obj:
|
||||||
@ -227,7 +225,7 @@ def data_proc_regular(path, filename, channel, scenario_time):
|
|||||||
df1 = pandas.DataFrame.from_dict(_d2d_vel)
|
df1 = pandas.DataFrame.from_dict(_d2d_vel)
|
||||||
df2 = pandas.DataFrame.from_dict(_d2d_trq)
|
df2 = pandas.DataFrame.from_dict(_d2d_trq)
|
||||||
df = pandas.concat([df1, df2], axis=1)
|
df = pandas.concat([df1, df2], axis=1)
|
||||||
_filename = f'{path}\\single\\j{channel-8}_hold.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)
|
||||||
|
|
||||||
|
|
||||||
@ -248,7 +246,7 @@ def data_proc_inertia(path, filename, channel):
|
|||||||
df1 = pandas.DataFrame.from_dict(_d2d_vel)
|
df1 = pandas.DataFrame.from_dict(_d2d_vel)
|
||||||
df2 = pandas.DataFrame.from_dict(_d2d_trq)
|
df2 = pandas.DataFrame.from_dict(_d2d_trq)
|
||||||
df = pandas.concat([df1, df2], axis=1)
|
df = pandas.concat([df1, df2], axis=1)
|
||||||
_filename = f'{path}\\inertia\\j{channel+4}_inertia.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)
|
||||||
|
|
||||||
|
|
||||||
@ -308,6 +306,8 @@ def run_rl(path, hr, md, loadsel, w2t):
|
|||||||
_response = execution('diagnosis.open', hr, w2t, open=False, display_open=False)
|
_response = execution('diagnosis.open', hr, w2t, open=False, display_open=False)
|
||||||
md.trigger_estop()
|
md.trigger_estop()
|
||||||
md.reset_estop()
|
md.reset_estop()
|
||||||
|
md.write_act(False)
|
||||||
|
sleep(1) # 让曲线彻底关闭
|
||||||
_response = execution('state.switch_manual', hr, w2t)
|
_response = execution('state.switch_manual', hr, w2t)
|
||||||
_response = execution('state.switch_motor_off', hr, w2t)
|
_response = execution('state.switch_motor_off', hr, w2t)
|
||||||
|
|
||||||
@ -334,19 +334,19 @@ def run_rl(path, hr, md, loadsel, w2t):
|
|||||||
|
|
||||||
# 4. 开始运行程序,单轴运行15s
|
# 4. 开始运行程序,单轴运行15s
|
||||||
_response = execution('rl_task.run', hr, w2t, tasks=['current'])
|
_response = execution('rl_task.run', hr, w2t, tasks=['current'])
|
||||||
for i in range(3):
|
_t_start = time()
|
||||||
|
while True:
|
||||||
if md.read_ready_to_go() == 1:
|
if md.read_ready_to_go() == 1:
|
||||||
md.write_act(True)
|
md.write_act(True)
|
||||||
sleep(1)
|
|
||||||
md.write_act(False)
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
sleep(1)
|
if (time() - _t_start) // 20 > 1:
|
||||||
else:
|
w2t("20s内未收到机器人的运行信号,需要确认RL程序编写正确并正常执行...", 0, 111, 'red', 'Automatic Test')
|
||||||
w2t("未收到机器人的运行信号,需要确认RL程序编写正确并正常执行...", 0, 111, 'red', 'Automatic Test')
|
else:
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
# 5. 打开诊断曲线,并执行采集
|
# 5. 打开诊断曲线,并执行采集
|
||||||
sleep(7) # 保证程序已经运行起来,其实主要是为了保持电流的采集而设定
|
sleep(10) # 保证程序已经运行起来,其实主要是为了保持电流的采集而设定
|
||||||
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
||||||
display_pdo_params = [
|
display_pdo_params = [
|
||||||
{"name": "hw_joint_vel_feedback", "channel": 0},
|
{"name": "hw_joint_vel_feedback", "channel": 0},
|
||||||
@ -365,7 +365,9 @@ def run_rl(path, hr, md, loadsel, w2t):
|
|||||||
]
|
]
|
||||||
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
||||||
scenario_time = 0
|
scenario_time = 0
|
||||||
if number < 6 or number > 8:
|
if number < 6:
|
||||||
|
sleep(35)
|
||||||
|
elif number > 8:
|
||||||
sleep(15)
|
sleep(15)
|
||||||
else:
|
else:
|
||||||
_t_start = time()
|
_t_start = time()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from json import load, dumps, loads
|
from json import load, dumps
|
||||||
from socket import socket, setdefaulttimeout, AF_INET, SOCK_STREAM
|
from socket import socket, setdefaulttimeout, AF_INET, SOCK_STREAM
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import selectors
|
import selectors
|
||||||
@ -14,10 +14,10 @@ current_path = dirname(__file__)
|
|||||||
|
|
||||||
|
|
||||||
class ModbusRequest(object):
|
class ModbusRequest(object):
|
||||||
def __init__(self, w2t, tab_name):
|
def __init__(self, w2t):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.w2t = w2t
|
self.w2t = w2t
|
||||||
self.tab_name = tab_name
|
self.tab_name = 'openapi'
|
||||||
self.host = '192.168.0.160'
|
self.host = '192.168.0.160'
|
||||||
self.port = 502
|
self.port = 502
|
||||||
self.c = ModbusTcpClient(self.host, self.port)
|
self.c = ModbusTcpClient(self.host, self.port)
|
||||||
@ -167,6 +167,13 @@ class ModbusRequest(object):
|
|||||||
self.w2t(f"{Err}")
|
self.w2t(f"{Err}")
|
||||||
self.w2t("无法写入速度探测信号,连接Modbus失败,需要确认网络是否通畅,或是未正确导入寄存器文件...", 0, 100, 'red', self.tab_name)
|
self.w2t("无法写入速度探测信号,连接Modbus失败,需要确认网络是否通畅,或是未正确导入寄存器文件...", 0, 100, 'red', self.tab_name)
|
||||||
|
|
||||||
|
def write_pon(self, pon): # positive or negative
|
||||||
|
try:
|
||||||
|
self.c.write_register(41011, pon)
|
||||||
|
except Exception as Err:
|
||||||
|
self.w2t(f"{Err}")
|
||||||
|
self.w2t("无法写入正负方向信号,连接Modbus失败,需要确认网络是否通畅,或是未正确导入寄存器文件...", 0, 100, 'red', self.tab_name)
|
||||||
|
|
||||||
|
|
||||||
class HmiRequest(object):
|
class HmiRequest(object):
|
||||||
def __init__(self, w2t):
|
def __init__(self, w2t):
|
||||||
@ -182,7 +189,7 @@ class HmiRequest(object):
|
|||||||
self.flag_xs = 0
|
self.flag_xs = 0
|
||||||
self.response_xs = ''
|
self.response_xs = ''
|
||||||
self.t_bool = True
|
self.t_bool = True
|
||||||
self.tab_name = 'Automatic Test'
|
self.tab_name = 'openapi'
|
||||||
self.pkg_size = 0
|
self.pkg_size = 0
|
||||||
self.broke = 0
|
self.broke = 0
|
||||||
self.half = 0
|
self.half = 0
|
||||||
@ -219,7 +226,7 @@ class HmiRequest(object):
|
|||||||
# self.w2t("Connection success", 0, 0, 'green', tab_name=self.tab_name)
|
# self.w2t("Connection success", 0, 0, 'green', tab_name=self.tab_name)
|
||||||
with open(f"{current_path}/../../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb:
|
with open(f"{current_path}/../../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb:
|
||||||
f_hb.write('1')
|
f_hb.write('1')
|
||||||
md = ModbusRequest(self.w2t, self.tab_name)
|
md = ModbusRequest(self.w2t)
|
||||||
md.reset_estop()
|
md.reset_estop()
|
||||||
md.clear_alarm()
|
md.clear_alarm()
|
||||||
md.write_act(False)
|
md.write_act(False)
|
||||||
|
@ -79,7 +79,7 @@ def initialization(path, sub, w2t):
|
|||||||
return data_files
|
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: []}
|
current = {1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: []}
|
||||||
for data_file in data_files:
|
for data_file in data_files:
|
||||||
if data_file.endswith('.data'):
|
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'))
|
axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j'))
|
||||||
rca = rcs[axis-1]
|
rca = rcs[axis-1]
|
||||||
|
|
||||||
col = df.columns.values[trqh-1]
|
col = df.columns.values[trq-1]
|
||||||
c_max = df[col].max()
|
c_max = df[col].abs().max()
|
||||||
|
|
||||||
scale = 1 if data_file.endswith('.csv') else 1000
|
scale = 1 if data_file.endswith('.csv') else 1000
|
||||||
_ = abs(c_max/scale*rca)
|
_ = abs(c_max/scale*rca)
|
||||||
@ -118,7 +118,7 @@ def current_max(data_files, rcs, trqh, w2t):
|
|||||||
return current
|
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: []}
|
current = {1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: []}
|
||||||
for data_file in data_files:
|
for data_file in data_files:
|
||||||
if data_file.endswith('.data'):
|
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'))
|
axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j'))
|
||||||
rca = rcs[axis-1]
|
rca = rcs[axis-1]
|
||||||
|
|
||||||
col = df.columns.values[trqh - 1]
|
col = df.columns.values[trq-1]
|
||||||
c_std = df[col].std()
|
c_std = df[col].std()
|
||||||
c_avg = df[col].mean()
|
c_avg = df[col].mean()
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ def current_avg(data_files, rcs, trqh, w2t):
|
|||||||
return current
|
return current
|
||||||
|
|
||||||
|
|
||||||
def current_cycle(dur, data_files, rcs, vel, trq, trqh, rpms, w2t):
|
def current_cycle(dur, data_files, rcs, rrs, vel, trq, trqh, rpms, w2t):
|
||||||
result = None
|
result = None
|
||||||
hold = []
|
hold = []
|
||||||
single = []
|
single = []
|
||||||
@ -194,9 +194,9 @@ def current_cycle(dur, data_files, rcs, vel, trq, trqh, rpms, w2t):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if dur == 0:
|
if dur == 0:
|
||||||
p_single(wb, single, vel, trq, rpms, w2t)
|
p_single(wb, single, vel, trq, rpms, rrs, w2t)
|
||||||
else:
|
else:
|
||||||
p_scenario(wb, single, vel, trq, rpms, dur, w2t)
|
p_scenario(wb, single, vel, trq, rpms, rrs, dur, w2t)
|
||||||
|
|
||||||
w2t(f"正在保存文件 {result},需要 10s 左右", 1, 0, 'orange')
|
w2t(f"正在保存文件 {result},需要 10s 左右", 1, 0, 'orange')
|
||||||
stop = 0
|
stop = 0
|
||||||
@ -237,7 +237,7 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
|
|||||||
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red')
|
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red')
|
||||||
|
|
||||||
|
|
||||||
def p_single(wb, single, vel, trq, rpms, w2t):
|
def p_single(wb, single, vel, trq, rpms, rrs, w2t):
|
||||||
# 1. 先找到第一个速度为零的点,数据从后往前找,一开始就是零的情况不予考虑
|
# 1. 先找到第一个速度为零的点,数据从后往前找,一开始就是零的情况不予考虑
|
||||||
# 2. 记录第一个点的位置,继续向前查找第二个速度为零的点,同理,一开始为零的点不予考虑
|
# 2. 记录第一个点的位置,继续向前查找第二个速度为零的点,同理,一开始为零的点不予考虑
|
||||||
# 3. 记录第二个点的位置,并将其中的数据拷贝至对应位置
|
# 3. 记录第二个点的位置,并将其中的数据拷贝至对应位置
|
||||||
@ -251,7 +251,7 @@ def p_single(wb, single, vel, trq, rpms, w2t):
|
|||||||
set_option("display.precision", 2)
|
set_option("display.precision", 2)
|
||||||
if data_file.endswith('.data'):
|
if data_file.endswith('.data'):
|
||||||
df = read_csv(data_file, sep='\t')
|
df = read_csv(data_file, sep='\t')
|
||||||
rr = float(wb['统计'].cell(row=2, column=axis+1).value)
|
rr = rrs[axis+1]
|
||||||
addition = 180 / 3.1415926 * 60 / 360 * rr
|
addition = 180 / 3.1415926 * 60 / 360 * rr
|
||||||
elif data_file.endswith('.csv'):
|
elif data_file.endswith('.csv'):
|
||||||
df = read_csv(data_file, sep=',', encoding='gbk', header=8)
|
df = read_csv(data_file, sep=',', encoding='gbk', header=8)
|
||||||
@ -268,6 +268,7 @@ def p_single(wb, single, vel, trq, rpms, w2t):
|
|||||||
col_names = list(df.columns)
|
col_names = list(df.columns)
|
||||||
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())
|
||||||
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
|
||||||
@ -318,7 +319,7 @@ def p_single(wb, single, vel, trq, rpms, w2t):
|
|||||||
cell.value = None
|
cell.value = None
|
||||||
|
|
||||||
|
|
||||||
def p_scenario(wb, single, vel, trq, rpms, dur, w2t):
|
def p_scenario(wb, single, vel, trq, rpms, rrs, dur, w2t):
|
||||||
for data_file in single:
|
for data_file in single:
|
||||||
cycle = 0.001
|
cycle = 0.001
|
||||||
axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j'))
|
axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j'))
|
||||||
@ -330,7 +331,7 @@ def p_scenario(wb, single, vel, trq, rpms, dur, w2t):
|
|||||||
set_option("display.precision", 2)
|
set_option("display.precision", 2)
|
||||||
if data_file.endswith('.data'):
|
if data_file.endswith('.data'):
|
||||||
df = read_csv(data_file, sep='\t')
|
df = read_csv(data_file, sep='\t')
|
||||||
rr = float(wb['统计'].cell(row=2, column=axis+1).value)
|
rr = rrs[axis+1]
|
||||||
addition = 180 / 3.1415926 * 60 / 360 * rr
|
addition = 180 / 3.1415926 * 60 / 360 * rr
|
||||||
elif data_file.endswith('.csv'):
|
elif data_file.endswith('.csv'):
|
||||||
df = read_csv(data_file, sep=',', encoding='gbk', header=8)
|
df = read_csv(data_file, sep=',', encoding='gbk', header=8)
|
||||||
@ -374,6 +375,7 @@ def get_configs(configfile, w2t):
|
|||||||
_wb = load_workbook(configfile, read_only=True)
|
_wb = load_workbook(configfile, read_only=True)
|
||||||
_ws = _wb['Target']
|
_ws = _wb['Target']
|
||||||
rcs = []
|
rcs = []
|
||||||
|
rrs = []
|
||||||
rpms = []
|
rpms = []
|
||||||
for i in range(2, 9):
|
for i in range(2, 9):
|
||||||
try:
|
try:
|
||||||
@ -386,18 +388,23 @@ def get_configs(configfile, w2t):
|
|||||||
except:
|
except:
|
||||||
rcs.append(0.0)
|
rcs.append(0.0)
|
||||||
|
|
||||||
return rpms, rcs
|
try:
|
||||||
|
rrs.append(float(_ws.cell(row=2, column=i).value))
|
||||||
|
except:
|
||||||
|
rrs.append(0.0)
|
||||||
|
|
||||||
|
return rpms, rcs, rrs
|
||||||
|
|
||||||
|
|
||||||
def main(path, sub, dur, vel, trq, trqh, w2t):
|
def main(path, sub, dur, vel, trq, trqh, w2t):
|
||||||
data_files = initialization(path, sub, w2t)
|
data_files = initialization(path, sub, w2t)
|
||||||
rpms, rcs = get_configs(path + '\\configs.xlsx', w2t)
|
rpms, rcs, rrs = get_configs(path + '\\configs.xlsx', w2t)
|
||||||
if sub == 'max':
|
if sub == 'max':
|
||||||
current_max(data_files, rcs, trqh, w2t)
|
current_max(data_files, rcs, trq, w2t)
|
||||||
elif sub == 'avg':
|
elif sub == 'avg':
|
||||||
current_avg(data_files, rcs, trqh, w2t)
|
current_avg(data_files, rcs, trq, w2t)
|
||||||
elif sub == 'cycle':
|
elif sub == 'cycle':
|
||||||
current_cycle(dur, data_files, rcs, vel, trq, trqh, rpms, w2t)
|
current_cycle(dur, data_files, rcs, rrs, vel, trq, trqh, rpms, w2t)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user