RoboWaiter/robowaiter/scene/tasks/VLM.py

60 lines
2.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
视觉语言操作
机器人根据指令人的指令调节空调,自主探索环境导航到目标点,通过手臂的运动规划能力操作空调,比如开关按钮、调温按钮、显示面板
"""
import time
from robowaiter.scene.scene import Scene
class SceneVLM(Scene):
def __init__(self, robot):
super().__init__(robot)
# 在这里加入场景中发生的事件, (事件发生的时间,事件函数)
self.event_list = [
(5, self.create_chat_event("测试VLM做一杯咖啡")),
# (5, self.create_chat_event("测试VLM倒一杯水")),
# (5, self.create_chat_event("测试VLM开空调")),
# (5, self.create_chat_event("测试VLM关空调")),
# (5, self.create_chat_event("测试VLM开大厅灯")),
# (5, self.create_chat_event("测试VLM拖地")),
# (5, self.create_chat_event("测试VLM擦桌子")),
# (5, self.create_chat_event("测试VLM整理椅子")),
# (5, self.create_chat_event("测试VLM把冰红茶放到Table2")),
# (5, self.create_chat_event("测试VLM关大厅灯"))
# (5, self.create_chat_event("测试VLM做一杯咖啡放到吧台上")),
]
def _reset(self):
self.state["condition_set"] = {'At(Robot,Bar)','Is(AC,Off)', 'Holding(Nothing)', # 'Holding(Yogurt)', #'Holding(Nothing)',
'Is(HallLight,Off)','Is(TubeLight,On)','Is(Curtain,On)',
'Is(Table1,Dirty)','Is(Floor,Dirty)','Is(Chairs,Dirty)'}
# self.gen_obj(type=5)
# self.gen_obj(type=9)
# self.op_task_execute(op_type=16, obj_id=0)
# self.move_task_area(op_type=4)
pass
def _run(self, op_type=10):
# 共17个操作
# "制作咖啡","倒水","夹点心","拖地","擦桌子","开筒灯","搬椅子", # 1-7
# "关筒灯","开大厅灯","关大厅灯","关闭窗帘","打开窗帘", # 8-12
# "调整空调开关","调高空调温度","调低空调温度", # 13-15
# "抓握物体","放置物体" # 16-17
# 16: 抓操作需要传入物品id17: 放操作需要传入放置位置周围的空地区域(桌边而不是桌上)
# if op_type == 16:
# self.gen_obj()
# self.op_task_execute(op_type, obj_id=0)
# # 原始吧台处:[247.0, 520.0, 100.0], 空调开关旁吧台:[240.0, 40.0, 70.0], 水杯桌:[-70.0, 500.0, 107]
# # 桌子1:[-55.0, 0.0, 107],桌子2:[-55.0, 150.0, 107], 抹布桌:[340.0, 900.0, 98.0]
# if op_type == 17: self.op_task_execute(op_type, release_pos=[340.0, 900.0, 99.0]) #[325.0, 860.0, 100]
# if op_type not in [16,17]:
# self.move_task_area(op_type)
# self.op_task_execute(op_type)
pass
def _step(self):
pass