2023-10-25 10:34:46 +08:00
|
|
|
|
"""
|
|
|
|
|
视觉语言操作
|
|
|
|
|
机器人根据指令人的指令调节空调,自主探索环境导航到目标点,通过手臂的运动规划能力操作空调,比如开关按钮、调温按钮、显示面板
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
from robowaiter.scene.scene import Scene
|
|
|
|
|
|
|
|
|
|
class SceneVLM(Scene):
|
|
|
|
|
def __init__(self, robot):
|
|
|
|
|
super().__init__(robot)
|
2023-11-09 08:47:57 +08:00
|
|
|
|
# 在这里加入场景中发生的事件, (事件发生的时间,事件函数)
|
2023-11-18 14:13:07 +08:00
|
|
|
|
self.new_event_list = [
|
2023-11-18 21:24:11 +08:00
|
|
|
|
(3, self.add_walker, (5, 230, 1200)),
|
|
|
|
|
(5, self.control_walkers_and_say, ([[[0, False, 200, 60, 520, 0, "早上好呀,我想找个能晒太阳的地方。"]]])),# (0, 60, 520)),
|
|
|
|
|
(6, self.customer_say, (0,"可以带我过去嘛?")),
|
2023-11-09 08:47:57 +08:00
|
|
|
|
]
|
2023-10-25 10:34:46 +08:00
|
|
|
|
|
2023-10-25 22:12:15 +08:00
|
|
|
|
def _reset(self):
|
2023-11-17 19:08:00 +08:00
|
|
|
|
self.gen_obj()
|
2023-11-18 14:13:07 +08:00
|
|
|
|
# self.add_walkers([[47, 920]])
|
操作接口
7个动画操作
op_type 1-7 代表 "制作咖啡","倒水","夹点心","拖地","擦桌子","关闭窗帘","关筒灯","开大厅灯","搬椅子","打开窗帘","关大厅灯","开筒灯"
2023-11-08 17:13:25 +08:00
|
|
|
|
pass
|
2023-10-25 10:34:46 +08:00
|
|
|
|
|
2023-11-14 17:04:26 +08:00
|
|
|
|
def _run(self, op_type=10):
|
2023-11-16 17:57:27 +08:00
|
|
|
|
# 一个行人从门口走到 吧台
|
|
|
|
|
# 打招呼需要什么
|
|
|
|
|
# 行人说 哪里有位置,想晒个太阳
|
|
|
|
|
# 带领行人去有太阳的地方
|
|
|
|
|
# 行人说 有点热
|
|
|
|
|
# 好的,这就去开空调
|
2023-11-18 14:13:07 +08:00
|
|
|
|
self.walker_followed = False
|
2023-11-17 19:08:00 +08:00
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def _step(self):
|
2023-11-16 17:57:27 +08:00
|
|
|
|
|
2023-11-17 18:56:58 +08:00
|
|
|
|
|
|
|
|
|
# 如果机器人不在 吧台
|
|
|
|
|
# if "At(Robot,Bar)" not in self.state['condition_set']:
|
2023-11-18 14:13:07 +08:00
|
|
|
|
if self.walker_followed:
|
|
|
|
|
return
|
|
|
|
|
|
2023-11-17 18:56:58 +08:00
|
|
|
|
end = [self.status.location.X, self.status.location.Y]
|
2023-11-17 19:08:00 +08:00
|
|
|
|
# print("end:",end)
|
2023-11-17 18:56:58 +08:00
|
|
|
|
if end[1]>=600 or end[1]<=450 or end[0]>=250:
|
|
|
|
|
# if int(self.status.location.X)!=247 or int(self.status.location.X)!=520:
|
2023-11-18 14:13:07 +08:00
|
|
|
|
self.walker_followed = True
|
2023-11-18 17:20:13 +08:00
|
|
|
|
self.control_walkers_and_say([[0,False,300,end[0],end[1],90,"谢谢!"]])
|
2023-11-15 12:04:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
import os
|
|
|
|
|
from robowaiter.robot.robot import Robot
|
|
|
|
|
|
|
|
|
|
robot = Robot()
|
|
|
|
|
|
|
|
|
|
# create task
|
|
|
|
|
task = SceneVLM(robot)
|
|
|
|
|
task.reset()
|
2023-11-15 13:14:49 +08:00
|
|
|
|
task.run()
|