caiyishuai

This commit is contained in:
Caiyishuai 2023-11-20 19:41:36 +08:00
parent 0383860d99
commit 8cfc34a558
7 changed files with 40 additions and 19 deletions

View File

@ -22,12 +22,14 @@ class GreetCustomer(Act):
def _update(self) -> ptree.common.Status: def _update(self) -> ptree.common.Status:
goal = Act.place_xy_yaw_dic['Bar'] goal = Act.place_xy_yaw_dic['Bar']
# self.scene.walk_to(goal[0]-5,goal[1], 180, 180, 0) if self.scene.is_nav_walk:
# self.scene.chat_bubble("欢迎光临!请问有什么可以帮您?")
self.scene.navigator.navigate(goal=(goal[0]-5,goal[1]), animation=False) self.scene.navigator.navigate(goal=(goal[0]-5,goal[1]), animation=False)
else:
self.scene.walk_to(goal[0] - 5, goal[1], 180, 180, 0)
if self.scene.show_bubble: if self.scene.show_bubble:
self.scene.chat_bubble("欢迎光临!") self.scene.chat_bubble("欢迎光临!")
# self.scene.chat_bubble("欢迎光临!请问有什么可以帮您?")
customer_name = self.scene.state['attention']['customer'] customer_name = self.scene.state['attention']['customer']
self.scene.state['greeted_customers'].add(customer_name) self.scene.state['greeted_customers'].add(customer_name)

View File

@ -40,8 +40,10 @@ class MoveTo(Act):
# 走到固定的地点 # 走到固定的地点
if self.target_place in Act.place_xy_yaw_dic: if self.target_place in Act.place_xy_yaw_dic:
goal = Act.place_xy_yaw_dic[self.target_place] goal = Act.place_xy_yaw_dic[self.target_place]
# self.scene.walk_to(goal[0]+1,goal[1],goal[2]) if self.scene.is_nav_walk:
self.scene.navigator.navigate(goal=(goal[0] + 1, goal[1]), animation=False) self.scene.navigator.navigate(goal=(goal[0] + 1, goal[1]), animation=False)
else:
self.scene.walk_to(goal[0]+1,goal[1],goal[2])
# 走到物品边上 # 走到物品边上
else: else:
# 是否用容器装好 # 是否用容器装好
@ -67,9 +69,6 @@ class MoveTo(Act):
self.scene.move_to_obj(obj_id=obj_id) self.scene.move_to_obj(obj_id=obj_id)
# ##################################### # #####################################
if self.scene.take_picture: if self.scene.take_picture:
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)

View File

@ -22,8 +22,11 @@ class ServeCustomer(Act):
if self.scene.state['attention']['customer'] == {}: if self.scene.state['attention']['customer'] == {}:
goal = Act.place_xy_yaw_dic['Bar'] goal = Act.place_xy_yaw_dic['Bar']
# self.scene.walk_to(goal[0] - 5, goal[1], 180, 180, 0) if self.scene.is_nav_walk:
self.scene.navigator.navigate(goal=(goal[0] - 5, goal[1]), animation=False) self.scene.navigator.navigate(goal=(goal[0] - 5, goal[1]), animation=False)
else:
self.scene.walk_to(goal[0] - 5, goal[1], 180, 180, 0)
customer = self.scene.state["attention"]["customer"] customer = self.scene.state["attention"]["customer"]
if customer not in self.scene.state["serve_state"]: if customer not in self.scene.state["serve_state"]:

View File

@ -125,3 +125,9 @@ create_sub_task
OK请跟我来 OK请跟我来
create_sub_task create_sub_task
{"goal":"At(Robot,BrightTable5)"} {"goal":"At(Robot,BrightTable5)"}
可以关筒灯和关窗帘吗?
好的,请稍等。
create_sub_task
{"goal":"Is(TubeLight,Off),Is(Curtain,Off)"}

View File

