# coding: gb2312 import traceback from DeviceDefine.consensus import * from LogRecord.log_recorder import GLOBAL_LOG from PureBackend.base_driver import MODEL_MEDIAPIPE from PureBackend.exam_driver import ExamDriver from PureBackend.general import * class OverhangBackend(ExamDriver): def __init__(self, master_mode=True, positioning=True, camera=True, model=MODEL_MEDIAPIPE, speaker=True, multi_positioning_mode=True, device_type=UNKNOWN, pure_mode=False): super().__init__(master_mode, positioning, camera, model, speaker, multi_positioning_mode, device_type, pure_mode) if model == MODEL_MEDIAPIPE: from Exercise3.overhang import Overhang else: from Exercise_mn.overhang import Overhang self.overhang = Overhang # 准备进行曲臂悬垂 def active_overhang(self, person_id, band_id): if self.project: self.project.kill() if person_id: info = self.manager.select_a_person(person_id)[0] else: if band_id: raw_info = self.manager.select_a_person_from_band(band_id) if not raw_info: GLOBAL_LOG.write(f"准备进行曲臂悬垂发生错误: 该手环没有匹配的人员", need_print=True) return False info = raw_info[0] else: GLOBAL_LOG.write(f"准备进行曲臂悬垂发生错误: 参数缺失", need_print=True) return False try: self.project = self.overhang(info, camera=self.camera) self.exercise_tag = OVERHANG return True except Exception as e: GLOBAL_LOG.write(f"准备进行曲臂悬垂发生错误,{str(e)},错误来源:{traceback.format_exc()}") return False