From e88a8dc1848044ae77c601b8faf1ddaee54b049a Mon Sep 17 00:00:00 2001 From: Haiwei Luo <137087599+haiwei-luo@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:46:48 +0100 Subject: [PATCH] Receptionist update with new names and drinks and coordinates (#259) Co-authored-by: Zoe --- tasks/receptionist/config/robocup_opl.yaml | 68 ++++++++++ .../config/robocup_sspl_and_opl.yaml | 125 ++++++++++++++++++ tasks/receptionist/scripts/main.py | 13 +- .../receptionist/states/speech_recovery.py | 72 +++++----- 4 files changed, 237 insertions(+), 41 deletions(-) create mode 100644 tasks/receptionist/config/robocup_opl.yaml create mode 100644 tasks/receptionist/config/robocup_sspl_and_opl.yaml diff --git a/tasks/receptionist/config/robocup_opl.yaml b/tasks/receptionist/config/robocup_opl.yaml new file mode 100644 index 000000000..9a4289095 --- /dev/null +++ b/tasks/receptionist/config/robocup_opl.yaml @@ -0,0 +1,68 @@ +priors: + names: + - Sophie + - Julia + - Emma + - Sara + - Laura + - Hayley + - Susan + - Fleur + - Gabriƫlle + - Gabrielle + - Robin + - John + - Liam + - Lucas + - William + - Kevin + - Jesse + - Noah + - Harrie + - Peter + + drinks: + - cola + - ice tea + - milk + - water + - big coke + - fanta + - dubbelfris + +# WAIT POSE KITCHEN: +wait_pose: + position: + x: 8.245934441303595 + y: 24.285935396834816 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: 0.08719394681831685 + w: 0.9961913549304895 + +# WAIT AREA KITCHEN: +wait_area: [[9.16, 25.3], [10.6, 25.7], [11, 24.1], [9.4, 23.7]] + +seat_pose: + position: + x: 7.439730848846352 + y: 22.667057212175145 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: -0.6336387580418182 + w: 0.7736290611832146 + +search_motions: ["look_left", "look_right"] +sofa_point: + x: 7.78 + y: 20.1 + z: 0.5 +seat_area: [[10.8, 20.2], [5.2, 18.9], [4.41, 21.6], [10.1, 23.1]] +max_people_on_sofa: 2 +sofa_area: [[8.52, 20.1], [7.1, 19.8], [6.71, 21.1], [8.06, 21.5]] + +sweep: true \ No newline at end of file diff --git a/tasks/receptionist/config/robocup_sspl_and_opl.yaml b/tasks/receptionist/config/robocup_sspl_and_opl.yaml new file mode 100644 index 000000000..e37706bd5 --- /dev/null +++ b/tasks/receptionist/config/robocup_sspl_and_opl.yaml @@ -0,0 +1,125 @@ +priors: + names: + - Sophie + - Julia + - Emma + - Sara + - Laura + - Hayley + - Susan + - Fleur + - Gabriƫlle + - Gabrielle + - Robin + - John + - Liam + - Lucas + - William + - Kevin + - Jesse + - Noah + - Harrie + - Peter + + drinks: + - cola + - ice tea + - milk + - water + - big coke + - fanta + - dubbelfris + +# WAIT POSE KITCHEN: +# wait_pose: +# position: +# x: 8.245934441303595 +# y: 24.285935396834816 +# z: 0.0 +# orientation: +# x: 0.0 +# y: 0.0 +# z: 0.08719394681831685 +# w: 0.9961913549304895 + +# wait_pose: +# position: +# x: 6.454753862664717 +# y: 0.010416356353356627 +# z: 0.0 +# orientation: +# x: 0.0 +# y: 0.0 +# z: -0.8609783956886402 +# w: 0.5086415261826499 + + +wait_pose: + position: + x: 6.406923818929698 + y: -0.41544372565988424 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: -0.5195673509149114 + w: 0.8544294984744273 + + + + +# WAIT AREA KITCHEN: +#wait_area: [[9.16, 25.3], [10.6, 25.7], [11, 24.1], [9.4, 23.7]] +wait_area: [[6.14, -1.40], [6.49, -2.48], [7.47, -2.13], [7.21, -0.91]] + +# seat_pose: +# position: +# x: 7.439730848846352 +# y: 22.667057212175145 +# z: 0.0 +# orientation: +# x: 0.0 +# y: 0.0 +# z: -0.6336387580418182 +# w: 0.7736290611832146 + + + +seat_pose: + position: + x: 5.6389088919722 + y: 4.08239956573278 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: 0.5812284337010483 + w: 0.8137404425598043 + + +search_motions: ["look_left", "look_right"] +sofa_point: + x: 5.668327331542969 + y: 6.621944904327393 + z: -0.005340576171875 + + +# sofa_point: +# x: 5.67 +# y: 6.62 +# z: +#seat_area: [[10.8, 20.2], [5.2, 18.9], [4.41, 21.6], [10.1, 23.1]] +seat_area: [[4.48, 6.63], [5.05, 4.92], [7.78, 5.36], [7.33, 7.34]] + +max_people_on_sofa: 2 +#sofa_area: [[8.52, 20.1], [7.1, 19.8], [6.71, 21.1], [8.06, 21.5]] +#sofa_area: [[4.59, 6.72], [4.80, 5.83], [6.51, 7.20], [6.71, 6.45]] + + +sofa_area: [[4.59, 6.72], [4.80, 5.83],[6.71, 6.45] ,[6.51, 7.20] ] + +#sofa_area: [[4.82, 6.67], [4.99, 6.17], [6.38, 6.98], [6.47, 6.42]] +# sofa_area: [[5.29, 6.58], [5.41, 6.31], [6.00, 6.70], [6.13, 6.40]] + +sweep: true + \ No newline at end of file diff --git a/tasks/receptionist/scripts/main.py b/tasks/receptionist/scripts/main.py index aea5ec969..b96a9e71b 100644 --- a/tasks/receptionist/scripts/main.py +++ b/tasks/receptionist/scripts/main.py @@ -52,7 +52,18 @@ assert seat_area.is_valid, "Seat area is not valid" sofa_area = ShapelyPolygon(sofa_area_param) - assert sofa_area.is_valid, "Sofa area is not valid" + rospy.loginfo(sofa_area.area) + rospy.loginfo(list(sofa_area.exterior.coords)) + sofa_area_publisher.publish( + PolygonStamped( + polygon=Polygon( + points=[Point(x=x, y=y, z=0.0) for (x, y) in sofa_area.exterior.coords] + ), + header=Header(frame_id="map"), + ) + ) + #rospy.spin() + # assert sofa_area.is_valid, "Sofa area is not valid" sofa_point = Point(**sofa_point_param) diff --git a/tasks/receptionist/src/receptionist/states/speech_recovery.py b/tasks/receptionist/src/receptionist/states/speech_recovery.py index 956353f11..868ea385d 100644 --- a/tasks/receptionist/src/receptionist/states/speech_recovery.py +++ b/tasks/receptionist/src/receptionist/states/speech_recovery.py @@ -24,40 +24,44 @@ def __init__( self._last_resort = last_resort self._input_type = input_type self._available_names = [ - "adel", - "angel", - "axel", - "charlie", - "jane", - "jules", - "morgan", - "paris", + "sophie", + "julia", + "emma", + "sara", + "laura", + "hayley", + "susan", + "fleur", + "gabrielle", "robin", - "simone", + "john", + "liam", + "lucas", + "william", + "kevin", + "jesse", + "noah", + "harrie", + "peter", ] self._available_single_drinks = [ "cola", + "water", "milk", + "fanta", + "dubbelfris", ] self._available_double_drinks = [ - "iced", + "ice", "tea", - "pack", - "juice", - "orange", - "red", - "wine", - "tropical", + "big", + "coke", ] self._double_drinks_dict = { - "iced": "iced tea", - "tea": "iced tea", - "pack": "juice pack", - "orange": "orange juice", - "red": "red wine", - "wine": "red wine", - "tropical": "tropical juice", - # "juice": ["orange juice", "tropical juice", "juice pack"], + "ice": "ice tea", + "tea": "ice tea", + "big": "big coke", + "coke": "big coke", } self._available_drinks = list( set(self._available_single_drinks).union(set(self._available_double_drinks)) @@ -132,7 +136,7 @@ def _handle_name(self, sentence_list, last_resort): return self._handle_closest_spelt(sentence_list, self._available_names) def _handle_drink(self, sentence_list, last_resort): - result = self._infer_second_drink(sentence_list, last_resort) + result = self._infer_second_drink(sentence_list) if result != "unknown": return result result = self._handle_similar_spelt(sentence_list, self._available_drinks, 1) @@ -150,7 +154,7 @@ def _handle_drink(self, sentence_list, last_resort): return result else: sentence_list.append(result) - return self._infer_second_drink(sentence_list, last_resort) + return self._infer_second_drink(sentence_list) else: if not last_resort: return "unknown" @@ -164,7 +168,7 @@ def _handle_drink(self, sentence_list, last_resort): return closest_spelt else: sentence_list.append(closest_spelt) - return self._infer_second_drink(sentence_list, last_resort) + return self._infer_second_drink(sentence_list) def _handle_similar_spelt(self, sentence_list, available_words, distance_threshold): for input_word in sentence_list: @@ -187,20 +191,8 @@ def _handle_similar_sound(self, sentence_list, available_words, distance_thresho return available_word return "unknown" - def _infer_second_drink(self, sentence_list, recover_juice=False): + def _infer_second_drink(self, sentence_list): for input_word in sentence_list: - if input_word == "juice": - if recover_juice: - choices = ["pack", "orange", "tropical"] - closest_word = self._handle_closest_spelt(sentence_list, choices) - if closest_word == "pack": - return "juice pack" - elif closest_word == "orange": - return "orange juice" - else: - return "tropical juice" - else: - return "unknown" for available_word in self._available_double_drinks: if input_word == available_word: return self._double_drinks_dict[input_word]