From d0e741f088681078c0bc58a1cb8313cf0d678188 Mon Sep 17 00:00:00 2001 From: Jared Swift Date: Tue, 9 Jul 2024 19:20:50 +0100 Subject: [PATCH] fix: introduce other guests to new guest. (#251) --- .../nodes/transcribe_microphone_server | 6 +- tasks/receptionist/config/arcade.yaml | 73 +++++++++++++++++++ tasks/receptionist/launch/setup.launch | 2 +- tasks/receptionist/scripts/main.py | 4 +- .../src/receptionist/states/handle_guest.py | 2 +- .../states/introduce_and_seat_guest.py | 23 +++++- 6 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 tasks/receptionist/config/arcade.yaml diff --git a/common/speech/lasr_speech_recognition_whisper/nodes/transcribe_microphone_server b/common/speech/lasr_speech_recognition_whisper/nodes/transcribe_microphone_server index 8d3fffb1c..8ca656e73 100644 --- a/common/speech/lasr_speech_recognition_whisper/nodes/transcribe_microphone_server +++ b/common/speech/lasr_speech_recognition_whisper/nodes/transcribe_microphone_server @@ -43,7 +43,7 @@ class speech_model_params: mic_device: Optional[str] = None timer_duration: Optional[int] = 20 warmup: bool = True - energy_threshold: Optional[int] = 600 + energy_threshold: Optional[int] = None pause_threshold: Optional[float] = 2.0 @@ -291,8 +291,8 @@ def parse_args() -> dict: parser.add_argument( "--energy_threshold", - type=int, - default=600, + type=Optional[int], + default=None, help="Energy threshold for silence detection. Using this disables automatic adjustment", ) diff --git a/tasks/receptionist/config/arcade.yaml b/tasks/receptionist/config/arcade.yaml new file mode 100644 index 000000000..c8300d5ca --- /dev/null +++ b/tasks/receptionist/config/arcade.yaml @@ -0,0 +1,73 @@ +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 LAB: +wait_pose: + position: + x: -15.027493553116143 + y: 8.731164058220495 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: -0.7865759968179794 + w: 0.6174934827427752 + + + +#556918144226074 + + +#0.478893309417269 +#0.8778731105321406 + + +#WAIT AREA LAB: +# From robot POV: [top left, top right,bottom right, bottom left ] +wait_area: [[-15.9, 8.19], [-17.2, 8.11], [-16.2, 11.2], [-14.9, 10.0]] + +#Where to position self for seating guests +seat_pose: + position: + x: -13.659998294234812 + y: 6.421172168922483 + z: 0.0 + orientation: + x: 0.0 + y: 0.0 + z: -0.6021594916272762 + w: 0.7983758179223494 + + + +search_motions: ["look_left", "look_right"] +sofa_point: + x: -15.0 + y: 4.21 + z: 0.5 + +seat_area: [[-12.2, 2.63], [-18.2, 4.61], [-17.4, 7.31], [-11.7, 5.06]] +max_people_on_sofa: 2 + +sofa_area: [[-13.8, 4.61], [-14.4, 3.54], [-15.85, 4.16], [-15.4, 5.33]] + +sweep: true \ No newline at end of file diff --git a/tasks/receptionist/launch/setup.launch b/tasks/receptionist/launch/setup.launch index d02ff09b2..bb5b3b957 100644 --- a/tasks/receptionist/launch/setup.launch +++ b/tasks/receptionist/launch/setup.launch @@ -1,7 +1,7 @@ - + diff --git a/tasks/receptionist/scripts/main.py b/tasks/receptionist/scripts/main.py index 6bb3b3aaa..aea5ec969 100644 --- a/tasks/receptionist/scripts/main.py +++ b/tasks/receptionist/scripts/main.py @@ -49,10 +49,10 @@ max_people_on_sofa = rospy.get_param("/receptionist/max_people_on_sofa") seat_area = ShapelyPolygon(seat_area_param) - assert seat_area.is_valid + assert seat_area.is_valid, "Seat area is not valid" sofa_area = ShapelyPolygon(sofa_area_param) - assert sofa_area.is_valid + assert sofa_area.is_valid, "Sofa area is not valid" sofa_point = Point(**sofa_point_param) diff --git a/tasks/receptionist/src/receptionist/states/handle_guest.py b/tasks/receptionist/src/receptionist/states/handle_guest.py index d7ae0b420..bbfe2b649 100644 --- a/tasks/receptionist/src/receptionist/states/handle_guest.py +++ b/tasks/receptionist/src/receptionist/states/handle_guest.py @@ -46,7 +46,7 @@ def __init__(self, guest_id: str): smach.StateMachine.add( f"REPEAT_GET_NAME_AND_DRINK_GUEST_{guest_id}", AskAndListen( - "Sorry, I didn't get that, please raise your voice. What is your name and favourite drink?" + "Sorry, I didn't get that, please raise your voice. What is your name and favourite drink? Please remember to say 'hi tiago'" ), transitions={ "succeeded": f"REPEAT_PARSE_NAME_AND_DRINK_GUEST_{guest_id}", diff --git a/tasks/receptionist/src/receptionist/states/introduce_and_seat_guest.py b/tasks/receptionist/src/receptionist/states/introduce_and_seat_guest.py index 7d98fefe3..ba783d003 100644 --- a/tasks/receptionist/src/receptionist/states/introduce_and_seat_guest.py +++ b/tasks/receptionist/src/receptionist/states/introduce_and_seat_guest.py @@ -655,12 +655,33 @@ def execute(self, userdata): guest_to_introduce=guest_id, guest_to_introduce_to=guest_to_introduce_to, ), + transitions={ + "succeeded": f"LOOK_AT_WAITING_GUEST_{guest_id}_{guest_to_introduce_to}", + }, + ) + + smach.StateMachine.add( + f"LOOK_AT_WAITING_GUEST_{guest_id}_{guest_to_introduce_to}", + PlayMotion(motion_name="look_very_left"), + transitions={ + "succeeded": f"INTRODUCE_{guest_to_introduce_to}_TO_{guest_id}", + "aborted": f"INTRODUCE_{guest_to_introduce_to}_TO_{guest_id}", + "preempted": f"INTRODUCE_{guest_to_introduce_to}_TO_{guest_id}", + }, + ) + + smach.StateMachine.add( + f"INTRODUCE_{guest_to_introduce_to}_TO_{guest_id}", + Introduce( + guest_to_introduce=guest_to_introduce_to, + guest_to_introduce_to=guest_id, + ), transitions={ "succeeded": ( "SELECT_SEAT" if i == len(guests_to_introduce_to) - 1 else f"GET_LOOK_POINT_{guests_to_introduce_to[i+1]}" - ) + ), }, )