From 8cfc34a55814e3f1645e3fd5dd1e5848508ad47b Mon Sep 17 00:00:00 2001 From: Caiyishuai <39987654+Caiyishuai@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:41:36 +0800 Subject: [PATCH] caiyishuai --- robowaiter/behavior_lib/act/GreetCustomer.py | 8 +++++--- robowaiter/behavior_lib/act/MoveTo.py | 9 ++++----- robowaiter/behavior_lib/act/ServeCustomer.py | 7 +++++-- robowaiter/llm_client/data/fix_questions.txt | 8 +++++++- robowaiter/scene/scene.py | 17 ++++++++++++++--- robowaiter/scene/tasks/AT/Auto_tasks_light.py | 6 +++--- robowaiter/scene/tasks/VLM/VLM_2_AC.py | 4 ++-- 7 files changed, 40 insertions(+), 19 deletions(-) diff --git a/robowaiter/behavior_lib/act/GreetCustomer.py b/robowaiter/behavior_lib/act/GreetCustomer.py index 80fdb14..2fcdcd1 100644 --- a/robowaiter/behavior_lib/act/GreetCustomer.py +++ b/robowaiter/behavior_lib/act/GreetCustomer.py @@ -22,12 +22,14 @@ class GreetCustomer(Act): def _update(self) -> ptree.common.Status: goal = Act.place_xy_yaw_dic['Bar'] - # self.scene.walk_to(goal[0]-5,goal[1], 180, 180, 0) - # self.scene.chat_bubble("欢迎光临!请问有什么可以帮您?") - self.scene.navigator.navigate(goal=(goal[0]-5,goal[1]), animation=False) + if self.scene.is_nav_walk: + 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: self.scene.chat_bubble("欢迎光临!") + # self.scene.chat_bubble("欢迎光临!请问有什么可以帮您?") customer_name = self.scene.state['attention']['customer'] self.scene.state['greeted_customers'].add(customer_name) diff --git a/robowaiter/behavior_lib/act/MoveTo.py b/robowaiter/behavior_lib/act/MoveTo.py index d3db0e1..7d16d25 100644 --- a/robowaiter/behavior_lib/act/MoveTo.py +++ b/robowaiter/behavior_lib/act/MoveTo.py @@ -40,8 +40,10 @@ class MoveTo(Act): # 走到固定的地点 if self.target_place in Act.place_xy_yaw_dic: goal = Act.place_xy_yaw_dic[self.target_place] - # self.scene.walk_to(goal[0]+1,goal[1],goal[2]) - self.scene.navigator.navigate(goal=(goal[0] + 1, goal[1]), animation=False) + if self.scene.is_nav_walk: + 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: # 是否用容器装好 @@ -67,9 +69,6 @@ class MoveTo(Act): self.scene.move_to_obj(obj_id=obj_id) # ##################################### - - - if self.scene.take_picture: self.scene.get_obstacle_point(self.scene.db, self.status, map_ratio=self.scene.map_ratio) diff --git a/robowaiter/behavior_lib/act/ServeCustomer.py b/robowaiter/behavior_lib/act/ServeCustomer.py index 1c31e4e..d274b9c 100644 --- a/robowaiter/behavior_lib/act/ServeCustomer.py +++ b/robowaiter/behavior_lib/act/ServeCustomer.py @@ -22,8 +22,11 @@ class ServeCustomer(Act): if self.scene.state['attention']['customer'] == {}: goal = Act.place_xy_yaw_dic['Bar'] - # self.scene.walk_to(goal[0] - 5, goal[1], 180, 180, 0) - self.scene.navigator.navigate(goal=(goal[0] - 5, goal[1]), animation=False) + if self.scene.is_nav_walk: + 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"] if customer not in self.scene.state["serve_state"]: diff --git a/robowaiter/llm_client/data/fix_questions.txt b/robowaiter/llm_client/data/fix_questions.txt index eb40304..45f7bf8 100644 --- a/robowaiter/llm_client/data/fix_questions.txt +++ b/robowaiter/llm_client/data/fix_questions.txt @@ -124,4 +124,10 @@ create_sub_task 你带我去吧。 OK,请跟我来! create_sub_task -{"goal":"At(Robot,BrightTable5)"} \ No newline at end of file +{"goal":"At(Robot,BrightTable5)"} + + +可以关筒灯和关窗帘吗? +好的,请稍等。 +create_sub_task +{"goal":"Is(TubeLight,Off),Is(Curtain,Off)"} \ No newline at end of file diff --git a/robowaiter/scene/scene.py b/robowaiter/scene/scene.py index 4868270..9ae5af6 100644 --- a/robowaiter/scene/scene.py +++ b/robowaiter/scene/scene.py @@ -122,6 +122,8 @@ class Scene: self.db = DBSCAN(eps=self.map_ratio, min_samples=int(self.map_ratio / 2)) self.infoCount = 0 + self.is_nav_walk = False + file_name = os.path.join(root_path,'robowaiter/algos/navigator/map_5.pkl') if os.path.exists(file_name): with open(file_name, 'rb') as file: @@ -656,9 +658,11 @@ class Scene: obj_y += 2.5 walk_v[0] += 1 print("walk:", walk_v) - 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) - # scene = stub.Do(action) + if self.is_nav_walk: + self.navigator.navigate(goal=(walk_v[0], walk_v[1]), animation=False) + else: + 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]) # 移动到进行操作任务的指定地点 @@ -728,6 +732,10 @@ class Scene: scene = stub.Do(action) 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[2] -= 5 if op_type == 13: obj_loc[1] -= 2 @@ -1119,6 +1127,9 @@ class Scene: return world_coordinates 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) cur_obstacle_pixel_points = [] cur_obstacle_world_points = [] diff --git a/robowaiter/scene/tasks/AT/Auto_tasks_light.py b/robowaiter/scene/tasks/AT/Auto_tasks_light.py index c36eeee..04d3b38 100644 --- a/robowaiter/scene/tasks/AT/Auto_tasks_light.py +++ b/robowaiter/scene/tasks/AT/Auto_tasks_light.py @@ -16,13 +16,13 @@ class SceneAT(Scene): super().__init__(robot) self.signal_event_list = [ # (3, self.customer_say, ("System","来一号桌")), - # (-1, self.customer_say, ("System","回去吧")), - (5, self.new_set_goal, ("Is(TubeLight,Off),Is(Curtain,Off)",)) + (2, self.customer_say, (0,"可以关筒灯和关窗帘吗?")), + # (5, self.new_set_goal, ("Is(TubeLight,Off),Is(Curtain,Off)",)) ] 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)]) pass diff --git a/robowaiter/scene/tasks/VLM/VLM_2_AC.py b/robowaiter/scene/tasks/VLM/VLM_2_AC.py index 94d2bfe..beac709 100644 --- a/robowaiter/scene/tasks/VLM/VLM_2_AC.py +++ b/robowaiter/scene/tasks/VLM/VLM_2_AC.py @@ -13,8 +13,8 @@ class SceneVLM(Scene): 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] - (3, self.customer_say, (6, "好热呀,想开空调,想要温度调低点!")), - (5, self.control_walker, (6, False, 200, 60, 80, 0)), + (2, self.customer_say, (6, "好热呀,想开空调,想要温度调低点!")), + (6, self.control_walker, (6, False, 200, 60, 80, 0)), (-1, self.customer_say, (6, "谢谢!这下凉快了!")), #(-100,600) # 有人提出要开空调和关窗帘