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'
This commit is contained in:
parent
2508be7b35
commit
dee07b77bb
@ -132,13 +132,14 @@ 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%臂展时,是否可以获取到正确的数据
|
||||||
|
|
||||||
#### 6) 电机电流自动化测试
|
#### 6) 电机电流自动化测试
|
||||||
|
|
||||||
@ -450,4 +451,14 @@ v0.1.8.2(2024/07/08)
|
|||||||
v0.1.9.0(2024/07/10)
|
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'
|
||||||
|
@ -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>
|
||||||
|
@ -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, 1),
|
||||||
prodvers=(0, 1, 9, 0),
|
prodvers=(0, 1, 9, 1),
|
||||||
# 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.1 (2024-07-12)'),
|
||||||
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.1 (2024-07-12)')])
|
||||||
]),
|
]),
|
||||||
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.1 @ 07/12/2024
|
@ -43,8 +43,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")
|
||||||
@ -71,7 +70,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.1\nDate: 07/12/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')
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
@ -175,7 +174,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')
|
||||||
@ -185,8 +184,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:
|
||||||
@ -194,7 +192,6 @@ class App(customtkinter.CTk):
|
|||||||
pb_color = 'green' if c_state == '1' else 'red'
|
pb_color = 'green' if c_state == '1' else 'red'
|
||||||
self.progressbar.configure(progress_color=pb_color)
|
self.progressbar.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
|
||||||
@ -203,7 +200,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':
|
||||||
@ -351,7 +347,21 @@ 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:
|
||||||
try:
|
try:
|
||||||
@ -459,10 +469,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()
|
||||||
@ -233,7 +240,7 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
|||||||
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 +284,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 +295,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)
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Reference in New Issue
Block a user