fix: 修复上次提交中的错误和删除测试代码

This commit is contained in:
bmy
2024-08-01 23:30:37 +08:00
parent d0b02a66e6
commit 55f5b13d8c
2 changed files with 12 additions and 11 deletions

View File

@@ -1477,9 +1477,9 @@ class move_area2():
return
logger.info("开始寻找停车区域")
car_stop()
# calibrate_new(tlabel.SHELTER, offset = 15, run = True)
calibrate_new(tlabel.SHELTER, offset = 15, run = True)
time.sleep(0.5)
var.llm_text = "黑暗环境,照亮三秒,左转 90 度,鸣叫三声"
# 调用大模型 然后执行动作
try:
resp = llm_bot.get_command_json(var.llm_text)
@@ -1487,24 +1487,25 @@ class move_area2():
except:
logger.error("大模型超时,跳过任务")
return
try:
# FIXME 当前仍然可能存在文心一言分段返回和掺杂解释的问题,不确定当前条件足以过滤
resp_commands = eval(re.findall("```json(.*?)```", resp, re.S)[0])
logger.info(resp_commands)
if len(resp_commands) == 0:
return
action_list = resp_commands
# 进入停车区域
by_cmd.send_distance_y(10, 450)
time.sleep((450 * 5 / 1000) + 0.5)
for action in action_list:
self.add_item(action)
time.sleep(0.1)
time.sleep(0.5)
self.reset()
except:
logger.warning("任务解析失败并退出,文心一言真是废物")
pass
for action in action_list:
self.add_item(action)
time.sleep(0.1)
pass
time.sleep(0.5)
self.reset()
def nexec(self):
logger.warning("正在跳過大模型任務")