| from microprograms.errors.angles_micro_programs import applyPositionTightnessError | |
| from models.pose_estimator.pose_estimator_model_setup import get_pose_estimation | |
| from microprograms.errors.distance_from_springboard_micro_program import board_end | |
| from microprograms.errors.distance_from_springboard_micro_program import find_which_side_board_on | |
| from models.detectron2.platform_detector_setup import get_platform_detector | |
| import cv2 | |
| import numpy as np | |
| def twist_microprogram_one_frame(filepath, on_board, expected_twists, petal_count, expected_som, half_som_count, pose_pred=None, diver_detector=None, pose_model=None): | |
| if on_board: | |
| return 0 | |
| if expected_twists <= petal_count or expected_som <= half_som_count: | |
| return 0 | |
| angle = applyPositionTightnessError(filepath, pose_pred=pose_pred, diver_detector=diver_detector, pose_model=pose_model) | |
| if angle is None: | |
| return 0 | |
| if angle > 80: | |
| return 1 | |
| else: | |
| return 0 |