From eaac626fc26d0bcd4c1d64d04b3d4e595f30fbaa Mon Sep 17 00:00:00 2001 From: Haiwei Luo <137087599+haiwei-luo@users.noreply.github.com> Date: Mon, 8 Jul 2024 23:01:05 +0100 Subject: [PATCH] Receptionist Fix (#249) Co-authored-by: Zoe --- tasks/receptionist/config/6_floor_k.yaml | 57 +++++++++++++++++ tasks/receptionist/config/lab.yaml | 54 ++++++++-------- tasks/receptionist/config/year_10_demo.yaml | 61 +++++++++++++++++++ tasks/receptionist/launch/setup.launch | 2 +- .../receptionist/states/speech_recovery.py | 25 ++++---- 5 files changed, 160 insertions(+), 39 deletions(-) create mode 100644 tasks/receptionist/config/6_floor_k.yaml create mode 100644 tasks/receptionist/config/year_10_demo.yaml diff --git a/tasks/receptionist/config/6_floor_k.yaml b/tasks/receptionist/config/6_floor_k.yaml new file mode 100644 index 000000000..ce87ffd5a --- /dev/null +++ b/tasks/receptionist/config/6_floor_k.yaml @@ -0,0 +1,57 @@ +priors: + names: + - Adel + - Angel + - Axel + - Charlie + - Jane + - Jules + - Morgan + - Paris + - Robin + - Simone + drinks: + - cola + - iced tea + - juice pack + - milk + - orange juice + - red wine + - tropical juice + +# 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/lab.yaml b/tasks/receptionist/config/lab.yaml index 1079f3eec..9174b60ba 100644 --- a/tasks/receptionist/config/lab.yaml +++ b/tasks/receptionist/config/lab.yaml @@ -18,52 +18,52 @@ priors: - orange juice - red wine - tropical juice -# wait_pose: -# position: -# x: 2.4307581363168773 -# y: -1.661594410669659 -# z: 0.0 -# orientation: -# x: 0.0 -# y: 0.0 -# z: 0.012769969339563213 -# w: 0.9999184606171978 + +#WAIT POSE LAB: wait_pose: position: - x: 8.245934441303595 - y: 24.285935396834816 + x: 2.4307581363168773 + y: -1.661594410669659 z: 0.0 orientation: x: 0.0 y: 0.0 - z: 0.08719394681831685 - w: 0.9961913549304895 + z: 0.012769969339563213 + w: 0.9999184606171978 + +#556918144226074 + #0.478893309417269 #0.8778731105321406 -# wait_area: [[2.65, -0.61], [4.21, -0.33], [4.58, -2.27], [2.67, -2.66]] -wait_area: [[9.16, 25.3], [10.6, 25.7], [11, 24.1], [9.4, 23.7]] + +#WAIT AREA LAB: +# From robot POV: [top left, top right,bottom right, bottom left ] +wait_area: [[2.65, -0.61], [4.21, -0.33], [4.58, -2.27], [2.67, -2.66]] + +#Where to position self for seating guests seat_pose: position: - x: 7.439730848846352 - y: 22.667057212175145 + x: 1.10349540659 + y: 0.17802904565 z: 0.0 orientation: x: 0.0 y: 0.0 - z: -0.6336387580418182 - w: 0.7736290611832146 + z: 0.816644293927375 + w: 0.577141314753899 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]] +sofa_point: + x: 0.4604474902153015 + y: 1.877323865890503 + z: 0.002471923828125 + +seat_area: [[-0.39, 0.87], [-0.74, 2.18], [1.26, 2.64], [1.54, 1.26]] +max_people_on_sofa: 0 +sofa_area: [[-0.39, 0.87], [-0.74, 2.18], [1.26, 2.64], [1.54, 1.26]] sweep: true \ No newline at end of file diff --git a/tasks/receptionist/config/year_10_demo.yaml b/tasks/receptionist/config/year_10_demo.yaml new file mode 100644 index 000000000..bfeb7a0ea --- /dev/null +++ b/tasks/receptionist/config/year_10_demo.yaml @@ -0,0 +1,61 @@ +priors: + names: + - Adel + - Angel + - Axel + - Charlie + - Jane + - Jules + - Morgan + - Paris + - Robin + - Simone + drinks: + - cola + - iced tea + - juice pack + - milk + - orange juice + - red wine + - tropical juice + +# WAIT POSE YEAR 10 DEMO: +wait_pose: + position: + x: 2.675762687658822 + y: 2.3335752842925213 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: 0.77370619167885 + w: 0.6335445753518931 + +# WAIT AREA YEAR 10 DEMO: +# From robot POV: [top left, top right,bottom right, bottom left ] +wait_area: [[1.26,4.6],[2.80,4.82],[3.03,3.63],[1.53,3.4]] + +#Where to position self for seating guests +seat_pose: + position: + x: 1.10349540659 + y: 0.17802904565 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: 0.816644293927375 + w: 0.577141314753899 + + +search_motions: ["look_left", "look_right"] +sofa_point: + x: 0.4604474902153015 + y: 1.877323865890503 + z: 0.002471923828125 +seat_area: [[-0.39, 0.87], [-0.74, 2.18], [1.26, 2.64], [1.54, 1.26]] +max_people_on_sofa: 0 +#sofa_area: [[-0.39, 0.87], [-0.74, 2.18], [1.26, 2.64], [1.54, 1.26]] +sofa_area: [[0.83, 2.40], [1.16, 2.51], [1.23, 2.27], [0.91, 2.17]] + +sweep: true \ No newline at end of file diff --git a/tasks/receptionist/launch/setup.launch b/tasks/receptionist/launch/setup.launch index dad61dd79..d02ff09b2 100644 --- a/tasks/receptionist/launch/setup.launch +++ b/tasks/receptionist/launch/setup.launch @@ -18,7 +18,7 @@ - + diff --git a/tasks/receptionist/src/receptionist/states/speech_recovery.py b/tasks/receptionist/src/receptionist/states/speech_recovery.py index 7a86814c4..db9ce5f39 100644 --- a/tasks/receptionist/src/receptionist/states/speech_recovery.py +++ b/tasks/receptionist/src/receptionist/states/speech_recovery.py @@ -132,7 +132,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) + result = self._infer_second_drink(sentence_list, last_resort) if result != "unknown": return result result = self._handle_similar_spelt(sentence_list, self._available_drinks, 1) @@ -150,7 +150,7 @@ def _handle_drink(self, sentence_list, last_resort): return result else: sentence_list.append(result) - return self._infer_second_drink(sentence_list) + return self._infer_second_drink(sentence_list, last_resort) else: if not last_resort: return "unknown" @@ -164,7 +164,7 @@ def _handle_drink(self, sentence_list, last_resort): return closest_spelt else: sentence_list.append(closest_spelt) - return self._infer_second_drink(closest_spelt) + return self._infer_second_drink(closest_spelt, last_resort) def _handle_similar_spelt(self, sentence_list, available_words, distance_threshold): for input_word in sentence_list: @@ -187,17 +187,20 @@ def _handle_similar_sound(self, sentence_list, available_words, distance_thresho return available_word return "unknown" - def _infer_second_drink(self, sentence_list): + def _infer_second_drink(self, sentence_list, recover_juice=False): for input_word in sentence_list: if input_word == "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" + 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 "tropical juice" + return "unknown" for available_word in self._available_double_drinks: if input_word == available_word: return self._double_drinks_dict[input_word]