-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlN_Film_Assembly.gscript
159 lines (125 loc) · 5.4 KB
/
AlN_Film_Assembly.gscript
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
VERSION v2.2
CLEARLOG
LOADCONFIG
LOADCONFIG "" Scripts\ETLModules\assembly_positions.txt
COPY $bot_chuck_num 3
GETINTPOPUP $bot_pos_num "Which module PCB position are you using?"
COPY $AlN_chuck_num 1
COPY $AlN_pos_num 4
COPY $top_thickness {0,0,0.72}
HOME if-needed
#set vaccuums
SETVAC "etl_chuck_{$AlN_chuck_num}" 1 #for AlN piece
SETVAC etl_chuck_3 1 # vacuum for assembly plate
#Survey Module PCB
CALL @SURVEY_PART $bot_chuck_num $bot_pos_num 1 0 -> $bot_pos $bot_rot
#Survey AlN Baseplate
CALL @SURVEY_PART $AlN_chuck_num $AlN_pos_num 2 1 -> $AlN_pos $AlN_rot
#adjust bottom position to account for thickness of the ETROC-Sensor PCB SubAssembly
SUB $bot_pos $bot_pos $top_thickness #subtract bec positive down
LOADTOOL etl_picker_tool
PICKPART $AlN_pos $AlN_rot "etl_chuck_{$AlN_chuck_num}" "etl_chuck_{$AlN_chuck_num}"
PLACEPART $bot_pos $bot_rot "" etl_chuck_3
UNLOADTOOL
END
@PRINT_SURVEY_RESULTS(target_pos,target_rot,meas_pos,meas_rot,chip_num)
PRINT "CHIP %d:" $chip_num
PRINT " target: %v | %f deg" $target_pos $target_rot
PRINT " actual: %v | %f deg" $meas_pos $meas_rot
SUB $pos_err $meas_pos $target_pos
SUB $rot_err $meas_rot $target_rot
PRINT " delta: %v | %f deg" $pos_err $rot_err
RETURN
@SURVEY_CORRECTED(chuck_num,target_pos,target_rot,piece)
# Arguments:
# $chuck_num -
# $pos -
# $rot -
FLEXREAD $tr_local geometry.ETL_AlN_Baseplate.fid_tr
FLEXREAD $tl_local geometry.ETL_AlN_Baseplate.fid_tl
FLEXREAD $bl_local geometry.ETL_AlN_Baseplate.fid_bl
FLEXREAD $br_local geometry.ETL_AlN_Baseplate.fid_br
TRANSFORML2G $tr_global $tr_local $target_pos $target_rot
TRANSFORML2G $tl_global $tl_local $target_pos $target_rot
TRANSFORML2G $bl_global $bl_local $target_pos $target_rot
TRANSFORML2G $br_global $br_local $target_pos $target_rot
#this is to get corrected centers and orientation, the code above gives general area
MOVENAME "etl_chuck_{$chuck_num}"
#Routine to set up inital position of metal piece
COPY $tr 1
COPY $br 2
COPY $bl 3
COPY $tl 4
CALL @ACQUIREFIDUCIAL $tl_global $piece $tl -> $tl_corrected
CALL @ACQUIREFIDUCIAL $tr_global $piece $tr -> $tr_corrected
CALL @ACQUIREFIDUCIAL $bl_global $piece $bl -> $bl_corrected
CALL @ACQUIREFIDUCIAL $br_global $piece $br -> $br_corrected
FIT $pos $rot ETL_Sensor_PCB_Mockup $tr_corrected $br_corrected $bl_corrected $tl_corrected
QUAT2EULER $phi $_ $_ $rot
RETURN $pos $phi
@SURVEY_PART(chuck_num,pos_num,piece,is_top)
# Arguments:
# $chuck_num -
# $pos_num -
# $is_top - 1 for survey position of top, 0 for bottom
SETLIGHT 40
GOTOIF @LOAD_TOP_DATA $is_top
FLEXREAD $tr_local geometry.ETL_mock_base.fid_tr
FLEXREAD $tl_local geometry.ETL_mock_base.fid_tl
FLEXREAD $bl_local geometry.ETL_mock_base.fid_bl
FLEXREAD $br_local geometry.ETL_mock_base.fid_br
FLEXREAD $pos_default "default.ETL_mock_base.{$chuck_num}.{$pos_num}.pos"
FLEXREAD $rot_default "default.ETL_mock_base.{$chuck_num}.{$pos_num}.rot"
GOTO @END_LOAD
@LOAD_TOP_DATA
FLEXREAD $tr_local geometry.ETL_AlN_Baseplate.fid_tr
FLEXREAD $tl_local geometry.ETL_AlN_Baseplate.fid_tl
FLEXREAD $bl_local geometry.ETL_AlN_Baseplate.fid_bl
FLEXREAD $br_local geometry.ETL_AlN_Baseplate.fid_br
FLEXREAD $pos_default "default.ETL_AlN_Baseplate.{$chuck_num}.{$pos_num}.pos"
FLEXREAD $rot_default "default.ETL_AlN_Baseplate.{$chuck_num}.{$pos_num}.rot"
@END_LOAD
#converts the local coordinates to global gantry coordinates usint start location and orientation
TRANSFORML2G $tr_global $tr_local $pos_default $rot_default
TRANSFORML2G $tl_global $tl_local $pos_default $rot_default
TRANSFORML2G $bl_global $bl_local $pos_default $rot_default
TRANSFORML2G $br_global $br_local $pos_default $rot_default
#this is to get corrected centers and orientation, the code above gives general area
MOVENAME "etl_chuck_{$chuck_num}"
#Routine to set up inital position of metal piece
COPY $tr 1
COPY $br 2
COPY $bl 3
COPY $tl 4
CALL @ACQUIREFIDUCIAL $tl_global $piece $tl -> $tl_corrected
CALL @ACQUIREFIDUCIAL $tr_global $piece $tr -> $tr_corrected
CALL @ACQUIREFIDUCIAL $bl_global $piece $bl -> $bl_corrected
CALL @ACQUIREFIDUCIAL $br_global $piece $br -> $br_corrected
# Turns measured corners or fiducials into center and orientation
GOTOIFN @FIT_TOP $is_top
FIT $pos $rot ETL_AlN_Baseplate $tr_corrected $br_corrected $bl_corrected $tl_corrected
GOTO @FINISH_SURVEY
@FIT_TOP
FIT $pos $rot ETL_mock_base $tr_corrected $br_corrected $bl_corrected $tl_corrected
@FINISH_SURVEY
QUAT2EULER $phi $_ $_ $rot
RETURN $pos $phi
@ACQUIREFIDUCIAL(start_pos,piece,loc)
# Arguments:
# $start_pos - Position to initially search for the fiducial
# $piece - PCB or ETROC, 1 or 2 respectively
# $loc - tr == 1, br == 2, bl == 3, tl == 4
MOVETO $start_pos 50
WAIT 100
GOTO @manual_fiducial_acquisition
SETERRORMODE setvar
FINDFID $fid_position ETL_PCB_Mockup
GOTOIF @manual_fiducial_acquisition $ERR
SETERRORMODE default
RETURN $fid_position
@manual_fiducial_acquisition
SETERRORMODE default
FLEXWRITE reference_image.img "C:\Users\User\Desktop\gantry-config-nebraska\Scripts\ETLModules\ref_imgs\ref_image_{$piece}_{$loc}.png"
VIDEO "" img
getpos $fid_position
RETURN $fid_position