Merge branch 'main' of http://121.37.111.42:3000/ThbTech/BodyBalanceEvaluation into main
This commit is contained in:
commit
ca3b786e62
@ -66,12 +66,8 @@ class DeviceManager:
|
|||||||
# 推流状态和线程
|
# 推流状态和线程
|
||||||
self.camera_streaming = False
|
self.camera_streaming = False
|
||||||
self.femtobolt_streaming = False
|
self.femtobolt_streaming = False
|
||||||
self.imu_streaming = False
|
|
||||||
self.pressure_streaming = False
|
|
||||||
self.camera_streaming_thread = None
|
self.camera_streaming_thread = None
|
||||||
self.femtobolt_streaming_thread = None
|
self.femtobolt_streaming_thread = None
|
||||||
self.imu_thread = None
|
|
||||||
self.pressure_thread = None
|
|
||||||
self.streaming_stop_event = threading.Event()
|
self.streaming_stop_event = threading.Event()
|
||||||
|
|
||||||
# 全局帧缓存机制
|
# 全局帧缓存机制
|
||||||
@ -248,22 +244,17 @@ class DeviceManager:
|
|||||||
self.femtobolt_config.synchronized_images_only = True
|
self.femtobolt_config.synchronized_images_only = True
|
||||||
# 视效范围参数示例,假设SDK支持depth_range_min和depth_range_max
|
# 视效范围参数示例,假设SDK支持depth_range_min和depth_range_max
|
||||||
|
|
||||||
# 启动FemtoBolt设备(直接尝试启动,失败时优雅处理)
|
# 直接尝试启动设备(pykinect_azure库没有设备数量检测API)
|
||||||
|
logger.info('准备启动FemtoBolt设备...')
|
||||||
|
|
||||||
|
# 启动FemtoBolt设备
|
||||||
logger.info('尝试启动FemtoBolt设备...')
|
logger.info('尝试启动FemtoBolt设备...')
|
||||||
try:
|
|
||||||
self.femtobolt_camera = pykinect.start_device(config=self.femtobolt_config)
|
self.femtobolt_camera = pykinect.start_device(config=self.femtobolt_config)
|
||||||
if self.femtobolt_camera:
|
if self.femtobolt_camera:
|
||||||
self.device_status['femtobolt'] = True
|
self.device_status['femtobolt'] = True
|
||||||
logger.info('✓ FemtoBolt深度相机初始化成功!')
|
logger.info('✓ FemtoBolt深度相机初始化成功!')
|
||||||
else:
|
else:
|
||||||
logger.warning('FemtoBolt设备启动失败:设备返回None(可能未连接设备)')
|
raise Exception('设备启动返回None')
|
||||||
self.femtobolt_camera = None
|
|
||||||
self.device_status['femtobolt'] = False
|
|
||||||
except BaseException as device_error:
|
|
||||||
logger.warning(f'FemtoBolt设备启动失败: {device_error}')
|
|
||||||
logger.info('这通常表示没有连接FemtoBolt设备,系统将继续运行但不包含深度相机功能')
|
|
||||||
self.femtobolt_camera = None
|
|
||||||
self.device_status['femtobolt'] = False
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f'FemtoBolt深度相机初始化失败: {e}')
|
logger.warning(f'FemtoBolt深度相机初始化失败: {e}')
|
||||||
@ -866,6 +857,8 @@ class DeviceManager:
|
|||||||
'rotation': head_pose['rotation'], # 旋转角:左旋(-), 右旋(+)
|
'rotation': head_pose['rotation'], # 旋转角:左旋(-), 右旋(+)
|
||||||
'tilt': head_pose['tilt'], # 倾斜角:左倾(-), 右倾(+)
|
'tilt': head_pose['tilt'], # 倾斜角:左倾(-), 右倾(+)
|
||||||
'pitch': head_pose['pitch'], # 俯仰角:俯角(-), 仰角(+)
|
'pitch': head_pose['pitch'], # 俯仰角:俯角(-), 仰角(+)
|
||||||
|
|
||||||
|
'temperature': imu_data.get('temperature', 25),
|
||||||
'timestamp': imu_data['timestamp']
|
'timestamp': imu_data['timestamp']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,14 +904,6 @@ class DeviceManager:
|
|||||||
# 计算总压力
|
# 计算总压力
|
||||||
total_pressure = left_total + right_total
|
total_pressure = left_total + right_total
|
||||||
|
|
||||||
# 计算各区域压力百分比
|
|
||||||
left_front_percent = (left_front / total_pressure * 100) if total_pressure > 0 else 0
|
|
||||||
left_rear_percent = (left_rear / total_pressure * 100) if total_pressure > 0 else 0
|
|
||||||
right_front_percent = (right_front / total_pressure * 100) if total_pressure > 0 else 0
|
|
||||||
right_rear_percent = (right_rear / total_pressure * 100) if total_pressure > 0 else 0
|
|
||||||
left_total_percent = (left_total / total_pressure * 100) if total_pressure > 0 else 0
|
|
||||||
right_total_percent = (right_total / total_pressure * 100) if total_pressure > 0 else 0
|
|
||||||
|
|
||||||
# 计算平衡比例(左脚压力占总压力的比例)
|
# 计算平衡比例(左脚压力占总压力的比例)
|
||||||
balance_ratio = left_total / total_pressure if total_pressure > 0 else 0.5
|
balance_ratio = left_total / total_pressure if total_pressure > 0 else 0.5
|
||||||
|
|
||||||
@ -931,15 +916,15 @@ class DeviceManager:
|
|||||||
|
|
||||||
# 构建完整的足部压力数据
|
# 构建完整的足部压力数据
|
||||||
complete_pressure_data = {
|
complete_pressure_data = {
|
||||||
# 分区压力百分比
|
# 分区压力值
|
||||||
'pressure_zones': {
|
'pressure_zones': {
|
||||||
'left_front': round(left_front_percent, 1),
|
'left_front': left_front,
|
||||||
'left_rear': round(left_rear_percent, 1),
|
'left_rear': left_rear,
|
||||||
'right_front': round(right_front_percent,1),
|
'right_front': right_front,
|
||||||
'right_rear': round(right_rear_percent, 1),
|
'right_rear': right_rear,
|
||||||
'left_total': round(left_total_percent, 1),
|
'left_total': left_total,
|
||||||
'right_total': round(right_total_percent, 1),
|
'right_total': right_total,
|
||||||
'total_pressure': 100.0 # 总压力百分比始终为100%
|
'total_pressure': total_pressure
|
||||||
},
|
},
|
||||||
# 平衡分析
|
# 平衡分析
|
||||||
'balance_analysis': {
|
'balance_analysis': {
|
||||||
|
Loading…
Reference in New Issue
Block a user