diff --git a/common/speech/lasr_speech_recognition_whisper/scripts/microphone_tuning_test.py b/common/speech/lasr_speech_recognition_whisper/scripts/microphone_tuning_test.py old mode 100644 new mode 100755 diff --git a/common/speech/lasr_speech_recognition_whisper/scripts/test_microphones.py b/common/speech/lasr_speech_recognition_whisper/scripts/test_microphones.py index 39fd8fb96..c67f3a177 100644 --- a/common/speech/lasr_speech_recognition_whisper/scripts/test_microphones.py +++ b/common/speech/lasr_speech_recognition_whisper/scripts/test_microphones.py @@ -34,9 +34,10 @@ def main(args: dict) -> None: output_dir = args["output_dir"] r = sr.Recognizer() - with sr.Microphone(device_index=mic_index) as source: + with sr.Microphone(device_index=13,sample_rate=16000) as source: print("Say something!") - audio = r.listen(source) + audio = r.listen(source, timeout=5, phrase_time_limit=5) + print("Finished listening") with open(os.path.join(output_dir, "microphone.raw"), "wb") as f: f.write(audio.get_raw_data()) diff --git a/tasks/receptionist/src/receptionist/states/find_and_look_at.py b/tasks/receptionist/src/receptionist/states/find_and_look_at.py index 442d5ba42..f952c295b 100755 --- a/tasks/receptionist/src/receptionist/states/find_and_look_at.py +++ b/tasks/receptionist/src/receptionist/states/find_and_look_at.py @@ -90,7 +90,10 @@ def check_name(self, ud): detection.name == ud.guest_data[self.guest_name_in]["name"] and detection.confidence > ud.confidence ): + rospy.loginfo(f"Detection {detection.name} has confidence {detection.confidence} > {ud.confidence}") return "succeeded" + else: + rospy.loginfo(f"Detection {detection.name} has confidence {detection.confidence} <= {ud.confidence}") return "failed" def __init__( diff --git a/tasks/receptionist/src/receptionist/states/introduce.py b/tasks/receptionist/src/receptionist/states/introduce.py index 5171373cc..c184fd14a 100644 --- a/tasks/receptionist/src/receptionist/states/introduce.py +++ b/tasks/receptionist/src/receptionist/states/introduce.py @@ -27,6 +27,7 @@ def stringify_guest_data(guest_data: Dict[str, Any], guest_id: str) -> str: relevant_guest_data.setdefault( "attributes", { + "has_hair": True, "hair_shape": "unknown", "hair_colour": "unknown", "facial_hair": "No_Beard", @@ -47,19 +48,20 @@ def stringify_guest_data(guest_data: Dict[str, Any], guest_id: str) -> str: print(relevant_guest_data["attributes"].items()) for attribute, value in relevant_guest_data["attributes"].items(): - if value != "unknown" and value != False: + if value != "unknown" and value != False and value != "No_Beard": known_attributes[attribute] = value print("These are the known attributes") print(known_attributes) has_hair = False - detection = False # Whenever the an attribute is detected in the for loop, the detection flag is set to true - # so that multiple attributes are not checked at the same time for attribute, value in known_attributes.items(): if attribute == "has_hair": has_hair = True break + if has_hair == False: + guest_str += "They are bald." + ignored_attributes = [ "top", @@ -85,6 +87,8 @@ def stringify_guest_data(guest_data: Dict[str, Any], guest_id: str) -> str: ignored_attributes.append("has_hair") for attribute, value in known_attributes.items(): + detection = False # Whenever the an attribute is detected in the for loop, the detection flag is set to true + # so that multiple attributes are not checked at the same time if attribute in ignored_attributes: detection = True if has_hair: @@ -98,6 +102,9 @@ def stringify_guest_data(guest_data: Dict[str, Any], guest_id: str) -> str: f"They have {relevant_guest_data['attributes'][attribute]} hair." ) detection = True + else: + if attribute == "hair_shape" or attribute == "hair_colour": + detection = True if attribute == "facial_hair": guest_str += f"They have facial hair." detection = True