v0.2.0.0(2024/07/17)

1. [profile: aio.py]
   - 增加velocity相关逻辑
   - 修改负载信息为曲线信息
2. [profile: factory_test.py]
   - 增加velocity相关逻辑
3. [profile: current.py]
   - 修正减速比获取的规则
4. [profile: openapi.py]
   - HmiRequest模块:日志取消记录move.monitor相关
   - HmiRequest模块:增加了durable_lock变量,控制文件读写互斥
This commit is contained in:
2024-07-17 14:17:00 +08:00
parent da5ddcea0a
commit 3010cb8931
9 changed files with 100 additions and 40 deletions

View File

@ -64,7 +64,7 @@ widgits_at = {
}
widgits_da = {
'path': {'label': '', 'entry': '', 'row': 1, 'col': 2, 'text': '数据文件夹路径'},
'loadsel': {'label': '', 'optionmenu': '', 'row': 1, 'col': 1, 'text': '负载选择'},
'curvesel': {'label': '', 'optionmenu': '', 'row': 1, 'col': 1, 'text': '曲线选择'},
}
@ -78,6 +78,7 @@ class App(customtkinter.CTk):
self.canvas = None
self.flg = 0
self.df_copy = None
self.old_curve = None
# =====================================================================
# configure window
self.title("AIO - All in one automatic toolbox")
@ -104,7 +105,7 @@ class App(customtkinter.CTk):
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))
# create version info
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.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.2.0.0\nDate: 07/17/2024", font=self.my_font, text_color="#4F4F4F")
self.frame_func.rowconfigure(6, weight=1)
self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s')
# =====================================================================
@ -183,8 +184,8 @@ class App(customtkinter.CTk):
widgits_da[widgit]['label'].grid(row=widgits_da[widgit]['row'], column=widgits_da[widgit]['col'], sticky='e', padx=(20, 5), pady=10)
widgits_da[widgit]['entry'] = customtkinter.CTkEntry(self.tabview.tab('Durable Action'), width=670, placeholder_text=widgits_da[widgit]['text'], font=self.my_font)
widgits_da[widgit]['entry'].grid(row=widgits_da[widgit]['row'], column=widgits_da[widgit]['col']+1, columnspan=11, padx=(5, 10), pady=10, sticky='we')
elif widgit in ['loadsel']:
widgits_da[widgit]['optionmenu'] = customtkinter.CTkOptionMenu(self.tabview.tab('Durable Action'), button_color='#708090', fg_color='#778899', values=["tool100", "inertia"], font=self.my_font)
elif widgit in ['curvesel']:
widgits_da[widgit]['optionmenu'] = customtkinter.CTkOptionMenu(self.tabview.tab('Durable Action'), button_color='#708090', fg_color='#778899', values=["device_servo_trq_feedback", "hw_joint_vel_feedback"], font=self.my_font)
widgits_da[widgit]['optionmenu'].grid(row=widgits_da[widgit]['row'], column=widgits_da[widgit]['col'], padx=5, pady=10, sticky='we')
widgits_da[widgit]['optionmenu'].set(widgits_da[widgit]['text'])
# For durable_action tab END =====================================================================
@ -218,19 +219,37 @@ class App(customtkinter.CTk):
plt.rcParams['font.size'] = 14
plt.rcParams['lines.marker'] = 'o'
df = pd.read_excel(durable_data_current_xlsx)
if not df.equals(self.df_copy) or self.flg == 0:
curvesel = widgits_da['curvesel']['optionmenu'].get()
while True:
if not self.hr.durable_lock:
self.hr.durable_lock = 1
if curvesel == 'device_servo_trq_feedback':
df = pd.read_excel(durable_data_current_xlsx)
_title = 'device_servo_trq_feedback'
elif curvesel == 'hw_joint_vel_feedback':
_title = 'hw_joint_vel_feedback'
df = pd.read_excel(durable_data_velocity_xlsx)
else:
_title = 'device_servo_trq_feedback'
df = pd.read_excel(durable_data_current_xlsx)
self.hr.durable_lock = 0
break
else:
sleep(1)
if not df.equals(self.df_copy) or self.flg == 0 or curvesel != self.old_curve:
self.flg = 1
self.df_copy = df.copy()
self.old_curve = widgits_da['curvesel']['optionmenu'].get()
figure = plt.figure(frameon=True, facecolor='#E9E9E9')
plt.subplots_adjust(left=0.04, right=0.98, bottom=0.05, top=0.98)
plt.subplots_adjust(left=0.04, right=0.98, bottom=0.05, top=0.95)
ax = figure.add_subplot(1, 1, 1)
df.plot(grid=True, x='time', y='axis1', ax=ax)
df.plot(grid=True, x='time', y='axis2', ax=ax)
df.plot(grid=True, x='time', y='axis3', ax=ax)
df.plot(grid=True, x='time', y='axis4', ax=ax)
df.plot(grid=True, x='time', y='axis5', ax=ax)
df.plot(grid=True, x='time', y='axis6', ax=ax)
df.plot(grid=True, x='time', y='axis6', ax=ax, title=_title, legend='upper left')
self.create_canvas(figure)
@ -264,6 +283,8 @@ class App(customtkinter.CTk):
def detect_network(self):
df = pd.DataFrame(durable_data_current)
df.to_excel(durable_data_current_xlsx, index=False)
df = pd.DataFrame(durable_data_velocity)
df.to_excel(durable_data_velocity_xlsx, index=False)
with open(heartbeat, "w", encoding='utf-8') as f_hb:
f_hb.write('0')
@ -293,23 +314,19 @@ class App(customtkinter.CTk):
if tab_name == 'Data Process':
self.flg = 0
self.menu_main_dp.set("Start Here!")
try:
self.canvas.get_tk_widget().grid_forget()
except:
pass
elif tab_name == 'Automatic Test':
self.flg = 0
self.menu_main_at.set("Start Here!")
self.seg_button.configure(state='normal')
try:
self.canvas.get_tk_widget().grid_forget()
except:
pass
elif tab_name == 'Durable Action':
pass
def initialization(self):
tab_name = self.tabview.get()
try:
self.canvas.get_tk_widget().grid_forget()
except:
pass
self.textbox.delete(index1='1.0', index2='end')
if tab_name == 'Data Process':
for widgit in widgits_dp:
@ -343,9 +360,9 @@ class App(customtkinter.CTk):
widgits_da[widgit]['label'].configure(text=f'{widgit.upper()}', text_color='black')
widgits_da[widgit]['entry'].delete(0, tkinter.END)
widgits_da[widgit]['entry'].configure(placeholder_text=widgits_at[widgit]['text'], state='normal')
elif widgit in ['loadsel']:
elif widgit in ['curvesel']:
widgits_da[widgit]['optionmenu'].configure(state='normal')
widgits_da[widgit]['optionmenu'].set(widgits_at[widgit]['text'])
widgits_da[widgit]['optionmenu'].set(widgits_da[widgit]['text'])
def func_main_callback(self, func_name):
self.initialization()
@ -564,11 +581,11 @@ class App(customtkinter.CTk):
return 0, 0
elif tab_name == 'Durable Action':
path = widgits_da['path']['entry'].get().strip()
loadsel = widgits_da['loadsel']['optionmenu'].get()
curvesel = widgits_da['curvesel']['optionmenu'].get()
c1 = exists(path)
c2 = loadsel in ['tool100', 'inertia']
c2 = curvesel in ['device_servo_trq_feedback', 'hw_joint_vel_feedback']
if c1 and c2:
return 7, path, loadsel
return 7, path, curvesel
else:
return 0, 0