v0.1.7.1(2024/06/29)

1. [APIs: aio.py]
   - 修改detect_network函数中sleep语句放到最后,重新生成HmiRequest实例中增加sleep(4),这个停顿时间一定是比openapi中heartbeat函数的sleep要长1s以上才能正常工作
   - 修改write2textbox函数,新增默认参数tab_name,只有当该值与当前tab一致时,函数才会有输出
   - 第二条改动影响到了automatic_test文件夹下所有的文件
2. [APIs: openapi.py]
   - 规定了所有的网络异常均由heartbeat函数来定义,其他异常不做中断处理
   - execution函数中合并了case条件
   - 增加了N多指令,多为诊断曲线和rl程序相关
3. [APIs: do_brake.py]
   - 实现自动推送工程到xCore并自动运行
   - 初步实现了Modbus发送消息和检测状态
4. [APIs: do_current.py]
   - 将do_brake.py的内容完全拷贝到此文件,待修改
This commit is contained in:
2024-06-29 20:40:17 +08:00
parent 802ccd8e97
commit 611d848b41
13 changed files with 398 additions and 84 deletions

View File

@ -5,20 +5,20 @@ from sys import argv
def validate_resp(_id, response, w2t):
match _id:
case 'DATA ERR':
w2t(f"数据处理错误,需要确认", 0, 4, 'red')
w2t(f"数据处理错误,需要确认", 0, 4, 'red', tab_name='Automatic Test')
case 'DATA READ ERR':
w2t(f"无法读取数据,需要确认", 0, 3, 'red')
w2t(f"无法读取数据,需要确认", 0, 3, 'red', tab_name='Automatic Test')
case 'NOT SUPPORT':
w2t(f"不支持的功能,需要确认", 0, 2, 'red')
w2t(f"不支持的功能,需要确认", 0, 2, 'red', tab_name='Automatic Test')
if not response:
w2t(f"无法获取{id}请求的响应信息", 0, 1, 'red')
w2t(f"无法获取{id}请求的响应信息", 0, 1, 'red', tab_name='Automatic Test')
def execution(cmd, hr, w2t, **kwargs):
_id = hr.excution(cmd, **kwargs)
_msg = hr.get_from_id(_id)
if not _msg:
w2t(f"无法获取{_id}请求的响应信息", 0, 6, 'red')
w2t(f"无法获取{_id}请求的响应信息", 0, 6, 'red', tab_name='Automatic Test')
else:
_response = json.loads(_msg)
validate_resp(_id, _response, w2t)
@ -30,7 +30,7 @@ def get_state(hr, w2t):
_response = execution('state.get_state', hr, w2t)
stat_desc = {'engine': '上电状态', 'operate': '操作模式', 'rc_state': '控制器状态', 'robot_action': '机器人动作', 'safety_mode': '安全模式', 'servo_mode': '伺服工作模式', 'task_space': '工作任务空间'}
for component, state in _response['data'].items():
w2t(f"{stat_desc[component]}: {state}")
w2t(f"{stat_desc[component]}: {state}", tab_name='Automatic Test')
# 获取设备伺服信息
_response = execution('device.get_params', hr, w2t)
@ -39,7 +39,7 @@ def get_state(hr, w2t):
for device in _response['data']['devices']:
dev_vers[device['type']] = device['version']
for i in sorted(dev_desc.keys()):
w2t(f"{dev_desc[i]}: {dev_vers[i]}")
w2t(f"{dev_desc[i]}: {dev_vers[i]}", tab_name='Automatic Test')
# 设置示教器模式
_response = execution('state.set_tp_mode', hr, w2t, tp_mode='without')
@ -48,15 +48,15 @@ def get_state(hr, w2t):
def warning_info(hr, w2t):
for msg in hr.c_msg:
if 'alarm' in msg.lower():
w2t(msg)
w2t(msg, tab_name='Automatic Test')
for msg in hr.c_msg_xs:
if 'alarm' in msg.lower():
w2t(msg)
w2t(msg, tab_name='Automatic Test')
def main(hr, func, w2t):
if hr is None:
w2t("无法连接机器人检查是否已经使用Robot Assist软件连接机器重试中...", 0, 49, 'red')
w2t("无法连接机器人检查是否已经使用Robot Assist软件连接机器重试中...", 0, 49, 'red', tab_name='Automatic Test')
# func: get_state/
match func:
case 'get_state':