在屏幕上方提示中,增加模式信息
This commit is contained in:
parent
88ff3dff6f
commit
c9aa5b14ea
42
face_rec.py
42
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}")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user