Merge branch 'main' of github.com:HPCL-EI/RoboWaiter

This commit is contained in:
ChenXL97 2023-11-30 17:27:26 +08:00
commit 933f63064b
24 changed files with 2388 additions and 434 deletions

View File

@ -16,7 +16,6 @@ import matplotlib.colors as mcolors
from robowaiter.robot.robot import root_path # 项目根目录路径
def diagonal_distance(start, end): #
return max(abs(start[0] - end[0]), abs(start[1] - end[1]))
@ -437,11 +436,11 @@ class DStarLite:
for (x, y) in changed_free:
self.map[x, y] = self.object_to_idx['free']
changed_pos.append((x, y, self.object_to_idx["free"], self.cost_map[x, y]))
# changed_pos.append((x, y, self.object_to_idx["free"], self.object_to_idx["dynamic obstacle"]))
# changed_pos.append((x, y, self.object_to_idx["free"], self.object_to_idx["obstacle"]))
for (x, y) in changed_obs:
self.map[x, y] = self.object_to_idx['dynamic obstacle']
changed_pos.append((x, y, self.object_to_idx["dynamic obstacle"], self.cost_map[x, y]))
# changed_pos.append((x, y, self.object_to_idx["dynamic obstacle"], self.object_to_idx["free"]))
self.map[x, y] = self.object_to_idx['obstacle']
changed_pos.append((x, y, self.object_to_idx["obstacle"], self.cost_map[x, y]))
# changed_pos.append((x, y, self.object_to_idx["obstacle"], self.object_to_idx["free"]))
# 更新dyna_obs 位置列表 和 占用位置列表
self.dyna_obs_list = dyna_obs
@ -557,51 +556,55 @@ class DStarLite:
step_num: 移动步数
yaw: robot朝向 (弧度)
'''
# 清空当前figure内容保留figure对象
plt.clf()
# for stopping simulation with the esc key. 按esc结束
plt.gcf().canvas.mpl_connect(
'key_release_event',
lambda event: [exit(0) if event.key == 'escape' else None])
# # 清空当前figure内容保留figure对象
# plt.clf()
# # for stopping simulation with the esc key. 按esc结束
# plt.gcf().canvas.mpl_connect(
# 'key_release_event',
# lambda event: [exit(0) if event.key == 'escape' else None])
# 缩放坐标偏移量
offset = (self.x_min / self.scale_ratio, self.x_max / self.scale_ratio,
self.y_min / self.scale_ratio, self.y_max / self.scale_ratio)
start = (self.s_start[0] + offset[0], self.s_start[1] + offset[2])
goal = (self.s_goal[0] + offset[0], self.s_goal[1] + offset[2])
# 画起点和目标
if self.s_start:
start = (self.s_start[0] + offset[0], self.s_start[1] + offset[2])
plt.plot(start[1], start[0], 'x', color='r')
if self.s_goal:
goal = (self.s_goal[0] + offset[0], self.s_goal[1] + offset[2])
plt.plot(goal[1], goal[0], 'x', color='darkorange')
# 画地图: X行Y列第一行在下面
# 范围: 横向Y[-80,290] 纵向X[-70,120]
plt.imshow(self.map, cmap='binary', alpha=0.5, origin='lower',
extent=(offset[2], offset[3],
offset[0], offset[1]))
# 画起点和目标
plt.plot(start[1], start[0], 'x', color='r')
plt.plot(goal[1], goal[0], 'x', color='darkorange')
# 画搜索路径
plt.plot([y + offset[2] for (x, y) in self.path],
[x + offset[0] for (x, y) in self.path], "-g")
# 画移动路径
next_step = min(step_num, len(self.path))
plt.plot([start[1], self.path[next_step - 1][1] + offset[2]],
[start[0], self.path[next_step - 1][0] + offset[0]], "-r")
# plt.plot([y + offset[2] for (x, y) in self.path[:next_step]],
# [x + offset[0] for (x, y) in self.path[:next_step]], "-r")
if self.s_start:
# 画移动路径
next_step = min(step_num, len(self.path))
plt.plot([start[1], self.path[next_step - 1][1] + offset[2]],
[start[0], self.path[next_step - 1][0] + offset[0]], "-r")
# plt.plot([y + offset[2] for (x, y) in self.path[:next_step]],
# [x + offset[0] for (x, y) in self.path[:next_step]], "-r")
# 画感应半径和观测范围
self.plot_circle(start[1], start[0], self.react_radius, 'lightgrey')
if yaw is not None:
plt.plot([start[1], start[1] + self.react_radius * (math.sin(yaw + self.vision_radius))],
[start[0], start[0] + self.react_radius * (math.cos(yaw + self.vision_radius))], "aqua", linewidth=1)
plt.plot([start[1], start[1] + self.react_radius * (math.sin(yaw - self.vision_radius))],
[start[0], start[0] + self.react_radius * (math.cos(yaw - self.vision_radius))], "aqua", linewidth=1)
# 画感应半径和观测范围
self.plot_circle(start[1], start[0], self.react_radius, 'lightgrey')
if yaw is not None:
plt.plot([start[1], start[1] + self.react_radius * (math.sin(yaw + self.vision_radius))],
[start[0], start[0] + self.react_radius * (math.cos(yaw + self.vision_radius))], "aqua", linewidth=1)
plt.plot([start[1], start[1] + self.react_radius * (math.sin(yaw - self.vision_radius))],
[start[0], start[0] + self.react_radius * (math.cos(yaw - self.vision_radius))], "aqua", linewidth=1)
plt.xlabel('y', loc='right')
plt.ylabel('x', loc='top')
plt.grid(color='black', linestyle='-', linewidth=0.5)
plt.show()
# plt.show()
def draw_rhs(self, rhs):
# 画地图: X行Y列第一行在下面

View File

@ -24,7 +24,7 @@ class Navigator:
map,
scale_ratio=5,
step_length=120,
velocity=250,
velocity=300,
react_radius=300,
dyna_obs_radius=40,
vision_radius=math.pi*3/7,
@ -35,6 +35,7 @@ class Navigator:
self.scale_ratio = scale_ratio # 地图缩放率s
self.step_length = step_length # 步长(单次移动)
self.step_num = self.step_length // self.scale_ratio # 单次移动地图格数
self.cur_step_num = self.step_num
self.v = velocity # 速度
self.react_radius = react_radius # robot反应半径
self.dyna_obs_radius = dyna_obs_radius
@ -42,6 +43,7 @@ class Navigator:
self.max_iteration = max_iteration # 最大规划迭代次数
self.planner = DStarLite(area_range=area_range, map=map, scale_ratio=scale_ratio, react_radius=react_radius, vision_radius=vision_radius, dyna_obs_radius=dyna_obs_radius)
self.yaw = None
def validate_goal(self, goal):
'''
@ -91,31 +93,31 @@ class Navigator:
'''
goal = np.array(self.validate_goal(goal)) # 目标合法化
pos = np.array((self.scene.status.location.X, self.scene.status.location.Y)) # 机器人当前: 位置 和 朝向
yaw = None
self.yaw = None
print('------------------navigation_start----------------------')
for i in range(self.max_iteration):
dyna_obs = self.get_dyna_obs(pos, yaw)
dyna_obs = self.get_dyna_obs(pos, self.yaw)
# dyna_obs = [np.array((walker.pose.X, walker.pose.Y)) for walker in self.scene.status.walkers]
# 周围有dyna_obs则步长根据离dyna_obs的最短距离相应减小
if dyna_obs:
min_dist = min([euclidean_distance(obs, pos) for obs in dyna_obs])
step_num = math.floor(self.step_num / (2 + self.dyna_obs_radius/min_dist))
self.cur_step_num = math.floor(self.step_num / (2 + self.dyna_obs_radius/min_dist))
# step_num = self.step_num // 2
else:
step_num = self.step_num
self.cur_step_num = self.step_num
path = self.planner.planning(pos, goal, dyna_obs)
if path:
if animation:
self.planner.draw_graph(step_num, yaw) # 画出搜索路径
next_step = min(step_num, len(path))
self.planner.draw_graph(self.cur_step_num, self.yaw) # 画出搜索路径
next_step = min(self.cur_step_num, len(path))
next_pos = path[next_step - 1]
print('plan pos:', next_pos, end=' ')
yaw = self.get_yaw(pos, next_pos)
self.scene.walk_to(next_pos[0], next_pos[1], math.degrees(yaw), velocity=self.v, dis_limit=10)
self.yaw = self.get_yaw(pos, next_pos)
self.scene.walk_to(next_pos[0], next_pos[1], math.degrees(self.yaw), velocity=self.v, dis_limit=10)
# 拍照片
if self.scene.show_ui:
self.scene.get_obstacle_point(self.scene.db, self.scene.status, map_ratio=self.scene.map_ratio)
self.scene.get_obstacle_point(self.scene.db, self.scene.status, map_ratio=self.scene.map_ratio, is_nav=True)
self.planner.path = self.planner.path[next_step - 1:] # 去除已走过的路径
pos = np.array((self.scene.status.location.X, self.scene.status.location.Y))

View File

@ -19,23 +19,28 @@
{"id": 18, "title": "好热呀!太阳也好大!", "text": "{'answer': '抱歉,我这就去开空调和关窗帘。', 'function': 'create_sub_task', 'args': '{\"goal\":\"Is(AC,On),Is(Curtain,Off)\"}'}"}
{"id": 19, "title": "下班啦!别忘了打扫卫生。", "text": "{'answer': '收到!下班啦!', 'function': 'create_sub_task', 'args': '{\"goal\":\"Is(Floor,Clean),Is(Table1,Clean),Is(Chairs,Clean),Is(AC,Off),Is(HallLight,Off),Is(TubeLight,Off),Is(Curtain,Off)\"}'}"}
{"id": 20, "title": "请问洗手间在哪里?", "text": "{'answer': '洗手间在这附近', 'function': 'get_object_info', 'args': '{\"obj\":\"洗手间\"}'}"}
{"id": 21, "title": "给我来杯酸奶和冰红茶,我坐在对面的桌子那儿。", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Chips,WaterTable),On(NFCJuice,WaterTable)\"}'}"}
{"id": 22, "title": "给我来份薯片和果汁,我坐在对面的桌子那儿。", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(BottledDrink,WaterTable),On(Yogurt,WaterTable)\"}'}"}
{"id": 23, "title": "好热呀,想开空调,想要温度调低点!", "text": "{'answer': '抱歉,我马上去开空调并调低空调温度。', 'function': 'create_sub_task', 'args': '{\"goal\":\"Is(ACTemperature,Down)\"}'}"}
{"id": 24, "title": "请问哪里有空位啊?", "text": "{'answer': '现在有不少空位呢,请问您有什么要求嘛?', 'function': None}"}
{"id": 25, "title": "我想坐高脚凳子。", "text": "{'answer': '没问题,大厅里就有这样的位置呢!', 'function': None}"}
{"id": 26, "title": "你带我去吧。", "text": "{'answer': 'OK请跟我来', 'function': 'create_sub_task', 'args': '{\"goal\":\"At(Robot,BrightTable5)\"}'}"}
{"id": 27, "title": "可以关筒灯和关窗帘吗?", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"Is(TubeLight,Off),Is(Curtain,Off)\"}'}"}
{"id": 28, "title": "给我来杯咖啡,哦对,再倒一杯水。", "text": "{'answer': '速速就好,请稍等!', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Water,WaterTable),On(Coffee,WaterTable)\"}'}"}
{"id": 29, "title": "我想来份点心和酸奶。", "text": "{'answer': '稍等片刻噢~', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Yogurt,Bar),On(Dessert,Bar)\"}'}"}
{"id": 30, "title": "酸奶。", "text": "{'answer': '稍等片刻噢~', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Yogurt,Bar)\"}'}"}
{"id": 31, "title": "你好呀,你们这有啥好吃的?", "text": "{'answer': '我们咖啡厅有咖啡,还有饮料和点心蛋糕呢?您想点什么不?', 'function': None}"}
{"id": 32, "title": "听起来都好甜呀,我女朋友爱吃水果。", "text": "{'answer': '没问题,我们也提供草莓、橘子和苹果等水果呢。', 'function': None}"}
{"id": 33, "title": "你们这人可真多。", "text": "{'answer': '目前还有空位呢,你们可以坐下来一起品尝水果呢?', 'function': 'get_object_info', 'args': '{\"obj\":\"空位\"}'}"}
{"id": 34, "title": "我女朋友怕晒,有空余的阴凉位置嘛?", "text": "{'answer': '我查询完毕,阴凉位置有两个。在你们右侧往里走,就有适合你们二位的沙发呢。', 'function': 'get_object_info', 'args': '{\"obj\":\"阴凉空位\"}'}"}
{"id": 35, "title": "那还不错。", "text": "{'answer': '是的,那边安静,不会晒到太阳呢。', 'function': None}"}
{"id": 36, "title": "我们还想一起下下棋,切磋切磋。", "text": "{'answer': '我们这有两份军棋呢,在大厅的三号桌上。', 'function': 'get_object_info', 'args': '{\"obj\":\"棋\"}'}"}
{"id": 37, "title": "请问洗手间在哪呢?", "text": "{'answer': '在后门,你们的左侧往里走就是了呢。', 'function': 'get_object_info', 'args': '{\"obj\":\"洗手间\"}'}"}
{"id": 38, "title": "我带着孩子呢,想要宽敞亮堂的地方。", "text": "{'answer': '好的,我明白了,那么我们推荐您到大厅的桌子,那里的空间比较宽敞,环境也比较明亮,适合带着孩子一起用餐。', 'function': None}"}
{"id": 39, "title": "冰红茶", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Softdrink,Bar)\"}'}"}
{"id": 40, "title": "水杯", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Glass,Bar)\"}'}"}
{"id": 21, "title": "给我来杯酸奶和冰红茶,我坐在对面的桌子那儿。", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(BottledDrink,WaterTable),On(Yogurt,WaterTable)\"}'}"}
{"id": 22, "title": "给我来份薯片和果汁,我坐在对面的桌子那儿。", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Chips,WaterTable),On(NFCJuice,WaterTable)\"}'}"}
{"id": 23, "title": "给我来份薯片和果汁,我坐在对面的水杯桌那儿。", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Chips,WaterTable),On(NFCJuice,WaterTable)\"}'}"}
{"id": 24, "title": "好热呀,想开空调,想要温度调低点!", "text": "{'answer': '抱歉,我马上去开空调并调低空调温度。', 'function': 'create_sub_task', 'args': '{\"goal\":\"Is(ACTemperature,Down)\"}'}"}
{"id": 25, "title": "请问有空位吗?", "text": "{'answer': '现在有不少空位呢,请问您有什么要求嘛?', 'function': None}"}
{"id": 26, "title": "我想坐高脚凳子。", "text": "{'answer': '没问题,大厅里就有这样的位置呢!', 'function': 'get_object_info', 'args': '{\"obj\":\"高脚凳子的空位\"}'}"}
{"id": 27, "title": "你带我去吧。", "text": "{'answer': 'OK请跟我来', 'function': 'create_sub_task', 'args': '{\"goal\":\"At(Robot,BrightTable5)\"}'}"}
{"id": 28, "title": "可以关筒灯和关窗帘吗?", "text": "{'answer': '好的,请稍等。', 'function': 'create_sub_task', 'args': '{\"goal\":\"Is(TubeLight,Off),Is(Curtain,Off)\"}'}"}
{"id": 29, "title": "给我来杯咖啡,哦对,再倒一杯水。", "text": "{'answer': '速速就好,请稍等!', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Water,WaterTable),On(Coffee,WaterTable)\"}'}"}
{"id": 30, "title": "我想来份点心和酸奶。", "text": "{'answer': '稍等片刻噢~', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Yogurt,Bar),On(Dessert,Bar)\"}'}"}
{"id": 31, "title": "酸奶。", "text": "{'answer': '稍等片刻噢~', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Yogurt,Bar)\"}'}"}
{"id": 32, "title": "你好呀,你们这有啥好吃的?", "text": "{'answer': '我们咖啡厅有咖啡,还有饮料和点心蛋糕呢?您想点什么不?', 'function': 'get_object_info', 'args': '{\"obj\":\"饮料,水果,点心\"}'}"}
{"id": 33, "title": "听起来都好甜呀,我女朋友爱吃水果。", "text": "{'answer': '没问题,我们也提供草莓、橘子和苹果等水果呢。', 'function': None}"}
{"id": 34, "title": "你们这人可真多。", "text": "{'answer': '目前还有空位呢,你们可以坐下来一起品尝水果呢?', 'function': 'get_object_info', 'args': '{\"obj\":\"空位\"}'}"}
{"id": 35, "title": "我女朋友怕晒,有空余的阴凉位置嘛?", "text": "{'answer': '我查询完毕,阴凉位置有两个。在你们右侧往里走,就有适合你们二位的沙发呢。', 'function': 'get_object_info', 'args': '{\"obj\":\"阴凉空位\"}'}"}
{"id": 36, "title": "那还不错。", "text": "{'answer': '是的,那边安静,不会晒到太阳呢。', 'function': None}"}
{"id": 37, "title": "我们还想一起下下棋,切磋切磋。", "text": "{'answer': '我们这有两份军棋呢,在大厅的三号桌上。', 'function': 'get_object_info', 'args': '{\"obj\":\"棋\"}'}"}
{"id": 38, "title": "请问洗手间在哪呢?", "text": "{'answer': '在后门,你们的左侧往里走就是了呢。', 'function': 'get_object_info', 'args': '{\"obj\":\"洗手间\"}'}"}
{"id": 39, "title": "我带着孩子呢,想要宽敞亮堂的地方。", "text": "{'answer': '好的,我明白了,那么我们推荐您到大厅的桌子,那里的空间比较宽敞,环境也比较明亮,适合带着孩子一起用餐。', 'function': None}"}
{"id": 40, "title": "冰红茶", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Softdrink,Bar)\"}'}"}
{"id": 41, "title": "水杯", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Water,Bar)\"}'}"}
{"id": 42, "title": "点心", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Dessert,Bar)\"}'}"}
{"id": 43, "title": "酸奶", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Yogurt,Bar)\"}'}"}
{"id": 44, "title": "做一杯咖啡", "text": "{'answer': '好的,我马上做咖啡', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Coffee,CoffeeTable)\"}'}"}
{"id": 45, "title": "把盒装冰红茶放到水桌", "text": "{'answer': '好的', 'function': 'create_sub_task', 'args': '{\"goal\":\"On(Softdrink,WaterTable)\"}'}"}

View File

@ -112,25 +112,32 @@ get_object_info
给我来杯酸奶和冰红茶,我坐在对面的桌子那儿。
好的,请稍等。
create_sub_task
{"goal":"On(Chips,WaterTable),On(NFCJuice,WaterTable)"}
{"goal":"On(BottledDrink,WaterTable),On(Yogurt,WaterTable)"}
给我来份薯片和果汁,我坐在对面的桌子那儿。
好的,请稍等。
create_sub_task
{"goal":"On(BottledDrink,WaterTable),On(Yogurt,WaterTable)"}
{"goal":"On(Chips,WaterTable),On(NFCJuice,WaterTable)"}
给我来份薯片和果汁,我坐在对面的水杯桌那儿。
好的,请稍等。
create_sub_task
{"goal":"On(Chips,WaterTable),On(NFCJuice,WaterTable)"}
好热呀,想开空调,想要温度调低点!
抱歉,我马上去开空调并调低空调温度。
create_sub_task
{"goal":"Is(ACTemperature,Down)"}
请问哪里有空位啊
请问有空位吗
现在有不少空位呢,请问您有什么要求嘛?
我想坐高脚凳子。
没问题,大厅里就有这样的位置呢!
get_object_info
{"obj":"高脚凳子的空位"}
你带我去吧。
OK请跟我来
@ -164,6 +171,9 @@ create_sub_task
你好呀,你们这有啥好吃的?
我们咖啡厅有咖啡,还有饮料和点心蛋糕呢?您想点什么不?
get_object_info
{"obj":"饮料,水果,点心"}
听起来都好甜呀,我女朋友爱吃水果。
没问题,我们也提供草莓、橘子和苹果等水果呢。
@ -205,5 +215,26 @@ create_sub_task
水杯
好的
create_sub_task
{"goal":"On(Glass,Bar)"}
{"goal":"On(Water,Bar)"}
点心
好的
create_sub_task
{"goal":"On(Dessert,Bar)"}
酸奶
好的
create_sub_task
{"goal":"On(Yogurt,Bar)"}
做一杯咖啡
好的,我马上做咖啡
create_sub_task
{"goal":"On(Coffee,CoffeeTable)"}
把盒装冰红茶放到水桌
好的
create_sub_task
{"goal":"On(Softdrink,WaterTable)"}

View File

@ -21,21 +21,26 @@
{"id": 20, "question": "请问洗手间在哪里?"}
{"id": 21, "question": "给我来杯酸奶和冰红茶,我坐在对面的桌子那儿。"}
{"id": 22, "question": "给我来份薯片和果汁,我坐在对面的桌子那儿。"}
{"id": 23, "question": "好热呀,想开空调,想要温度调低点!"}
{"id": 24, "question": "请问哪里有空位啊?"}
{"id": 25, "question": "我想坐高脚凳子。"}
{"id": 26, "question": "你带我去吧。"}
{"id": 27, "question": "可以关筒灯和关窗帘吗?"}
{"id": 28, "question": "给我来杯咖啡,哦对,再倒一杯水。"}
{"id": 29, "question": "我想来份点心和酸奶。"}
{"id": 30, "question": "酸奶。"}
{"id": 31, "question": "你好呀,你们这有啥好吃的?"}
{"id": 32, "question": "听起来都好甜呀,我女朋友爱吃水果。"}
{"id": 33, "question": "你们这人可真多。"}
{"id": 34, "question": "我女朋友怕晒,有空余的阴凉位置嘛?"}
{"id": 35, "question": "那还不错。"}
{"id": 36, "question": "我们还想一起下下棋,切磋切磋。"}
{"id": 37, "question": "请问洗手间在哪呢?"}
{"id": 38, "question": "我带着孩子呢,想要宽敞亮堂的地方。"}
{"id": 39, "question": "冰红茶"}
{"id": 40, "question": "水杯"}
{"id": 23, "question": "给我来份薯片和果汁,我坐在对面的水杯桌那儿。"}
{"id": 24, "question": "好热呀,想开空调,想要温度调低点!"}
{"id": 25, "question": "请问有空位吗?"}
{"id": 26, "question": "我想坐高脚凳子。"}
{"id": 27, "question": "你带我去吧。"}
{"id": 28, "question": "可以关筒灯和关窗帘吗?"}
{"id": 29, "question": "给我来杯咖啡,哦对,再倒一杯水。"}
{"id": 30, "question": "我想来份点心和酸奶。"}
{"id": 31, "question": "酸奶。"}
{"id": 32, "question": "你好呀,你们这有啥好吃的?"}
{"id": 33, "question": "听起来都好甜呀,我女朋友爱吃水果。"}
{"id": 34, "question": "你们这人可真多。"}
{"id": 35, "question": "我女朋友怕晒,有空余的阴凉位置嘛?"}
{"id": 36, "question": "那还不错。"}
{"id": 37, "question": "我们还想一起下下棋,切磋切磋。"}
{"id": 38, "question": "请问洗手间在哪呢?"}
{"id": 39, "question": "我带着孩子呢,想要宽敞亮堂的地方。"}
{"id": 40, "question": "冰红茶"}
{"id": 41, "question": "水杯"}
{"id": 42, "question": "点心"}
{"id": 43, "question": "酸奶"}
{"id": 44, "question": "做一杯咖啡"}
{"id": 45, "question": "把盒装冰红茶放到水桌"}

View File

@ -21,4 +21,4 @@ cmd_test_retri = f" passage_retrieval2.py --data {output_test_path} --model_nam
# os.system(conda_path + cmd_goal_states_with_descrip_to_train)
# os.system(conda_path + cmd_goal_states_with_descrip_to_test)
os.system("python " + cmd_get_embedding)
os.system("python " + cmd_test_retri)
# os.system("python " + cmd_test_retri)

View File

@ -56,6 +56,35 @@ class Bahavior(ptree.behaviour.Behaviour):
'BrightTable6': (5, -315, 116.5),
}
place_have_obj_xyz_dic = {
'QuietTable1': (480, 1300, 70),
'QuietTable2': (250, -240, 70),
'BrightTable1': (230, 1200, 35),
'BrightTable2': (65, 1000, 35),
'BrightTable3': (-80, 850, 35),
'BrightTable4': (-270, 520, 70),
'BrightTable5': (-270, 420, 35)
}
place_have_obj_xyz_dic.update(place_xyz_dic)
place_en2zh_name={
'Bar': "吧台",
'Bar2': "另一侧的吧台",
'WaterTable': "大厅的茶水桌",
'CoffeeTable': "咖啡桌",
'Table1': "前门的斜桌子",
'Table2': "大厅长桌子",
'Table3': "大厅长桌子",
'BrightTable6': "后门靠窗边圆桌",
'QuietTable1': "前门角落双人圆桌",
'QuietTable2': "后门角落三人圆桌",
'BrightTable1': "靠窗边第一个四人矮桌",
'BrightTable2': "靠窗边第二个四人矮桌",
'BrightTable3': "靠窗边第三个四人矮桌",
'BrightTable4': "大厅里靠窗边长桌子",
'BrightTable5': "大厅里靠窗边多人矮桌",
}
place_xy_yaw_dic={
'Bar': (247.0, 520.0, 180), # (247.0, 520.0, 100.0)
'Bar2': (240.0, 40.0, 100.0),

View File

@ -5,9 +5,17 @@ from robowaiter.llm_client.multi_rounds_retri import ask_llm, new_history
import random
from collections import deque
from translate import Translator
translator = Translator(to_lang="zh")
translator.from_lang = 'en'
translator.to_lang = 'zh-cn'
import spacy
nlp = spacy.load('en_core_web_lg')
# nlp = spacy.load('en_core_web_lg')
nlp_zh = spacy.load('zh_core_web_lg')
class History(deque):
def __init__(self,scene,customer_name):
@ -29,7 +37,8 @@ class DealChat(Act):
"create_sub_task": self.create_sub_task,
"stop_serve": self.stop_serve,
"get_object_info": self.get_object_info,
"find_location": self.find_location
# "find_location": self.find_location,
"get_number_of_objects": self.get_number_of_objects,
}
def _update(self) -> ptree.common.Status:
@ -63,6 +72,12 @@ class DealChat(Act):
return ptree.common.Status.RUNNING
def obj_name_en2zh(self,obj):
obj = obj.replace("_", " ")
obj = translator.translate(obj) #转成中文
print("====obj:=======",obj)
return obj
def create_sub_task(self, **args):
try:
goal = args['goal']
@ -84,76 +99,175 @@ class DealChat(Act):
def get_object_info(self,**args):
try:
obj = args['obj']
self.function_success = True
except:
obj = None
print("参数解析错误")
d = {"保温杯": "二号桌子"}
if obj in d.keys():
result = d[obj]
else:
result = "没有"
return result
# max_similarity = 0.02
# similar_word = None
near_object = None
d = {"保温杯": "二号桌子","洗手间":"前门","卫生间":"前门"}
# 先把 obj 转成中文
# 写死的内容
if obj in d.keys():
near_object = d[obj]
near_object = f"{obj}{near_object}附近"
obj_id = 0
else: # 根据相似性查找物品位置
obj = self.obj_name_en2zh(obj)
max_similarity = 0.02
similar_word = None
# 场景中现有物品
cur_things = set()
for item in self.scene.status.objects:
cur_things.add(self.scene.objname_en2zh_dic[item.name])
# obj与现有物品进行相似度匹配 中文的匹配
# print("==========obj==========:",obj)
query_token = nlp_zh(obj)
for w in cur_things:
word_token = nlp_zh(w)
similarity = query_token.similarity(word_token)
# print("similarity:", similarity, w)
if similarity > max_similarity:
max_similarity = similarity
similar_word = w
if similar_word:
print("max_similarity:",max_similarity,"similar_word:",similar_word)
if similar_word: # 存在同义词说明场景中存在该物品
# near_object = random.choices(list(cur_things), k=5) # 返回场景中的5个物品
# 找到距离最近的物品
similar_word_en = self.scene.objname_zh2en_dic[similar_word]
obj_dict = self.scene.status.objects
if len(obj_dict)!=0:
for id, obji in enumerate(obj_dict):
if obji.name == similar_word_en:
obj_info = obj_dict[id]
objx,objy,objz = obj_info.location.X, obj_info.location.Y, obj_info.location.Z
break
# 获取离它最近的物品
# min_dis = float('inf')
# obj_id = -1
# near_object = None
# for id,obji in enumerate(obj_dict):
# if obji.name != similar_word_en:
# obj_info = obj_dict[id]
# dis = self.scene.getDistanc3D((obj_info.location.X, obj_info.location.Y, obj_info.location.Z),(objx,objy,objz))
# if dis<min_dis:
# min_dis = dis
# obj_id = id
# near_object = obji.name
#
# near_object = f"{obj}在{self.scene.objname_en2zh_dic[near_object]}附近"
# 直接输出在哪个桌子上
min_dis = float('inf')
table_name = -1
near_object = None
for key,values in self.place_have_obj_xyz_dic.items():
dis = self.scene.getDistanc3D(values,(objx, objy, objz))
if dis<min_dis:
min_dis = dis
table_name = key
# near_object = f"{obj}在{self.place_en2zh_name[table_name]}附近"
# near_object = self.place_en2zh_name[table_name]
near_object = obj + "" + self.place_en2zh_name[table_name] +"附近"
# near_object = self.place_en2zh_name[table_name]
# near_object = "在" + self.place_en2zh_name[table_name] + "附近"
return near_object
# def find_location(self, **args):
# try:
# location = args['obj']
# self.function_success = True
# except:
# obj = None
# print("参数解析错误")
#
# # 场景中现有物品
# cur_things = set()
# for item in self.scene.status.objects:
# cur_things.add(item.name)
# # obj与现有物品进行相似度匹配
# query_token = nlp(obj)
# for w in cur_things:
# d = {"保温杯": "二号桌子"}
# if location in d.keys():
# result = d[obj]
# else:
# result = "None"
# return result
# # 用户咨询的地点
# query_token = nlp(location)
# max_similarity = 0
# similar_word = None
# # 到自己维护的地点列表中找同义词
# for w in self.scene.all_loc_en:
# word_token = nlp(w)
# similarity = query_token.similarity(word_token)
# if similarity > max_similarity:
# max_similarity = similarity
# similar_word = w
# print("similarity:", max_similarity, "similar_word:", similar_word)
# # 存在同义词说明客户咨询的地点有效
# if similar_word:
# print("max_similarity:",max_similarity,"similar_word:",similar_word)
#
# if similar_word: # 存在同义词说明场景中存在该物品
# near_object = random.choices(list(cur_things), k=5) # 返回场景中的5个物品
#
# if obj == "洗手间":
# near_object = "Door"
#
# return near_object
#
def find_location(self, **args):
# mp = list(self.scene.loc_map_en[similar_word])
# near_location = random.choice(mp)
# return near_location
def get_number_of_objects(self,**args):
try:
location = args['obj']
obj = args['obj']
self.function_success = True
obj = self.obj_name_en2zh(obj)
except:
obj = None
print("参数解析错误")
d = {"保温杯": "二号桌子"}
if location in d.keys():
result = d[obj]
# 找到最近的中文
max_similarity = 0.02
similar_word = None
# obj 是中文
# obj = translator.translate(obj) #转成中文
# print("obj:",obj)
query_token = nlp_zh(obj)
for real_obj_name in self.scene.objname_zh2en_dic.keys(): # 在中文名字里面找
word_token = nlp_zh(real_obj_name)
similarity = query_token.similarity(word_token)
# print("similarity:",similarity,real_obj_name)
if similarity > max_similarity:
max_similarity = similarity
similar_word = real_obj_name
if similar_word:
print("max_similarity:",max_similarity,"similar_word:",similar_word)
count = 0
similar_word_en = self.scene.objname_zh2en_dic[similar_word]
if similar_word_en != "Customer":
for item in self.scene.status.objects:
if item.name == similar_word_en:
count+=1
else:
result = "None"
return result
# 用户咨询的地点
# query_token = nlp(location)
# max_similarity = 0
# similar_word = None
# # 到自己维护的地点列表中找同义词
# for w in self.scene.all_loc_en:
# word_token = nlp(w)
count = len(self.scene.status.walkers)
# obj 是英文
# query_token = nlp(obj)
# for real_obj_name in self.scene.objname_en2zh_dic.keys(): # 在中文名字里面找
# word_token = nlp(real_obj_name)
# similarity = query_token.similarity(word_token)
# print("similarity:",similarity,real_obj_name)
# if similarity > max_similarity:
# max_similarity = similarity
# similar_word = w
# print("similarity:", max_similarity, "similar_word:", similar_word)
# # 存在同义词说明客户咨询的地点有效
# similar_word = real_obj_name
# if similar_word:
# mp = list(self.scene.loc_map_en[similar_word])
# near_location = random.choice(mp)
# return near_location
# print("max_similarity:",max_similarity,"similar_word:",similar_word)
return ""+str(count)+""+obj
def stop_serve(self,**args):
customer = self.scene.state["attention"]["customer"]

View File

@ -38,7 +38,7 @@ class MoveTo(Act):
# 拍照片
if self.scene.show_ui:
self.scene.get_obstacle_point(self.scene.db, self.status, map_ratio=self.scene.map_ratio)
self.scene.get_obstacle_point(self.scene.db, self.status, map_ratio=self.scene.map_ratio, is_nav=True)
# #####################################
# 走到固定的地点
@ -74,7 +74,7 @@ class MoveTo(Act):
# #####################################
if self.scene.show_ui:
self.scene.get_obstacle_point(self.scene.db, self.status, map_ratio=self.scene.map_ratio)
self.scene.get_obstacle_point(self.scene.db, self.status, map_ratio=self.scene.map_ratio, is_nav=True)
self.scene.state["condition_set"] |= (self.info["add"])

View File

@ -35,7 +35,7 @@ root_path = get_root_path()
functions = get_tools()
retrieval = Retrieval(threshold=1.8)
retrieval = Retrieval(threshold=1.9)
role_system = [{
@ -156,13 +156,15 @@ def ask_llm(question,history, func_map=None, retry=3):
else:
result = single_round(f"你是机器人服务员,顾客想知道{question}, 你的具身场景查询返回的是{result},把返回的英文名词翻译成中文,请把按照以下句子对顾客说,{answer}, 尽量简短。\n")
message = {'role': 'assistant', 'content': result, 'name': None,
'function_call': None}
history.append(message)
else:
_,response,_ = get_response(None, history,allow_function_call=False)
_,result = deal_response(response, history, func_map)
else:
# _,response,_ = get_response(None, history,allow_function_call=False)
# _,result = deal_response(response, history, func_map)
result = single_round(history[-1]["content"],
"你是机器人服务员,请把以下句子换一种表述方式对顾客说,但是意思不变,尽量简短:\n")
message = {'role': 'assistant', 'content': result, 'name': None,
'function_call': None}
history.append(message)
print(f'{len(history)}条历史记录:')
for x in history:

View File

@ -160,14 +160,33 @@ def stop_serve(
@register_tool
def get_object_info(
obj: Annotated[str, '需要获取信息的物体名称', True]
obj: Annotated[str, '需要获取位置的物体名称', True]
) -> str:
"""
获取场景中指定物体 `object` 在哪里不涉及到具体的执行任务
如果`object` 是一个地点例如洗手间则输出大门
如果`object`是咖啡则输出桌子咖啡在桌子上
如果`object` 是空桌子则输出一号桌
获取场景中`object`的位置信息在询问物品位置时调用该函数以辅助场景交互不执行动作
例如
`object`在哪里
哪有`object`
哪里有`object`
`object`在哪里
哪里有`object`
`object`放在哪里
我在哪儿能找到`object`
你们这儿有`object`
你们这里有`object`
你看见`object`了吗
`object`在你们这里吗
`object`你看见过吗
遇到上述问题时调用该函数并根据返回的结果回复物体位置信息例如
"""
# 回答:
# `object`在输出的物品附近
# 如果`object` 是一个地点,例如洗手间,则输出大门。
# 如果`object`是咖啡,输出桌子,则咖啡在桌子上。
# 如果`object`是酸奶,输出冰红茶,则酸奶在冰红茶附近。
# 如果`object` 是空桌子,则输出一号桌
near_object = None
# if obj == "Table":
# near_object = "Bar"
@ -192,22 +211,44 @@ def get_object_info(
# 获取的location为英文
# 用户想找某个地点
# """
# near_location = None
# query_token = nlp(location)
# max_similarity = 0
# similar_word = None
# for w in find_obj_utils.all_loc_en:
# word_token = nlp(w)
# similarity = query_token.similarity(word_token)
#
# if similarity > max_similarity:
# max_similarity = similarity
# similar_word = w
# print("similarity:", max_similarity, "similar_word:", similar_word)
# if similar_word:
# mp = list(find_obj_utils.loc_map_en[similar_word])
# near_location = random.choice(mp)
# return near_location
# near_location = None
# query_token = nlp(location)
# max_similarity = 0
# similar_word = None
# for w in find_obj_utils.all_loc_en:
# word_token = nlp(w)
# similarity = query_token.similarity(word_token)
#
# if similarity > max_similarity:
# max_similarity = similarity
# similar_word = w
# print("similarity:", max_similarity, "similar_word:", similar_word)
# if similar_word:
# mp = list(find_obj_utils.loc_map_en[similar_word])
# near_location = random.choice(mp)
# return near_location
@register_tool
def get_number_of_objects(
obj: Annotated[str, '需要获取数量的物体名称', True]
) -> str:
"""
获取场景中物体数量当询问场景中的物体数量时需要调用这个工具
例如询问
`obj`有多少
有多少`obj`
你们还有`obj`
'桌子有几张'
`obj`还有多的吗
`obj`有几个
`obj`有多少个
这个工具用于获取场景中指定物体 `obj` 的数量返回一个整数不涉及到具体的执行任务
如果`obj`是咖啡如果场景中有5杯咖啡就返回 5
如果`obj`是桌子如果场景中有7张桌子就返回 7
如果`obj`是行人如果场景中有10个顾客就返回 10
"""
if __name__ == "__main__":
print(dispatch_tool("get_weather", {"city_name": "beijing"}))

View File

@ -480,7 +480,7 @@ def get_obstacle_point(sence, db, scene, cur_obstacle_world_points, map_ratio):
# plt.text(0, 0.7, f'检测物体数量:{obj_detect_count}', fontsize=10)
# plt.show()
return cur_obstacle_world_points, cur_objs_id
return cur_obstacle_world_points, cur_objs_id, obj_detect_count

5
robowaiter/proto/ui.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource lang="图标" prefix="icon">
<file>C:/Users/Liang Zhen/Downloads/国防科技大学视觉识别系统--LOGO/国防科技大学logo.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,199 @@
digraph pastafarianism {
ordering=out;
graph [fontname="times-roman"];
node [fontname="times-roman"];
edge [fontname="times-roman"];
"a582faee-7147-4195-81ba-85add86624b4" [fillcolor=cyan, fontcolor=black, fontsize=20, height=0.01, label=Selector, shape=diamond, style=filled, width=0.01];
"52d9dd56-2854-495c-820a-d4f291507f33" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"a582faee-7147-4195-81ba-85add86624b4" -> "52d9dd56-2854-495c-820a-d4f291507f33";
"252a809b-7f62-49ae-addc-2191835a3544" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Chatting()", shape=ellipse, style=filled];
"52d9dd56-2854-495c-820a-d4f291507f33" -> "252a809b-7f62-49ae-addc-2191835a3544";
"39c31e0a-dd14-4477-a2e9-01754d4f25ca" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="DealChat()", shape=box, style=filled];
"52d9dd56-2854-495c-820a-d4f291507f33" -> "39c31e0a-dd14-4477-a2e9-01754d4f25ca";
"b938e131-cc32-4d66-a769-0b4539bbd4e9" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"a582faee-7147-4195-81ba-85add86624b4" -> "b938e131-cc32-4d66-a769-0b4539bbd4e9";
"0e243f89-91ee-4b48-8a2b-a685f90589d3" [fillcolor=yellow, fontcolor=black, fontsize=20, label="HasSubTask()", shape=ellipse, style=filled];
"b938e131-cc32-4d66-a769-0b4539bbd4e9" -> "0e243f89-91ee-4b48-8a2b-a685f90589d3";
"38ed4e08-f4ae-4250-ad32-eff42d5ab471" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"b938e131-cc32-4d66-a769-0b4539bbd4e9" -> "38ed4e08-f4ae-4250-ad32-eff42d5ab471";
"057834e6-77b3-416b-bebe-0e1690ea7b77" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"38ed4e08-f4ae-4250-ad32-eff42d5ab471" -> "057834e6-77b3-416b-bebe-0e1690ea7b77";
"89809d74-1aa6-4401-b296-b10cb96a0017" [fillcolor=cyan, fontcolor=black, fontsize=20, height=0.01, label=Selector, shape=diamond, style=filled, width=0.01];
"057834e6-77b3-416b-bebe-0e1690ea7b77" -> "89809d74-1aa6-4401-b296-b10cb96a0017";
"428ce8be-6e76-4032-865e-ed767f6d9cd9" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "428ce8be-6e76-4032-865e-ed767f6d9cd9";
"416609ed-eb10-4d93-a8bf-389b30c8a489" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Coffee,WaterTable)", shape=ellipse, style=filled];
"428ce8be-6e76-4032-865e-ed767f6d9cd9" -> "416609ed-eb10-4d93-a8bf-389b30c8a489";
"4fc84dda-929f-42f0-b845-2caf0dd9de9b" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"428ce8be-6e76-4032-865e-ed767f6d9cd9" -> "4fc84dda-929f-42f0-b845-2caf0dd9de9b";
"8dbb1cc4-46f0-4a7f-bd41-bf4918faad0f" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "8dbb1cc4-46f0-4a7f-bd41-bf4918faad0f";
"c4db186e-044d-4992-a6d0-dc0cf95aa3af" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Coffee,WaterTable)", shape=ellipse, style=filled];
"8dbb1cc4-46f0-4a7f-bd41-bf4918faad0f" -> "c4db186e-044d-4992-a6d0-dc0cf95aa3af";
"670d06c4-42a3-4e25-803f-43c8d6bc704c" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"8dbb1cc4-46f0-4a7f-bd41-bf4918faad0f" -> "670d06c4-42a3-4e25-803f-43c8d6bc704c";
"8ae61657-5b87-400a-b508-c99eac28f0b1" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="Make(Water)", shape=box, style=filled];
"8dbb1cc4-46f0-4a7f-bd41-bf4918faad0f" -> "8ae61657-5b87-400a-b508-c99eac28f0b1";
"499ad5e8-a924-45b2-8f9e-e376e12cc23f" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "499ad5e8-a924-45b2-8f9e-e376e12cc23f";
"933d9099-d8cb-439a-a194-5ee422cccd64" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Coffee,WaterTable)", shape=ellipse, style=filled];
"499ad5e8-a924-45b2-8f9e-e376e12cc23f" -> "933d9099-d8cb-439a-a194-5ee422cccd64";
"1d582953-04bd-4d6e-b57e-cc516073a5f2" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,WaterTable)", shape=ellipse, style=filled];
"499ad5e8-a924-45b2-8f9e-e376e12cc23f" -> "1d582953-04bd-4d6e-b57e-cc516073a5f2";
"5da03831-1168-4a0b-b5c4-e1545eae332f" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Water)", shape=ellipse, style=filled];
"499ad5e8-a924-45b2-8f9e-e376e12cc23f" -> "5da03831-1168-4a0b-b5c4-e1545eae332f";
"41cde1a8-35f2-47ec-8eb9-04bd6f7c6879" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="PutDown(Water,WaterTable)", shape=box, style=filled];
"499ad5e8-a924-45b2-8f9e-e376e12cc23f" -> "41cde1a8-35f2-47ec-8eb9-04bd6f7c6879";
"508b6d47-b448-452f-bb2a-3d214c4b33ad" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "508b6d47-b448-452f-bb2a-3d214c4b33ad";
"c1bb3e26-8883-42ea-b6c3-57b6b989609a" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Coffee)", shape=ellipse, style=filled];
"508b6d47-b448-452f-bb2a-3d214c4b33ad" -> "c1bb3e26-8883-42ea-b6c3-57b6b989609a";
"d92346dd-2191-41a5-9536-f82022404c75" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,WaterTable)", shape=ellipse, style=filled];
"508b6d47-b448-452f-bb2a-3d214c4b33ad" -> "d92346dd-2191-41a5-9536-f82022404c75";
"86966885-d2be-4e6e-9946-8cfe42a7220c" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"508b6d47-b448-452f-bb2a-3d214c4b33ad" -> "86966885-d2be-4e6e-9946-8cfe42a7220c";
"df497c9e-356b-4304-9fd0-921db828e93f" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="PutDown(Coffee,WaterTable)", shape=box, style=filled];
"508b6d47-b448-452f-bb2a-3d214c4b33ad" -> "df497c9e-356b-4304-9fd0-921db828e93f";
"1ccd2c59-53f0-42cb-ae43-54478ae1c64b" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "1ccd2c59-53f0-42cb-ae43-54478ae1c64b";
"8342fd0e-0596-496c-9534-8770a064b59e" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Coffee,WaterTable)", shape=ellipse, style=filled];
"1ccd2c59-53f0-42cb-ae43-54478ae1c64b" -> "8342fd0e-0596-496c-9534-8770a064b59e";
"04e4b336-479a-4bb3-972d-f186a3d03759" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="FreeHands()", shape=box, style=filled];
"1ccd2c59-53f0-42cb-ae43-54478ae1c64b" -> "04e4b336-479a-4bb3-972d-f186a3d03759";
"55980925-a4d9-4fde-b08a-b2dcffbec659" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "55980925-a4d9-4fde-b08a-b2dcffbec659";
"f246a574-4935-4646-a474-d866d7f8355b" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Coffee)", shape=ellipse, style=filled];
"55980925-a4d9-4fde-b08a-b2dcffbec659" -> "f246a574-4935-4646-a474-d866d7f8355b";
"d33b539f-f3ac-4934-b0d2-c538d3bde390" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,WaterTable)", shape=ellipse, style=filled];
"55980925-a4d9-4fde-b08a-b2dcffbec659" -> "d33b539f-f3ac-4934-b0d2-c538d3bde390";
"95c3881e-ad7c-4a6e-b758-683834718b67" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="PutDown(Coffee,WaterTable)", shape=box, style=filled];
"55980925-a4d9-4fde-b08a-b2dcffbec659" -> "95c3881e-ad7c-4a6e-b758-683834718b67";
"c9d033ba-b2a5-406f-8d7b-c644ee5e8a13" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "c9d033ba-b2a5-406f-8d7b-c644ee5e8a13";
"8483c080-80c2-4f0d-9787-4a8ab035c8f7" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Coffee)", shape=ellipse, style=filled];
"c9d033ba-b2a5-406f-8d7b-c644ee5e8a13" -> "8483c080-80c2-4f0d-9787-4a8ab035c8f7";
"696baf79-2e67-4225-84f9-4db8cb5a7877" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"c9d033ba-b2a5-406f-8d7b-c644ee5e8a13" -> "696baf79-2e67-4225-84f9-4db8cb5a7877";
"71f49725-d34c-4990-8956-94b0d7076872" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(WaterTable)", shape=box, style=filled];
"c9d033ba-b2a5-406f-8d7b-c644ee5e8a13" -> "71f49725-d34c-4990-8956-94b0d7076872";
"ae1795ad-99ad-4a19-ae19-3dfac64b96d5" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "ae1795ad-99ad-4a19-ae19-3dfac64b96d5";
"3f5584f5-98e4-4d97-ada4-518fd930efe1" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Coffee)", shape=ellipse, style=filled];
"ae1795ad-99ad-4a19-ae19-3dfac64b96d5" -> "3f5584f5-98e4-4d97-ada4-518fd930efe1";
"feb9d0bd-81ef-4de4-a011-554cfab12dfc" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(WaterTable)", shape=box, style=filled];
"ae1795ad-99ad-4a19-ae19-3dfac64b96d5" -> "feb9d0bd-81ef-4de4-a011-554cfab12dfc";
"0304536e-fa59-485d-a452-47a668dfe2ea" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "0304536e-fa59-485d-a452-47a668dfe2ea";
"4a75fcc7-7c99-4d64-8150-add03da82ef7" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,Coffee)", shape=ellipse, style=filled];
"0304536e-fa59-485d-a452-47a668dfe2ea" -> "4a75fcc7-7c99-4d64-8150-add03da82ef7";
"911690ee-a827-4fde-9846-5f291ef0ff6e" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"0304536e-fa59-485d-a452-47a668dfe2ea" -> "911690ee-a827-4fde-9846-5f291ef0ff6e";
"c35cb7a2-15d2-4440-bbf8-7667b5711653" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"0304536e-fa59-485d-a452-47a668dfe2ea" -> "c35cb7a2-15d2-4440-bbf8-7667b5711653";
"7baadc46-e643-4db4-bbd7-d8f109ea6c06" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="PickUp(Coffee)", shape=box, style=filled];
"0304536e-fa59-485d-a452-47a668dfe2ea" -> "7baadc46-e643-4db4-bbd7-d8f109ea6c06";
"b7923c0f-0992-4266-868d-558efbd07716" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "b7923c0f-0992-4266-868d-558efbd07716";
"d5c99c51-2edc-4d41-b2db-0068f92aa77c" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,Coffee)", shape=ellipse, style=filled];
"b7923c0f-0992-4266-868d-558efbd07716" -> "d5c99c51-2edc-4d41-b2db-0068f92aa77c";
"89129311-b249-4eab-83a7-c5cf21a35c00" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"b7923c0f-0992-4266-868d-558efbd07716" -> "89129311-b249-4eab-83a7-c5cf21a35c00";
"711d4b2e-0087-4520-9528-ad5b252aadd5" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="PickUp(Coffee)", shape=box, style=filled];
"b7923c0f-0992-4266-868d-558efbd07716" -> "711d4b2e-0087-4520-9528-ad5b252aadd5";
"6de54193-aa93-4d1a-b3f3-d04adb06a7ac" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "6de54193-aa93-4d1a-b3f3-d04adb06a7ac";
"55153a6f-cb38-4bd1-8602-d6960b6bdbfa" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,Coffee)", shape=ellipse, style=filled];
"6de54193-aa93-4d1a-b3f3-d04adb06a7ac" -> "55153a6f-cb38-4bd1-8602-d6960b6bdbfa";
"88c8b174-727b-4249-8768-17630e6e37e0" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"6de54193-aa93-4d1a-b3f3-d04adb06a7ac" -> "88c8b174-727b-4249-8768-17630e6e37e0";
"c7f0187c-a4c8-4b76-8da1-4ac790e56ee5" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="FreeHands()", shape=box, style=filled];
"6de54193-aa93-4d1a-b3f3-d04adb06a7ac" -> "c7f0187c-a4c8-4b76-8da1-4ac790e56ee5";
"acc92740-05eb-4963-b01b-63b41cf20140" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "acc92740-05eb-4963-b01b-63b41cf20140";
"5508c6dc-6c58-4d91-a2f7-81b19be0f22d" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"acc92740-05eb-4963-b01b-63b41cf20140" -> "5508c6dc-6c58-4d91-a2f7-81b19be0f22d";
"ed0d3415-95b4-4ce5-9341-b7352f78eff1" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"acc92740-05eb-4963-b01b-63b41cf20140" -> "ed0d3415-95b4-4ce5-9341-b7352f78eff1";
"248b5d9a-5160-4154-a747-35c180c26788" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Exist(Coffee)", shape=ellipse, style=filled];
"acc92740-05eb-4963-b01b-63b41cf20140" -> "248b5d9a-5160-4154-a747-35c180c26788";
"96ea24c5-198d-46ff-88e6-375a310463c2" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(Coffee)", shape=box, style=filled];
"acc92740-05eb-4963-b01b-63b41cf20140" -> "96ea24c5-198d-46ff-88e6-375a310463c2";
"370f4fa8-1789-47cf-86d4-43c1fcaec40d" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "370f4fa8-1789-47cf-86d4-43c1fcaec40d";
"3b4e2601-a215-4c53-9725-024a7272ca01" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,Coffee)", shape=ellipse, style=filled];
"370f4fa8-1789-47cf-86d4-43c1fcaec40d" -> "3b4e2601-a215-4c53-9725-024a7272ca01";
"5207249d-7ed3-4374-8c35-551323aa6e6f" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="FreeHands()", shape=box, style=filled];
"370f4fa8-1789-47cf-86d4-43c1fcaec40d" -> "5207249d-7ed3-4374-8c35-551323aa6e6f";
"adb07734-f041-4c2e-9e4c-360fc7932ec9" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "adb07734-f041-4c2e-9e4c-360fc7932ec9";
"c050928b-ea79-40c0-b9ba-fdf1cb60a773" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"adb07734-f041-4c2e-9e4c-360fc7932ec9" -> "c050928b-ea79-40c0-b9ba-fdf1cb60a773";
"07b147ab-23b5-48ae-9449-c810c93e28b4" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Exist(Coffee)", shape=ellipse, style=filled];
"adb07734-f041-4c2e-9e4c-360fc7932ec9" -> "07b147ab-23b5-48ae-9449-c810c93e28b4";
"59f2afe9-173b-41f8-921e-29cfd4ecc1c4" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(Coffee)", shape=box, style=filled];
"adb07734-f041-4c2e-9e4c-360fc7932ec9" -> "59f2afe9-173b-41f8-921e-29cfd4ecc1c4";
"fcbee6e1-0e5e-41c3-9db5-5bf808bac68b" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "fcbee6e1-0e5e-41c3-9db5-5bf808bac68b";
"f0843e6c-a65a-4d9f-971d-06766e94df66" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"fcbee6e1-0e5e-41c3-9db5-5bf808bac68b" -> "f0843e6c-a65a-4d9f-971d-06766e94df66";
"6dab056a-a232-4212-af57-5c1c1465db99" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Exist(Coffee)", shape=ellipse, style=filled];
"fcbee6e1-0e5e-41c3-9db5-5bf808bac68b" -> "6dab056a-a232-4212-af57-5c1c1465db99";
"0c2f54f1-85e8-486d-9c81-3d18f5f12ae8" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(Coffee)", shape=box, style=filled];
"fcbee6e1-0e5e-41c3-9db5-5bf808bac68b" -> "0c2f54f1-85e8-486d-9c81-3d18f5f12ae8";
"1c873ce0-8037-40a0-9394-037257e6ef1f" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "1c873ce0-8037-40a0-9394-037257e6ef1f";
"4c2f06f6-fa4b-41a2-a50d-cbd4f2370b5b" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"1c873ce0-8037-40a0-9394-037257e6ef1f" -> "4c2f06f6-fa4b-41a2-a50d-cbd4f2370b5b";
"e311ac9a-4505-442e-9ec9-47c2a0fd2ac8" [fillcolor=yellow, fontcolor=black, fontsize=20, label="On(Water,WaterTable)", shape=ellipse, style=filled];
"1c873ce0-8037-40a0-9394-037257e6ef1f" -> "e311ac9a-4505-442e-9ec9-47c2a0fd2ac8";
"b3880316-85f0-4124-a18a-fa84896d3485" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="Make(Coffee)", shape=box, style=filled];
"1c873ce0-8037-40a0-9394-037257e6ef1f" -> "b3880316-85f0-4124-a18a-fa84896d3485";
"96e46656-34ac-47aa-83b1-902ec66e53b5" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "96e46656-34ac-47aa-83b1-902ec66e53b5";
"41ad97fa-7ea9-48e4-8cd3-187dc53fe992" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,WaterTable)", shape=ellipse, style=filled];
"96e46656-34ac-47aa-83b1-902ec66e53b5" -> "41ad97fa-7ea9-48e4-8cd3-187dc53fe992";
"7e7163b1-eadd-4f81-99c5-5cd238252a79" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Water)", shape=ellipse, style=filled];
"96e46656-34ac-47aa-83b1-902ec66e53b5" -> "7e7163b1-eadd-4f81-99c5-5cd238252a79";
"18b63af1-2803-4a7d-95c2-c701dff29a51" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Exist(Coffee)", shape=ellipse, style=filled];
"96e46656-34ac-47aa-83b1-902ec66e53b5" -> "18b63af1-2803-4a7d-95c2-c701dff29a51";
"1f492236-0a16-4e47-bca0-d6cda8fc1e79" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="PutDown(Water,WaterTable)", shape=box, style=filled];
"96e46656-34ac-47aa-83b1-902ec66e53b5" -> "1f492236-0a16-4e47-bca0-d6cda8fc1e79";
"26396b01-8762-46f0-be46-224b590173ce" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "26396b01-8762-46f0-be46-224b590173ce";
"bee79c41-c84d-427a-a0b4-fe732ab6e448" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Exist(Coffee)", shape=ellipse, style=filled];
"26396b01-8762-46f0-be46-224b590173ce" -> "bee79c41-c84d-427a-a0b4-fe732ab6e448";
"7845d148-bef6-4b74-959b-5e13fbe75330" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(Coffee)", shape=box, style=filled];
"26396b01-8762-46f0-be46-224b590173ce" -> "7845d148-bef6-4b74-959b-5e13fbe75330";
"eee68ac0-f125-4074-a523-dcd9b1d25e42" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"89809d74-1aa6-4401-b296-b10cb96a0017" -> "eee68ac0-f125-4074-a523-dcd9b1d25e42";
"bc97fe9a-8eeb-4d4f-8865-025bf8ab1d0e" [fillcolor=yellow, fontcolor=black, fontsize=20, label="Holding(Nothing)", shape=ellipse, style=filled];
"eee68ac0-f125-4074-a523-dcd9b1d25e42" -> "bc97fe9a-8eeb-4d4f-8865-025bf8ab1d0e";
"e631843b-92d8-4612-8dcf-7dd66b86a531" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="Make(Coffee)", shape=box, style=filled];
"eee68ac0-f125-4074-a523-dcd9b1d25e42" -> "e631843b-92d8-4612-8dcf-7dd66b86a531";
"1c7e5f57-89fe-40d3-a5fe-45d7fa2e7f90" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="DelSubTree()", shape=box, style=filled];
"057834e6-77b3-416b-bebe-0e1690ea7b77" -> "1c7e5f57-89fe-40d3-a5fe-45d7fa2e7f90";
"deb5f50b-93ac-4601-a5f1-af68f0f9d50a" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"a582faee-7147-4195-81ba-85add86624b4" -> "deb5f50b-93ac-4601-a5f1-af68f0f9d50a";
"8d9e0427-c7c4-4c8a-b6a1-d3cf0a7ae4c6" [fillcolor=yellow, fontcolor=black, fontsize=20, label="FocusingCustomer()", shape=ellipse, style=filled];
"deb5f50b-93ac-4601-a5f1-af68f0f9d50a" -> "8d9e0427-c7c4-4c8a-b6a1-d3cf0a7ae4c6";
"a8ab831b-5e89-41c6-9a6a-15441aa1d32b" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="ServeCustomer()", shape=box, style=filled];
"deb5f50b-93ac-4601-a5f1-af68f0f9d50a" -> "a8ab831b-5e89-41c6-9a6a-15441aa1d32b";
"cc071d28-4cb6-4bbd-a866-38f48b77efda" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"a582faee-7147-4195-81ba-85add86624b4" -> "cc071d28-4cb6-4bbd-a866-38f48b77efda";
"e227e659-1432-4fba-8b6a-a9364e51076c" [fillcolor=yellow, fontcolor=black, fontsize=20, label="NewCustomer()", shape=ellipse, style=filled];
"cc071d28-4cb6-4bbd-a866-38f48b77efda" -> "e227e659-1432-4fba-8b6a-a9364e51076c";
"d3a930dc-8300-4510-a83c-5f070170bb5b" [fillcolor=cyan, fontcolor=black, fontsize=20, height=0.01, label=Selector, shape=diamond, style=filled, width=0.01];
"cc071d28-4cb6-4bbd-a866-38f48b77efda" -> "d3a930dc-8300-4510-a83c-5f070170bb5b";
"85295be4-2eed-4dac-98f6-040450241204" [fillcolor=yellow, fontcolor=black, fontsize=20, label="At(Robot,Bar)", shape=ellipse, style=filled];
"d3a930dc-8300-4510-a83c-5f070170bb5b" -> "85295be4-2eed-4dac-98f6-040450241204";
"5a775c24-2a6b-445c-87e9-9eeab2b6882c" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="MoveTo(Bar)", shape=box, style=filled];
"d3a930dc-8300-4510-a83c-5f070170bb5b" -> "5a775c24-2a6b-445c-87e9-9eeab2b6882c";
"3b8f863e-eef0-43e9-8ccc-4086c59af2a1" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="GreetCustomer()", shape=box, style=filled];
"cc071d28-4cb6-4bbd-a866-38f48b77efda" -> "3b8f863e-eef0-43e9-8ccc-4086c59af2a1";
"16c9b1ee-9159-4816-92a4-37c149d0233a" [fillcolor=orange, fontcolor=black, fontsize=20, height=0.01, label=Sequence, shape=octagon, style=filled, width=0.01];
"a582faee-7147-4195-81ba-85add86624b4" -> "16c9b1ee-9159-4816-92a4-37c149d0233a";
"967d7a51-f3e2-4b8f-9331-dc75660d7136" [fillcolor=yellow, fontcolor=black, fontsize=20, label="AnomalyDetected()", shape=ellipse, style=filled];
"16c9b1ee-9159-4816-92a4-37c149d0233a" -> "967d7a51-f3e2-4b8f-9331-dc75660d7136";
"9b9909d3-e999-4706-b4de-1c60dfe53a14" [fillcolor=lawngreen, fontcolor=black, fontsize=20, label="ResolveAnomaly()", shape=box, style=filled];
"16c9b1ee-9159-4816-92a4-37c149d0233a" -> "9b9909d3-e999-4706-b4de-1c60dfe53a14";
}

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -1,4 +1,5 @@
import io
import json
import pickle
import sys
import time
@ -16,7 +17,7 @@ from robowaiter.proto import GrabSim_pb2_grpc
import copy
import os
from robowaiter.scene.ui import scene_ui
# from robowaiter.scene.ui import scene_ui
from robowaiter.utils import get_root_path
from sklearn.cluster import DBSCAN
from matplotlib import pyplot as plt
@ -39,7 +40,143 @@ channel = grpc.insecure_channel(
animation_step = [4, 5, 7, 3, 3]
loc_offset = [-700, -1400]
objname_en2zh_dic_goal = {
'Customer':'顾客',
'Banana': '香蕉',
'Toothpaste': '牙膏',
'Bread': '面包',
'Softdrink': '盒装饮料',
'Yogurt': '酸奶',
'ADMilk': '安佳牛奶',
'VacuumCup': '真空杯',
'Bernachon': '贝尔纳松',
'BottledDrink': '瓶装饮料',
'PencilVase': '铅笔花瓶',
'Teacup': '茶杯',
'Dictionary': '字典',
'Cake': '蛋糕',
'Stapler': '订书机',
'LunchBox': '午餐盒',
'Bracelet': '手镯',
'CoconutWater': '椰水',
'Walnut': '核桃',
'HamSausage': '火腿肠',
'GlueStick': '胶棒',
'AdhesiveTape': '胶带',
'Calculator': '计算器',
'Chess': '',
'Orange': '橙子',
'Glass': '玻璃杯',
'Washbowl': '洗碗盆',
'Durian': '榴莲',
'Gum': '口香糖',
'Towel': '毛巾',
'OrangeJuice': '橙汁',
'Cardcase': '卡包',
'RubikCube': '魔方',
'StickyNotes': '便签',
'NFCJuice': 'NFC果汁',
'SpringWater': '矿泉水',
'Apple': '苹果',
'Coffee': '咖啡',
'Gauze': '纱布',
'Mangosteen': '山竹',
'SesameSeedCake': '芝麻糕',
'Glove': '手套',
'Mouse': '鼠标',
'Kettle': '水壶',
'Atomize': '喷雾器',
'Chips': '薯片',
'SpongeGourd': '丝瓜',
'Garlic': '大蒜',
'Potato': '土豆',
'Tray': '托盘',
'Hemomanometer': '血压计',
'TennisBall': '网球',
'ToyDog': '玩具狗',
'ToyBear': '玩具熊',
'TeaTray': '茶盘',
'Sock': '袜子',
'Scarf': '围巾',
'ToiletPaper': '卫生纸',
'Milk': '牛奶',
'Novel': '小说',
'Watermelon': '西瓜',
'Tomato': '番茄',
'CleansingFoam': '洁面泡沫',
'CoconutMilk': '椰奶',
'SugarlessGum': '无糖口香糖',
'MedicalAdhesiveTape': '医用胶带',
'PaperCup': '纸杯',
'Caddy': '茶匙',
'Date': '日期',
'MilkDrink': '牛奶饮品',
'CocountWater': '椰水',
'AdhensiveTape': '胶带',
'Towl': '毛巾',
'Soap': '肥皂',
'CocountMilk': '椰奶',
'MedicalAdhensiveTape': '医用胶带',
'SourMilkDrink': '酸奶饮品',
'Tissue': '纸巾',
'YogurtDrink': '酸奶饮品',
'Newspaper': '报纸',
'Box': '盒子',
'PaperCupStarbucks': '星巴克纸杯',
'CoffeeMachine': '咖啡机',
'GingerLHand': '机器人左手',
'GingerRHand': '机器人右手',
'Straw': '吸管',
'Door': '',
'Machine': '机器',
'PackagedCoffee': '包装咖啡',
'CubeSugar': '方糖',
'Spoon': '勺子',
'Drinks': '饮料',
'Drink': '饮料',
'Take-AwayCup': '外带杯',
'Saucer': '茶杯',
'TrashBin': '垃圾桶',
'Knife': '',
'Ginger': '',
'Floor': '地板',
'Roof': '屋顶',
'Wall': '',
'Broom':'扫帚',
'CoffeeCup': '咖啡杯',
'Mug': '马克杯',
'ZhuZi': '著子',
'LaJiTong': '垃圾桶',
'ZaoTai': '灶台',
'Sofa': '沙发',
'ChaTou': '插头',
'Plate': '盘子',
'CoffeeBag': '咖啡袋',
'TuoBu': '拖布',
'KaiGuan': '开关',
'ChaZuo': '插座',
'Sugar': '',
'BaTai': '吧台',
'BaoJing': '报警',
'DrinkMachine': '饮料机',
'KongTiao': '空调',
'Desk': '桌子',
'Clip': '夹子',
'TuoPan': '托盘',
'BoJi': '簸箕',
'ZhiBeiHe': '纸杯盒',
'WaterCup': '水杯',
'Chair': '椅子',
'Hand': '',
'XiGuan': '吸管',
'Container': '容器',
'IceMachine': '制冰机',
'KaoXiang': '烤箱',
'SaoBa': '扫把',
'XiangGui': '香柜',
}
objname_zh2en_dic_goal = dict(zip(objname_en2zh_dic_goal.values(), objname_en2zh_dic_goal.keys()))
# print(objname_zh2eh_dic)
def show_image(camera_data):
print('------------------show_image----------------------')
@ -66,6 +203,9 @@ class Scene:
# camera_interval = 1.5
output_path = os.path.join(os.path.dirname(__file__), "outputs")
objname_en2zh_dic = objname_en2zh_dic_goal
objname_zh2en_dic = objname_zh2en_dic_goal
default_state = {
"map": {
"2d": None,
@ -124,13 +264,13 @@ class Scene:
# 是否展示UI
self.show_ui = False
# 图像分割
self.take_picture = False
self.take_picture = True
self.map_ratio = 5
self.map_map = np.zeros((math.ceil(950 / self.map_ratio), math.ceil(1850 / self.map_ratio)))
self.db = DBSCAN(eps=self.map_ratio, min_samples=int(self.map_ratio / 2))
self.infoCount = 0
self.is_nav_walk = False
self.is_nav_walk = True
file_name = os.path.join(root_path,'robowaiter/algos/navigator/map_5.pkl')
if os.path.exists(file_name):
@ -880,6 +1020,8 @@ class Scene:
scene = self.stub.AddObjects(GrabSim_pb2.ObjectList(objects=obj_list, scene=self.sceneID))
time.sleep(1.0)
# 实现抓握操作
def grasp_obj(self, obj_id, hand_id=1):
print('------------------adjust_joints----------------------')
@ -1039,7 +1181,7 @@ class Scene:
# cur_obstacle_world_points, cur_objs_id = camera.get_obstacle_point(plt, db, scene,
# cur_obstacle_world_points, map_ratio)
cur_obstacle_world_points, cur_objs_id = camera.get_obstacle_point(self, db, scene,
cur_obstacle_world_points, cur_objs_id, obj_detect_count= camera.get_obstacle_point(self, db, scene,
cur_obstacle_world_points, map_ratio)
# cur_obstacle_world_points, cur_objs_id = self.get_obstacle_point(db, scene, map_ratio)
# # self.get_obstacle_point(db, scene, cur_obstacle_world_points, map_ratio)
@ -1065,12 +1207,12 @@ class Scene:
# cur_objs, objs_name_set = camera.get_semantic_map(GrabSim_pb2.CameraName.Head_Segment, cur_objs,
# objs_name_set)
cur_obstacle_world_points, cur_objs_id = camera.get_obstacle_point(self, db, scene,
cur_obstacle_world_points, cur_objs_id, obj_detect_count= camera.get_obstacle_point(self, db, scene,
cur_obstacle_world_points, map_ratio)
# if scene.info == "Unreachable":
print(scene.info)
return cur_obstacle_world_points, cur_objs_id
return cur_obstacle_world_points, cur_objs_id, obj_detect_count
def isOutMap(self, pos, min_x=-200, max_x=600, min_y=-250, max_y=1300):
if pos[0] <= min_x or pos[0] >= max_x or pos[1] <= min_y or pos[1] >= max_y:
@ -1142,6 +1284,10 @@ class Scene:
def getDistance(self, pos1, pos2):
return math.sqrt((pos1[0] - pos2[0]) ** 2 + (pos1[1] - pos2[1]) ** 2)
def getDistanc3D(self, pos1, pos2):
return math.sqrt((pos1[0] - pos2[0]) ** 2 + (pos1[1] - pos2[1]) ** 2+ (pos1[2] - pos2[2]) ** 2)
def getNearestFrontier(self, cur_pos, frontiers):
dis_min = sys.maxsize
frontier_best = None
@ -1262,7 +1408,7 @@ class Scene:
def draw_current_bt(self):
pass
def get_obstacle_point(self, db, scene, map_ratio, update_info_count=0):
def get_obstacle_point(self, db, scene, map_ratio, update_info_count=0, is_nav=False):
# if abs(self.last_take_pic_tim - self.time)<
@ -1439,9 +1585,13 @@ class Scene:
self.send_img("img_label_obj")
if is_nav:
self.navigator.planner.draw_graph(self.navigator.cur_step_num, self.navigator.yaw)
else:
new_map = self.updateMap(cur_obstacle_world_points)
self.draw_map(plt,new_map)
new_map = self.updateMap(cur_obstacle_world_points)
self.draw_map(plt,new_map)
plt.axis("off")
self.send_img("img_label_map")
@ -1456,7 +1606,21 @@ class Scene:
# plt.text(0, 0.1, f'已存语义信息:{self.infoCount}', fontsize=10)
# 元组传参 pyqt5中的函数名 四个参数
self.ui_func(("get_info", walker_detect_count, obj_detect_count, update_info_count, self.infoCount))
# self.ui_func(("get_info", walker_detect_count, obj_detect_count, update_info_count, self.infoCount))
semantic_info_str=""
semantic_info_str+= f'检测行人数量:{walker_detect_count}'+"\n\n"
semantic_info_str += f'检测物体数量:{obj_detect_count}' + "\n\n"
semantic_info_str += f'更新语义信息:{update_info_count}' + "\n\n"
file_json_name = os.path.join(root_path, 'robowaiter/proto/objs.json')
with open(file_json_name) as f:
data = json.load(f)
semantic_info_str += f'已存语义信息:{len(data)}' + "\n"
# print("======semantic_info_str===========")
self.ui_func(("get_semantic_info", semantic_info_str))
# draw figures

View File

@ -1,9 +1,11 @@
import importlib
import os
from PyQt5.QtSvg import QGraphicsSvgItem, QSvgWidget
from PyQt5.QtWidgets import QApplication, QMainWindow, QListWidgetItem, QGraphicsView, QGraphicsScene, \
QGraphicsPixmapItem
QGraphicsPixmapItem, QGraphicsProxyWidget, QLineEdit
from PyQt5.QtCore import QTimer, QPoint, QRectF
from PyQt5 import QtCore
import sys
from robowaiter.scene.ui.window import Ui_MainWindow
@ -11,7 +13,7 @@ from robowaiter.utils.basic import get_root_path
from PyQt5.QtCore import QThread
import queue
import numpy as np
from PyQt5.QtGui import QImage, QPixmap, QDrag
from PyQt5.QtGui import QImage, QPixmap, QDrag, QPainter
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QThread, pyqtSignal
from robowaiter.scene.ui.scene_ui import SceneUI
@ -56,6 +58,29 @@ def run_scene(scene_cls,robot_cls,scene_queue,ui_queue):
# print("Robot system error:", str(e))
example_list = ("AEM","VLN","VLM",'GQA',"OT","AT","reset")
more_example_list = ("VLM_AC","CafeDaily")
dic_more2zh={
"VLM_AC":"开空调并调节空调温度",
"CafeDaily":"咖啡厅的一天"
}
more_example_list_zh = [value for value in dic_more2zh.values()]
class GraphicsView(QGraphicsView):
def __init__(self, parent=None):
super(GraphicsView, self).__init__(parent)
self.setRenderHint(QPainter.Antialiasing)
self.setOptimizationFlag(QGraphicsView.DontAdjustForAntialiasing, True)
self.setViewportUpdateMode(QGraphicsView.FullViewportUpdate)
self.setDragMode(QGraphicsView.ScrollHandDrag)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
def wheelEvent(self, event):
factor = 1.15
if event.angleDelta().y() > 0:
self.scale(factor, factor)
else:
self.scale(1.0 / factor, 1.0 / factor)
class UI(QMainWindow, Ui_MainWindow):
scene = None
@ -76,10 +101,24 @@ class UI(QMainWindow, Ui_MainWindow):
self.setupUi(MainWindow) # 初始化UI
MainWindow.setWindowTitle("RoboWatier")
# MainWindow.setWindowIcon(QIcon("icons/umbrella.ico"))
# 绑定说话按钮
self.btn_say.clicked.connect(self.btn_say_on_click)
self.verticalLayout_2.removeWidget(self.img_view_bt)
self.img_view_bt = GraphicsView(self.centralwidget)
self.img_view_bt.setObjectName("img_view_bt")
self.verticalLayout_2.addWidget(self.img_view_bt)
self.img_view_bt.setDragMode(QGraphicsView.ScrollHandDrag)
lineEdit = QLineEdit()
lineEdit.setReadOnly(True) # 设置只读
lineEdit.setAlignment(Qt.AlignCenter) # 设置文字居中
lineEdit.setPlaceholderText("请选择其他任务")
self.cb_task.setLineEdit(lineEdit)
# 下拉菜单绑定函数
# 下拉菜单.seleted.connect(self.你写的函数)
@ -90,12 +129,12 @@ class UI(QMainWindow, Ui_MainWindow):
# self.drag_start_position = QPoint() # 记录鼠标按下时的位置
self.cb_task.setCurrentIndex(-1)
self.cb_task.setPlaceholderText("请选择城市")
self.cb_task.setPlaceholderText("请选择更多任务")
# 多个添加条目
self.cb_task.addItems(['Java', 'C#', 'PHP'])
self.cb_task.addItems(more_example_list_zh)
# 当下拉索引发生改变时发射信号触发绑定的事件
self.cb_task.currentIndexChanged.connect(self.selectionchange)
self.cb_task.currentIndexChanged.connect(self.cb_selectionchange)
# 绑定任务演示按钮
for example in example_list:
@ -116,24 +155,15 @@ class UI(QMainWindow, Ui_MainWindow):
sys.exit(app.exec_())
def selectionchange(self, i):
def cb_selectionchange(self, i):
print(i)
# self.create_example_click(dic[i])
# 标签用来显示选中的文本
# currentText():返回选中选项的文本
# self.btn1.setText(self.cb.currentText())
# print('Items in the list are:')
# # 输出选项集合中每个选项的索引与对应的内容
# # count():返回选项集合中的数目
# for count in range(self.cb.count()):
# print('Item' + str(count) + '=' + self.cb.itemText(count))
# print('current index', i, 'selection changed', self.cb.currentText())
self.create_example_click(more_example_list[i])()
def get_info(self, walker_detect_count, obj_detect_count, update_info_count, infoCount):
print(obj_detect_count)
self.textEdit_5.clear()
self.textEdit_5.append(str(obj_detect_count))
# self.textEdit_5.setText(walker_detect_count + "_" + obj_detect_count + "_" + update_info_count + "_" + infoCount)
def get_semantic_info(self, semantic_info_str):
# self.textEdit_5.clear()
# self.textEdit_5.append(semantic_info_str)
self.textBrowser_5.clear()
self.textBrowser_5.append(semantic_info_str)
def new_history(self,customer_name,chat):
role = chat["role"]
@ -246,6 +276,17 @@ class UI(QMainWindow, Ui_MainWindow):
self.img_view_bt.setScene(scene)
pixmap_item = QGraphicsPixmapItem(pixmap)
scene.addItem(pixmap_item)
# widget = QSvgWidget(file_name)
# # widget.resize(10000, 1600)
# svg_width = widget.width()
# widget.resize(svg_width*2, 1600)
# proxy = QGraphicsProxyWidget()
# proxy.setWidget(widget)
# scene.addItem(+proxy)
elif control_name == "img_label_obj":
return
# self.label.setPixmap(pixmap)

View File

@ -10,13 +10,15 @@ import pickle
import time
import os
from robowaiter.scene.scene import Scene
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
from robowaiter.utils import get_root_path
root_path = get_root_path()
from robowaiter.scene.scene import Scene
from robowaiter.utils.bt.draw import render_dot_tree
@ -75,7 +77,7 @@ class SceneUI(Scene):
break
# cur_obstacle_world_points, cur_objs_id = self.navigation_move(plt, cur_objs, cur_obstacle_world_points,
# [[goal[0], goal[1]]], map_ratio, db, 0, 11)
cur_obstacle_world_points, cur_objs_id = self.navigation_move(self, cur_objs, cur_obstacle_world_points,
cur_obstacle_world_points, cur_objs_id, obj_detect_count = self.navigation_move(self, cur_objs, cur_obstacle_world_points,
[[goal[0], goal[1]]], map_ratio, db, 0, 11)
for point in cur_obstacle_world_points:
if point[0] < -350 or point[0] > 600 or point[1] < -400 or point[1] > 1450:
@ -111,7 +113,19 @@ class SceneUI(Scene):
# 已存语义信息
added_info += new_add_info
# plt.text(0, 0.3, f'已存语义信息:{added_info}', fontsize=10) # 在图中添加文字x和y坐标是在这个图片大小内的相对位置fontsize是字体大小
semantic_info_str = ""
# semantic_info_str += f'检测行人数量:{walker_detect_count}' + "\n\n"
semantic_info_str += f'检测物体数量:{obj_detect_count}' + "\n\n"
semantic_info_str += f'更新语义信息:{new_add_info}' + "\n\n"
semantic_info_str += f'已存语义信息:{self.infoCount}' + "\n"
self.infoCount = added_info
# print("======semantic_info_str===========")
self.ui_func(("get_semantic_info", semantic_info_str))
plt.axis("off")
# plt.show()
print("------------当前检测到的物品信息--------------")
@ -160,20 +174,30 @@ class SceneUI(Scene):
self.new_event_list = [
(5, self.customer_say, (0, "请问哪里有空位啊?")),
(13, self.customer_say, (0, "我想坐高凳子。")),
(13, self.customer_say, (0, "我想坐高凳子。")),
(3, self.customer_say, (0, "你带我去吧。")),
(45, self.control_walker, (0, False, 100, -250, 480, -90)),
(60, self.control_walker, (0, False, 100, -250, 480, -90)), #45
(-1, self.customer_say, (0, "谢谢你!这儿还不错!")),
]
def run_VLM(self):
# 场景一 拿放物品
self.gen_obj()
self.state["condition_set"]={'At(Robot,Bar)', 'Is(AC,Off)',
'Holding(Nothing)', 'Exist(Yogurt)', 'Exist(BottledDrink)',
'Exist(Softdrink)',
'Exist(Chips)', 'Exist(NFCJuice)', 'Exist(Bernachon)', 'Exist(ADMilk)', 'Exist(SpringWater)'
'Exist(VacuumCup)', 'On(VacuumCup,Table2)',
'Is(HallLight,Off)', 'Is(TubeLight,On)', 'Is(Curtain,On)',
'Is(Table1,Dirty)', 'Is(Floor,Dirty)', 'Is(Chairs,Dirty)'}
self.add_walkers([[4,1, 880], [31,250, 1200],[6,-55, 750],[10,70, -200],[27,-290, 400, 180],[26, 60,-320,90]])
self. control_walkers(walker_loc=[[-55, 750], [70, -200], [250, 1200], [0, 880]],is_autowalk = True)
# self.control_walkers(walker_loc=[[-55, 750], [70, -200], [250, 1200], [0, 880]],is_autowalk = True)
self.control_walkers(walker_loc=[[-55, 750]], is_autowalk=True)
self.signal_event_list = [
(3, self.add_walker, (20,0,700)),
(1, self.control_walker, (6, False,100, 60, 520,0)),
(1, self.customer_say, (6, "给我来份薯片和果汁,我坐在对面的桌子那儿。")),
(1, self.customer_say, (6, "给我来份薯片和果汁,我坐在对面的水杯桌那儿。")), #给我来份薯片和果汁,我坐在对面的桌子那儿。
(5, self.control_walker, (6, False, 100, -250, 480, 0)),
]
pass
@ -220,6 +244,26 @@ class SceneUI(Scene):
]
pass
def run_VLM_AC(self):
# 开关空调
# 场景二 开和调节空调温度
self.gen_obj()
self.add_walkers([[4,1, 880], [31,250, 1200],[6,-55, 750],[10,70, -200],[27,-290, 400, 180],[26, 60,-320,90]])
self.control_walkers(walker_loc=[[-55, 750]],is_autowalk = True)
self.signal_event_list = [
(3, self.add_walker, (0,0,700)),
(1, self.control_walker, (6, False,100, 60, 520,0)), #[walkerID,autowalk,speed,X,Y,Yaw]
(2, self.customer_say, (6, "好热呀,想开空调,想要温度调低点!")),
(6, self.control_walker, (6, False, 200, 60, 80, 0)),
(-1, self.customer_say, (6, "谢谢!这下凉快了!")), #(-100,600)
]
pass
def run_CafeDaily(self):
pass
def run_reset(self):
pass
@ -232,8 +276,9 @@ class SceneUI(Scene):
self.draw_current_bt()
def draw_current_bt(self):
render_dot_tree(self.robot.bt.root,target_directory=self.output_path,name="current_bt")
render_dot_tree(self.robot.bt.root,target_directory=self.output_path,name="current_bt",png_only=True)
self.ui_queue.put(('draw_from_file',"img_view_bt", f"{self.output_path}/current_bt.png"))
# self.ui_queue.put(('draw_from_file', "img_view_bt", f"{self.output_path}/current_bt.svg"))
def ui_func(self,args):
# _,_,output_path = args

View File

@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(895, 967)
MainWindow.resize(895, 980)
MainWindow.setAutoFillBackground(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
@ -96,11 +96,61 @@ class Ui_MainWindow(object):
self.label_5.setObjectName("label_5")
self.verticalLayout_2.addWidget(self.label_5)
self.img_view_bt = QtWidgets.QGraphicsView(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.img_view_bt.sizePolicy().hasHeightForWidth())
self.img_view_bt.setSizePolicy(sizePolicy)
self.img_view_bt.setMinimumSize(QtCore.QSize(0, 240))
self.img_view_bt.setObjectName("img_view_bt")
self.verticalLayout_2.addWidget(self.img_view_bt)
self.gridLayout_3.addLayout(self.verticalLayout_2, 1, 0, 1, 1)
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setContentsMargins(0, -1, -1, -1)
self.horizontalLayout_4.setSpacing(0)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_6 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
self.label_6.setSizePolicy(sizePolicy)
self.label_6.setMinimumSize(QtCore.QSize(355, 0))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label_6.setFont(font)
self.label_6.setObjectName("label_6")
self.horizontalLayout_4.addWidget(self.label_6)
self.label_7 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth())
self.label_7.setSizePolicy(sizePolicy)
self.label_7.setMinimumSize(QtCore.QSize(0, 0))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label_7.setFont(font)
self.label_7.setObjectName("label_7")
self.horizontalLayout_4.addWidget(self.label_7)
self.label_8 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth())
self.label_8.setSizePolicy(sizePolicy)
self.label_8.setMinimumSize(QtCore.QSize(0, 0))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.horizontalLayout_4.addWidget(self.label_8)
self.gridLayout_2.addLayout(self.horizontalLayout_4, 0, 0, 1, 1)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.img_label_map = QtWidgets.QLabel(self.centralwidget)
@ -140,58 +190,53 @@ class Ui_MainWindow(object):
self.img_label_obj.setObjectName("img_label_obj")
self.horizontalLayout_5.addWidget(self.img_label_obj)
self.gridLayout_2.addLayout(self.horizontalLayout_5, 1, 0, 1, 1)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setContentsMargins(0, -1, -1, -1)
self.horizontalLayout_4.setSpacing(0)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_6 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
self.label_6.setSizePolicy(sizePolicy)
self.label_6.setMinimumSize(QtCore.QSize(0, 0))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label_6.setFont(font)
self.label_6.setObjectName("label_6")
self.horizontalLayout_4.addWidget(self.label_6)
self.label_7 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth())
self.label_7.setSizePolicy(sizePolicy)
self.label_7.setMinimumSize(QtCore.QSize(0, 0))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label_7.setFont(font)
self.label_7.setObjectName("label_7")
self.horizontalLayout_4.addWidget(self.label_7)
self.label_8 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth())
self.label_8.setSizePolicy(sizePolicy)
self.label_8.setMinimumSize(QtCore.QSize(0, 0))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.horizontalLayout_4.addWidget(self.label_8)
self.gridLayout_2.addLayout(self.horizontalLayout_4, 0, 0, 1, 1)
self.gridLayout_3.addLayout(self.gridLayout_2, 0, 0, 1, 1)
self.gridLayout.addLayout(self.gridLayout_3, 6, 0, 1, 3)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.textEdit_5 = QtWidgets.QTextEdit(self.centralwidget)
self.textEdit_5.setObjectName("textEdit_5")
self.verticalLayout_3.addWidget(self.textEdit_5)
self.textBrowser_5 = QtWidgets.QTextBrowser(self.centralwidget)
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(13)
font.setBold(False)
font.setWeight(50)
self.textBrowser_5.setFont(font)
self.textBrowser_5.setLayoutDirection(QtCore.Qt.LeftToRight)
self.textBrowser_5.setStyleSheet("text-align:center;")
self.textBrowser_5.setMarkdown("")
self.textBrowser_5.setObjectName("textBrowser_5")
self.verticalLayout_3.addWidget(self.textBrowser_5)
self.gridLayout.addLayout(self.verticalLayout_3, 5, 0, 1, 1)
self.label_9 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setFamily("等线")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.gridLayout.addWidget(self.label_9, 0, 0, 1, 1)
self.btn_say = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.btn_say.setFont(font)
self.btn_say.setObjectName("btn_say")
self.gridLayout.addWidget(self.btn_say, 0, 2, 1, 1)
self.edit_say = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setFamily("Times New Roman")
font.setPointSize(14)
self.edit_say.setFont(font)
self.edit_say.setObjectName("edit_say")
self.gridLayout.addWidget(self.edit_say, 0, 1, 1, 1)
self.label = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label.setFont(font)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.btn_reset = QtWidgets.QPushButton(self.centralwidget)
@ -250,42 +295,16 @@ class Ui_MainWindow(object):
sizePolicy.setHeightForWidth(self.cb_task.sizePolicy().hasHeightForWidth())
self.cb_task.setSizePolicy(sizePolicy)
self.cb_task.setMinimumSize(QtCore.QSize(0, 25))
self.cb_task.setEditable(True)
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.cb_task.setFont(font)
self.cb_task.setEditable(False)
self.cb_task.setCurrentText("")
self.cb_task.setInsertPolicy(QtWidgets.QComboBox.InsertAtBottom)
self.cb_task.setObjectName("cb_task")
self.verticalLayout.addWidget(self.cb_task)
self.gridLayout.addLayout(self.verticalLayout, 1, 0, 1, 1)
self.label_9 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setFamily("等线")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.gridLayout.addWidget(self.label_9, 0, 0, 1, 1)
self.btn_say = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.btn_say.setFont(font)
self.btn_say.setObjectName("btn_say")
self.gridLayout.addWidget(self.btn_say, 0, 2, 1, 1)
self.label = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(14)
self.label.setFont(font)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
self.edit_say = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setFamily("Times New Roman")
font.setPointSize(14)
self.edit_say.setFont(font)
self.edit_say.setObjectName("edit_say")
self.gridLayout.addWidget(self.edit_say, 0, 1, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
@ -297,7 +316,7 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
MainWindow.setWindowTitle(_translate("MainWindow", "RoboWatier"))
self.label_10.setText(_translate("MainWindow", "顾客列表:"))
self.label_11.setText(_translate("MainWindow", "顾客历史对话:"))
__sortingEnabled = self.list_customer.isSortingEnabled()
@ -311,18 +330,23 @@ class Ui_MainWindow(object):
self.label_6.setText(_translate("MainWindow", "可达性地图"))
self.label_7.setText(_translate("MainWindow", "实例分割"))
self.label_8.setText(_translate("MainWindow", "目标检测"))
self.textBrowser_5.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'黑体\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;\"><br /></p></body></html>"))
self.label_9.setText(_translate("MainWindow", "任务演示:(播放动画时需等待动画播放完毕才会重置场景)"))
self.btn_say.setText(_translate("MainWindow", "说话"))
self.edit_say.setText(_translate("MainWindow", "Is(AC,On)"))
self.label.setText(_translate("MainWindow", "语义信息"))
self.btn_reset.setText(_translate("MainWindow", "重置场景"))
self.btn_AEM.setText(_translate("MainWindow", "环境主动探索"))
self.btn_VLN.setText(_translate("MainWindow", "视觉语言导航"))
self.btn_VLM.setText(_translate("MainWindow", "视觉语言操作"))
self.btn_GQA.setText(_translate("MainWindow", "具身多轮对话"))
self.btn_OT.setText(_translate("MainWindow", "开放具身任务"))
self.btn_OT.setText(_translate("MainWindow", "复杂具身任务"))
self.btn_AT.setText(_translate("MainWindow", "自主具身任务"))
self.cb_task.setPlaceholderText(_translate("MainWindow", "其他任务"))
self.label_9.setText(_translate("MainWindow", "任务演示:(播放动画时需等待动画播放完毕才会重置场景)"))
self.btn_say.setText(_translate("MainWindow", "说话"))
self.label.setText(_translate("MainWindow", "语义信息"))
self.edit_say.setText(_translate("MainWindow", "Is(AC,On)"))
if __name__ == "__main__":

View File

@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>895</width>
<height>967</height>
<height>980</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>RoboWatier</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
@ -147,12 +147,110 @@
</widget>
</item>
<item>
<widget class="QGraphicsView" name="img_view_bt"/>
<widget class="QGraphicsView" name="img_view_bt">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>240</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>355</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>可达性地图</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>实例分割</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>目标检测</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
@ -232,91 +330,6 @@
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>可达性地图</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>实例分割</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>目标检测</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -324,10 +337,89 @@
<item row="5" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTextEdit" name="textEdit_5"/>
<widget class="QTextBrowser" name="textBrowser_5">
<property name="font">
<font>
<family>黑体</family>
<pointsize>13</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="styleSheet">
<string notr="true">text-align:center;</string>
</property>
<property name="markdown">
<string/>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'黑体'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<family>等线</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>任务演示:(播放动画时需等待动画播放完毕才会重置场景)</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="btn_say">
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>说话</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="edit_say">
<property name="font">
<font>
<family>Times New Roman</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Is(AC,On)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>语义信息</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@ -404,7 +496,7 @@
</font>
</property>
<property name="text">
<string>开放具身任务</string>
<string>复杂具身任务</string>
</property>
</widget>
</item>
@ -435,8 +527,14 @@
<height>25</height>
</size>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="editable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="currentText">
<string/>
@ -454,60 +552,6 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<family>等线</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>任务演示:(播放动画时需等待动画播放完毕才会重置场景)</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="btn_say">
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>说话</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>黑体</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>语义信息</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="edit_say">
<property name="font">
<font>
<family>Times New Roman</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Is(AC,On)</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -27,7 +27,7 @@ class SceneVLM(Scene):
(3, self.add_walker, (5, 230, 1200)), # 0号"Girl02_C_3"
(1, self.control_walker, (0, False, 200, 60, 520, 0)),
(9, self.customer_say, (0, "早上好呀,我想找个能晒太阳的地方。")),
(1, self.customer_say, (0, "可以带我过去嘛?")),
(1, self.customer_say, (0, "可以带我过去嘛?")),#可以带我过去嘛?
(13, self.control_walker, (0, False, 50, 140, 1200, 180)), # 小女孩站在了 BrightTable1 旁边就餐啦
# # 场景2有个胖胖男人点单交流并要咖啡帮他送去角落的桌子

View File

@ -18,7 +18,36 @@ class SceneOT(Scene):
super().__init__(robot)
# 在这里加入场景中发生的事件
self.signal_event_list = [
(3, self.customer_say, ("System", "冰红茶")),
# (3, self.customer_say, ("System", "有多少盒装饮料")),
# (3, self.customer_say, ("System", "桌子有几张")),
# (3, self.customer_say, ("System", "你们这儿有军棋吗")),
# (3, self.customer_say, ("System", "军棋有几个")),
# (3, self.customer_say, ("System", "有几把椅子呀")),
# (3, self.customer_say, ("System", "有多少顾客")),
# (3, self.customer_say, ("System", "你们这儿有多少军棋")),
# (3, self.customer_say, ("System", "哪里有盒装饮料?")),
# (3, self.customer_say, ("System", "洗手间在哪里?")),#卫生间
# (3, self.customer_say, ("System", "卫生间在哪里?")),
# (3, self.customer_say, ("System", "你们这里有棋吗,在哪里")),
# (3, self.customer_say, ("System", "棋在哪里"))
# (3, self.customer_say, ("System", "有几副棋")),
# (3, self.customer_say, ("System", "我的手镯,你有看到吗")),
# (3, self.customer_say, ("System", "你们这有小说吗?")),
# (3, self.customer_say, ("System", "我昨天保温杯落在你们咖啡厅了,你看到了吗?")),
# (3, self.customer_say, ("System", "你们这有魔方吗?")),
# (3, self.customer_say, ("System", "垃圾桶在哪呀?")),
# (3, self.customer_say, ("System", "这有小说吗?在哪里")),
# (3, self.customer_say, ("System", "还有空位吗")),
(3, self.customer_say, ("System", "有空桌子吗")),
# (3, self.customer_say, ("System", "把盒装冰红茶放到水桌")),
# (3, self.customer_say, ("System", "冰红茶")),
# (3, self.customer_say, ("System", "酸奶。")),
# (3, self.customer_say, ("System","来一号桌")),
# (-1, self.customer_say, ("System","回去吧")),
@ -30,7 +59,7 @@ class SceneOT(Scene):
# ]
def _reset(self):
# self.add_walkers([[0, 880], [250, 1200]])
self.add_walkers([[0, 880], [250, 1200]])
self.gen_obj()
pass