55from dodal .devices .oav .oav_detector import OAV
66from dodal .devices .oav .oav_parameters import OAVParameters
77from dodal .devices .oav .pin_image_recognition import PinTipDetection
8+ from dodal .devices .oav .pin_image_recognition .utils import ScanDirections
9+ from dodal .plans .device_setup_plans .setup_pin_tip_params import (
10+ setup_pin_tip_detection_params ,
11+ )
812
913from mx_bluesky .common .parameters .constants import (
1014 PlanGroupCheckpointConstants ,
1115)
1216
1317
14- def setup_pin_tip_detection_params (
15- pin_tip_detect_device : PinTipDetection ,
16- parameters : OAVParameters ,
17- ):
18- set_using_group = partial (
19- bps .abs_set , group = PlanGroupCheckpointConstants .READY_FOR_OAV
20- )
21- # select which blur to apply to image
22- yield from set_using_group (
23- pin_tip_detect_device .preprocess_operation , parameters .preprocess
24- )
25-
26- # sets length scale for blurring
27- yield from set_using_group (
28- pin_tip_detect_device .preprocess_ksize , parameters .preprocess_K_size
29- )
30-
31- # sets iteration for blur
32- yield from set_using_group (
33- pin_tip_detect_device .preprocess_iterations , parameters .preprocess_iter
34- )
35-
36- # Canny edge detect - lower
37- yield from set_using_group (
38- pin_tip_detect_device .canny_lower_threshold ,
39- parameters .canny_edge_lower_threshold ,
40- )
41-
42- # Canny edge detect - upper
43- yield from set_using_group (
44- pin_tip_detect_device .canny_upper_threshold ,
45- parameters .canny_edge_upper_threshold ,
46- )
47-
48- # "Open" morphological operation
49- yield from set_using_group (pin_tip_detect_device .open_ksize , parameters .open_ksize )
50-
51- # "Close" morphological operation
52- yield from set_using_group (
53- pin_tip_detect_device .close_ksize , parameters .close_ksize
54- )
55-
56- # Sample detection direction
57- yield from set_using_group (
58- pin_tip_detect_device .scan_direction , parameters .direction
59- )
60-
61- # Minimum height
62- yield from set_using_group (
63- pin_tip_detect_device .min_tip_height ,
64- parameters .minimum_height ,
65- )
66-
67-
6818def setup_general_oav_params (oav : OAV , parameters : OAVParameters ):
6919 set_using_group = partial (
7020 bps .abs_set , group = PlanGroupCheckpointConstants .READY_FOR_OAV
@@ -91,5 +41,11 @@ def pre_centring_setup_oav(
9141 Setup OAV PVs with required values.
9242 """
9343 yield from setup_general_oav_params (oav , parameters )
94- yield from setup_pin_tip_detection_params (pin_tip_detection_device , parameters )
44+ yield from setup_pin_tip_detection_params (
45+ pin_tip_detection_device ,
46+ parameters ,
47+ ScanDirections .FORWARD ,
48+ group = PlanGroupCheckpointConstants .READY_FOR_OAV ,
49+ wait = False ,
50+ )
9551 yield from bps .wait (PlanGroupCheckpointConstants .READY_FOR_OAV )
0 commit comments