# WPS.txt, an Acquisifier script for the WPS1 Instrument. # Copyright (C) 2008 Kevan Hashemi, Brandeis University # # This Acquisifier script takes images from two BCAMs that face one another # and can view one another's sources. It calculates the distance between # the two BCAMS based upon the source calibration lines included as data # in the post-processing of the final step. The script defines the distance # between the two BCAMs is the separation of the cone balls upon which they # mount. # # For more information about the Acquisifier that runs this script, see # http://alignment.hep.brandeis.edu/Electronics/LWDAQ/Acquisifier.html # # Kevan Hashemi 06-NOV-08, Brandeis University # acquisifier: name: Initialize post_processing: { set config(run_result) "[clock seconds] " } config: end. default: name: Configure_BCAM instrument: BCAM default_post_processing: { if {![LWDAQ_is_error_result $result]} { foreach i {1 2 7 8} {append config(run_result) "[lindex $result $i] "} } { append config(run_result) " -1 -1 -1 -1" } } config: daq_adjust_flash 1 daq_ip_addr 129.64.37.79 end. acquire: name: Camera_1 instrument: BCAM result: None time: 0 config: daq_driver_socket 5 daq_source_driver_socket 8 daq_source_device_element "3 4" end. acquire: name: Camera_2 instrument: BCAM result: None time: 0 config: daq_driver_socket 8 daq_source_driver_socket 5 daq_source_device_element "3 4" end. acquisifier: name: Calculate post_processing: { # # We have the following calibration constants for the two cameras. In our demonstration # stand, the BCAM that contains Camera_1 and Sources_1 is a blue azimuthal BCAM with # serial number 20MABNDB000304. The second BCAM is a black azimuthal BCAM with serial # number 20MABNDA000088. We looked up their most recent calibration constants in the # BCAM calibration database: # # http://alignment.hep.brandeis.edu/Devices/Calibration/BCAM_Parameters.txt # # For an explanation of the source and camera calibration constants, see the BCAM # User Manual. # # http://alignment.hep.brandeis.edu/Devices/BCAM/User_Manual.html # set camera_1 \ "20MABNDB000304 20080729115535 -12.562 -13.233 3.236 -2.487 -0.276 1 74.959 -27.201" set sources_1 \ "20MABNDB000304 20080729115810 -20.684 -13.164 -4.647 -13.082 0.360" set camera_2 \ "20MABNDA000088 20031209132937 -12.681 13.074 2.080 0.132 -0.331 1 75.160 3123.789" set sources_2 \ "20MABNDA000088 20031212110244 -20.657 13.087 -4.638 13.106 0.360" # # Each BCAM measures the range of the other BCAM's pair of lasers. To measure the # range, we need to know the separation of the lasers, the separation of their image # spots, and the distance from the camera pivot point to ccd distance. Let us # start with the distance between the images. Our config(run_result) string already # contains the x and y positions of the four laser spots we obtained from two images. # scan $config(run_result) %d%f%f%f%f%f%f%f%f t x11 y11 x12 y12 x21 y21 x22 y22 set ss1 [expr sqrt(($x11 - $x12)*($x11 - $x12)+($y11-$y12)*($y11-$y12))] set ss2 [expr sqrt(($x21 - $x22)*($x21 - $x22)+($y21-$y22)*($y21-$y22))] LWDAQ_print $info(text) "$ss1 $ss2" green # # Now we have the separation in microns of the image spots in ss1 and ss2. We must # extract the laser separations from the calibration constants. The source calibration # constants give the x and y positions of the sources in millimeters. While we are # calculating the laser separation, we also extract the z-position of the lasers, # which is how far forward they are from the cone ball upon which the BCAM mounts. # scan $sources_1 %s%u%f%f%f%f%f id date x11 y11 x12 y12 zl1 set ls1 [expr sqrt(($x11 - $x12)*($x11 - $x12)+($y11-$y12)*($y11-$y12))] scan $sources_2 %s%u%f%f%f%f%f id date x21 y21 x22 y22 zl2 set ls2 [expr sqrt(($x21 - $x22)*($x21 - $x22)+($y21-$y22)*($y21-$y22))] LWDAQ_print $info(text) "$ls1 $ls2" green # # We need the pivot-ccd distance for each camera and the z-coordinate of the pivot # point with respect to the cone ball. # set pc1 [lindex $camera_1 8] set zp1 [lindex $camera_1 4] set pc2 [lindex $camera_2 8] set zp2 [lindex $camera_2 4] # # The distance from the pivot point of camera_1 to the lasers on camera 2 is equal # to the ratio of the laser separation to the spot separation multiplied by the # camera_1 pivot-ccd distance. We convert the microns of spot separation into millimeters # to get the range in millimeters. # set range_1 [expr $pc1 * $ls1 * 1000 / $ss1] set range_2 [expr $pc2 * $ls2 * 1000 / $ss2] # # To obtain the distance between the cone balls upon which the cameras mount, we # must subtract from the first range the z-coordinate of the camara_1 pivot point # and the z-coordinate of the sources_2 lasers. Note that the z-axis for the first # BCAM faces the opposite direction from the z-axis of the second BCAM. # set range_1 [expr $range_1 - $zp1 - $zl2] set range_2 [expr $range_2 - $zp2 - $zl1] # # Now we print the two range measurements to the Acquisifier panel. The absolute # accuracy of these range measurements is limited by the absolute accuracy of # the pivot point z-position as measured by the BCAM calibration. The z-position # is accurate to 1 mm rms. We find that precision and linearity at range 1 m is better # than 100 um. At range 10 m, the precision is a hundred times worse, at 10 mm. # LWDAQ_print $info(text) "Range calculated with Camera_1: [format %.3f $range_1]" LWDAQ_print $info(text) "Range calculated with Camera_2: [format %.3f $range_2]" } config: end.