File size: 1,126 Bytes
97a245c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from microprograms.errors.splash_micro_program import get_splash_from_one_frame
from microprograms.errors.angles_micro_programs import applyPositionTightnessError
import numpy as np

def entry_microprogram_one_frame(filepath, above_board, on_board, pose_pred, expected_twists, petal_count, expected_som, half_som_count, frame=None, splash_detector=None,  visualize=False, dive_folder_num=None):
    if above_board:
        return 0
    if on_board:
        return 0
    splash = get_splash_from_one_frame(filepath, im=frame, predictor=splash_detector, visualize=visualize, dive_folder_num=dive_folder_num)
    if splash:
        return 1
    # if completed with somersaults, we know we're in entry phase
    if not expected_som > half_som_count:
        return 1
    if expected_twists > petal_count or expected_som > half_som_count:
        return 0
    return 1
    
    # if pose_pred is None:
    #     return 1
    # else:
    #     angle = applyPositionTightnessError(filepath, pose_pred)
    #     if angle > 90:
    #         return 1
    # if splash is not None:
    #     return 1
    # else:
    #     return 0