From c9aa5b14ea227ccf9aa2fc05b40a5b1844144c04 Mon Sep 17 00:00:00 2001 From: Tian jianyong <11429339@qq.com> Date: Sun, 28 Dec 2025 16:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=B1=8F=E5=B9=95=E4=B8=8A=E6=96=B9?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=B8=AD=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- face_rec.py | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/face_rec.py b/face_rec.py index 0c95785..51463ce 100644 --- a/face_rec.py +++ b/face_rec.py @@ -46,7 +46,18 @@ class FaceRecognitionSystem: 'is_speaking': False, 'is_thinking': False, 'listening': False, - 'role_name': '' + 'is_asr_processing': False, + 'role_name': '', + 'mode': '', # 模式: await(待机)/local(展厅讲解员)/smart(访客引导者) + 'face_detect_inited': False, # 人脸识别系统是否准备就绪 + 'battery': 0, # 电池电量 % + 'bms_electric': 0, # 电池电流 mA + 'bms_voltage': 0, # 电池电压 mV + 'run_time': 0, # 运行时间 s + 'style_name': '', # 当前风格 + 'is_actioning': False, # 是否正在做动作 + 'volume': 0, # 当前音量 + 'voice_id': '', # 语音ID } # 人脸检测状态 @@ -299,14 +310,23 @@ class FaceRecognitionSystem: # 准备状态文本 status_texts = [] + # 显示当前模式 + mode_prefix = "" + if self.robot_status['mode']: + mode_prefix = f"{self.robot_status['mode']}: " + + # 收集状态信息 + status_parts = [] if self.robot_status['is_thinking']: - status_texts.append("🤔 正在思考...") - + status_parts.append("正在思考...") if self.robot_status['is_asr_processing']: - status_texts.append("👂 正在倾听...") - + status_parts.append("正在倾听...") if self.robot_status['is_speaking']: - status_texts.append("👂 正在讲话...") + status_parts.append("正在讲话...") + + # 模式 + 状态信息在同一行 + if mode_prefix or status_parts: + status_texts.append(mode_prefix + ": ".join(status_parts)) # 如果没有状态需要显示,直接返回原帧 if not status_texts: @@ -1429,6 +1449,16 @@ class FaceRecognitionSystem: self.robot_status['listening'] = status.get('listening', False) self.robot_status['is_asr_processing'] = status.get('is_asr_processing', False) self.robot_status['role_name'] = status.get('role_name', '访客引导者') + self.robot_status['mode'] = status.get('mode', '') + self.robot_status['face_detect_inited'] = status.get('face_detect_inited', False) + self.robot_status['battery'] = status.get('battery', 0) + self.robot_status['bms_electric'] = status.get('bms_electric', 0) + self.robot_status['bms_voltage'] = status.get('bms_voltage', 0) + self.robot_status['run_time'] = status.get('run_time', 0) + self.robot_status['style_name'] = status.get('style_name', '') + self.robot_status['is_actioning'] = status.get('is_actioning', False) + self.robot_status['volume'] = status.get('volume', 0) + self.robot_status['voice_id'] = status.get('voice_id', '') self.logger.debug(f"机器人状态: {self.robot_status}")