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:
@ -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)
|
||||
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:
|
||||
_reach = condition.split('_')[0].removeprefix('reach')
|
||||
_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.connect('192.168.0.160', 22, username='luoshi', password='luoshi2019')
|
||||
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)"
|
||||
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:
|
||||
w2t("configs.xlsx中Target页面A1单元格填写不正确,检查后重新运行...", 0, 111, 'red', 'Automatic Test')
|
||||
_rl_speed = f"VelSet {_speed}"
|
||||
cmd = 'cd /home/luoshi/bin/controller/; '
|
||||
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 "/VelSet/d" projects/target/_build/brake/main.mod; '
|
||||
cmd += f'sudo sed -i "/MoveAbsJ/i {_rl_speed}" 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'
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write('luoshi2019' + '\n')
|
||||
stdin.flush()
|
||||
@ -233,7 +240,7 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
||||
if count == 1:
|
||||
_response = execution('diagnosis.open', hr, w2t, open=True, display_open=True)
|
||||
_response = execution('diagnosis.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
||||
sleep(8) # 前八秒获取实际最大速度
|
||||
sleep(10) # 前10秒获取实际最大速度
|
||||
|
||||
md.trigger_estop()
|
||||
_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.set_params', hr, w2t, display_pdo_params=display_pdo_params)
|
||||
# sleep(randint(3, 6))
|
||||
sleep(randint(3, 6))
|
||||
md.write_probe(True)
|
||||
_t_start = time()
|
||||
while True:
|
||||
@ -288,8 +295,12 @@ def run_rl(path, loadsel, hr, md, config_file, prj_file, result_dirs, w2t):
|
||||
sleep(1) # 保证所有数据均已返回
|
||||
break
|
||||
else:
|
||||
if (time() - _t_start) // 60 > 1:
|
||||
w2t(f"规定时间内未找到合适的点触发急停,需要确认RL/Python程序编写正确并正常执行...", 0, 111, 'red', 'Automatic Test')
|
||||
if (time() - _t_start) > 30:
|
||||
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:
|
||||
sleep(1)
|
||||
|
||||
|
Reference in New Issue
Block a user