@ -122,6 +122,8 @@ class Scene:
self.db = DBSCAN(eps=self.map_ratio, min_samples=int(self.map_ratio / 2)) self.db = DBSCAN(eps=self.map_ratio, min_samples=int(self.map_ratio / 2))
self.infoCount = 0 self.infoCount = 0
self.is_nav_walk = False
file_name = os.path.join(root_path,'robowaiter/algos/navigator/map_5.pkl') file_name = os.path.join(root_path,'robowaiter/algos/navigator/map_5.pkl')
if os.path.exists(file_name): if os.path.exists(file_name):
with open(file_name, 'rb') as file: with open(file_name, 'rb') as file:
@ -656,9 +658,11 @@ class Scene:
obj_y += 2.5 obj_y += 2.5
walk_v[0] += 1 walk_v[0] += 1
print("walk:", walk_v) print("walk:", walk_v)
if self.is_nav_walk:
self.navigator.navigate(goal=(walk_v[0], walk_v[1]), animation=False) self.navigator.navigate(goal=(walk_v[0], walk_v[1]), animation=False)
# action = GrabSim_pb2.Action(scene=self.sceneID, action=GrabSim_pb2.Action.ActionType.WalkTo, values=walk_v) else:
# scene = stub.Do(action) action = GrabSim_pb2.Action(scene=self.sceneID, action=GrabSim_pb2.Action.ActionType.WalkTo, values=walk_v)
scene = stub.Do(action)
print("After Walk Position:", [scene.location.X, scene.location.Y, scene.rotation.Yaw]) print("After Walk Position:", [scene.location.X, scene.location.Y, scene.rotation.Yaw])
# 移动到进行操作任务的指定地点 # 移动到进行操作任务的指定地点
@ -728,6 +732,10 @@ class Scene:
scene = stub.Do(action) scene = stub.Do(action)
time.sleep(1.0) time.sleep(1.0)
if self.take_picture:
self.get_obstacle_point(self.db, self.status, map_ratio=self.map_ratio,update_info_count=1)
obj_loc = self.obj_loc[:] obj_loc = self.obj_loc[:]
obj_loc[2] -= 5 obj_loc[2] -= 5
if op_type == 13: obj_loc[1] -= 2 if op_type == 13: obj_loc[1] -= 2
@ -1119,6 +1127,9 @@ class Scene:
return world_coordinates return world_coordinates
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):
# if abs(self.last_take_pic_tim - self.time)<
# db = DBSCAN(eps=4, min_samples=2) # db = DBSCAN(eps=4, min_samples=2)
cur_obstacle_pixel_points = [] cur_obstacle_pixel_points = []
cur_obstacle_world_points = [] cur_obstacle_world_points = []

View File

@ -16,13 +16,13 @@ class SceneAT(Scene):
super().__init__(robot) super().__init__(robot)
self.signal_event_list = [ self.signal_event_list = [
# (3, self.customer_say, ("System","来一号桌")), # (3, self.customer_say, ("System","来一号桌")),
# (-1, self.customer_say, ("System","回去吧")), (2, self.customer_say, (0,"可以关筒灯和关窗帘吗?")),
(5, self.new_set_goal, ("Is(TubeLight,Off),Is(Curtain,Off)",)) # (5, self.new_set_goal, ("Is(TubeLight,Off),Is(Curtain,Off)",))
] ]
def _reset(self): def _reset(self):
# self.add_walker(1085, 2630, 220) self.add_walker(23, 60, 520,0)
# self.control_walker([self.walker_control_generator(0, False, 100, 755, 1900, 180)]) # self.control_walker([self.walker_control_generator(0, False, 100, 755, 1900, 180)])
pass pass

View File

@ -13,8 +13,8 @@ class SceneVLM(Scene):
self.signal_event_list = [ self.signal_event_list = [
(3, self.add_walker, (0,0,700)), (3, self.add_walker, (0,0,700)),
(1, self.control_walker, (6, False,100, 60, 520,0)), #[walkerID,autowalk,speed,X,Y,Yaw] (1, self.control_walker, (6, False,100, 60, 520,0)), #[walkerID,autowalk,speed,X,Y,Yaw]
(3, self.customer_say, (6, "好热呀,想开空调,想要温度调低点!")), (2, self.customer_say, (6, "好热呀,想开空调,想要温度调低点!")),
(5, self.control_walker, (6, False, 200, 60, 80, 0)), (6, self.control_walker, (6, False, 200, 60, 80, 0)),
(-1, self.customer_say, (6, "谢谢!这下凉快了!")), #(-100,600) (-1, self.customer_say, (6, "谢谢!这下凉快了!")), #(-100,600)
# 有人提出要开空调和关窗帘 # 有人提出要开空调和关窗帘