This commit is contained in:
yrx
2026-05-29 16:24:04 +08:00
parent 575e690868
commit 64722f4d73
17 changed files with 1647 additions and 77 deletions

View File

@@ -8,7 +8,7 @@ from laser_manager import laser_manager
from logger_manager import logger_manager
from network import network_manager
from triangle_target import load_camera_from_xml, load_triangle_positions, try_triangle_scoring
from vision import estimate_distance, detect_circle_v3, enqueue_save_shot
from vision import estimate_distance, detect_circle_v3, enqueue_save_shot, enqueue_save_raw_shot
from maix import image, time
# 缓存相机标定与三角形位置,避免每次射箭重复读磁盘
@@ -353,6 +353,16 @@ def process_shot(adc_val):
network_manager.safe_enqueue({"shoot_event": "start"}, msg_type=2, high=True)
frame = camera_manager.read_frame()
from shot_id_generator import shot_id_generator
shot_id = shot_id_generator.generate_id()
if getattr(config, "SAVE_RAW_SHOT_IMAGE_ENABLED", False):
enqueue_save_raw_shot(
frame,
shot_id=shot_id,
photo_dir=config.PHOTO_DIR if config.SAVE_IMAGE_ENABLED else None,
)
# 调用算法分析
analysis_result = analyze_shot(frame)
@@ -497,10 +507,6 @@ def process_shot(adc_val):
if dx is None and dy is None and logger:
logger.warning("[MAIN] 未检测到偏移量(三角形与圆形均失败),但会保存图像")
# 生成射箭ID
from shot_id_generator import shot_id_generator
shot_id = shot_id_generator.generate_id()
if logger:
logger.info(f"[MAIN] 射箭ID: {shot_id}")