Using a bar code scanner to calibrate positioning of a robotic system
TECHNICAL FIELD OF THE INVENTION 
     The present invention relates to automated storage and retrieval systems, and in particular, to using a bar code scanner mounted on a robotic accessor to teach the accessor the location of various elements in a storage and retrieval system. 
     BACKGROUND OF THE INVENTION 
     An automated storage and retrieval system includes one or more banks of storage cells, used for retaining a stored item, one or more mechanical accessors, used to transport an item to and from a storage cell, and a controller. In an information library, for example, the stored items are recording media (such as magnetic tape cartridges or cassettes or optical cartridges or magazines holding one or more optical disks, collectively referred to herein as &#34;cartridges&#34;) and the accessor transports the cartridge between the storage cells and one or more data drives in the library for reading information from or writing information to the media. 
     It will be appreciated that the position of the accessor should be carefully and accurately controlled by the controller in order for the accessor to retrieve the correct item and deliver it to the correct destination. Specifically referring to an information library, it is necessary for the accessor to &#34;know&#34; where each cell and data drive is. If the components of the library, including storage frames and transport rails, were constructed and assembled with absolute precision, it would be possible for the exact locations of the storage cells and data drives to be known and used by the library controller in directing the accessor to a desired position. However, such precision is not possible and, consequently, the accessor should be calibrated for any offset between the expected or nominal location of an element and its actual location. 
     In some libraries, the accessor should also have the capability to identify a cartridge before retrieving it. Conventionally, it is common to affix an identifying bar code (or other machine readable) label on each cartridge and employ a bar code reader or a vision system (such as a video camera and processor) to &#34;read&#34; the label. In those libraries employing a vision system to read labels, the camera can also be used to calibrate the position of the accessor. In those libraries employing a bar code scanner to read labels, however, a separate, single point sensor system has generally been used for positional calibration, if such calibration is performed at all. While both devices may result in an adequate calibration, a vision system is expensive and decoding a large array of pixels is time consuming and processor intensive; employing a separate sensor is inefficient and may also be slow. 
     OBJECTS AND SUMMARY OF THE INVENTION 
     In view of the foregoing, it is an object of the present invention to use a bar code scanner both for reading cartridge labels and for positional calibration of an accessor in an automated storage and retrieval system. 
     It is a further object to calibrate the accessor both for lateral positional deviations in the locations of components in the system and for angular deviations of the scanning beam. 
     These and other objects are achieved in this invention by moving a bar code scanner, mounted on an accessor in the storage and retrieval system, proximate the nominal or expected location of a target fiducial. The bar code scanner is activated to sweep a light beam in a y-plane toward the expected location of the fiducial and, if the fiducial is detected, a message is transmitted from the bar code scanner to a controller indicating the times the x-coordinates of the beginning and end of the fiducial were detected during a sweep. The average of the two times represents the time, relative to the beginning of the sweep, when the light beam from the bar code scanner crossed the x-coordinate of the center of the fiducial. Based upon the known x-coordinate of the accessor relative to a reference position, the actual x-coordinate of the center of the fiducial can then be determined. 
     To determine the y-coordinate of the center of the fiducial, the accessor is moved incrementally in the y-direction after each sweep and the y-coordinates of the top and bottom of the fiducial are averaged. 
     Angular offsets in the bar code scanner are also preferably determined by performing a bench-type calibration. The bar code scanner is secured to a calibration fixture and aimed at a fiducial with known coordinates. Nominally, the fiducial should be in the center of the beam sweep; however, due to parts and assembly tolerances in the bar code scanner, the angle of the beam can be offset from center. After the offset is determined, it is used during the determination of the centers of each fiducial to improve retrieval accuracy. 
     The x- and y-coordinates of the actual center of each fiducial in the storage and retrieval system are stored in a table and later used to direct the accessor to a retrieve a desired item. 
     The foregoing and other features and advantages of the invention will be apparent from the following more particular description of preferred embodiments of the invention, as illustrated in the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIGS. 1A and 1B are views of an automated storage and retrieval library employing the calibration system of the present invention; 
     FIG. 2 is an illustration of a gripper and scanner in proximity to a bank of storage cells; 
     FIG. 3 is a front view of an exemplary fiducial employed in the present invention; 
     FIGS. 4, 5 and 6 are schematic top views of the scanner and fiducial showing, respectively, perfect alignment, an angular beam deviation and a lateral positional deviation; and 
     FIG. 7 is a front view of a portion of the fiducial showing exemplary scanner beam paths. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     FIGS. 1A and 1B are views of an automated information storage and retrieval library 10 employing the calibration system of the present invention. The library 10 includes one or more drives 12, a plurality of cartridges 14 stored in a bank of cells 16, an accessor 18 for transporting a selected cartridge 14 between a storage cell 16 and a drive 12. The accessor 18 includes a cartridge gripper 20 and a bar code scanner 22 mounted on the gripper 20. The drives 12 can be optical disk drives or magnetic tape drives and the cartridges can contain optical or magnetic media, respectively. The library 10 also includes a library controller 24 interconnected with, and controls the actions of, the drives 12 and the accessor 18. The controller 24, which includes at least one computing processor, is further interconnected with a host processor (not shown) from which it receives access commands; information to be recorded on, or to be read from, selected cartridges 14 is transmitted between the drives 12 and the host 26 through the library controller 24 or directly between the drives 12 and the host. A preferred scanner 22 is the Model 20 IBM sold by Acc-Sort System, Inc. which can be modified to output a message to the library controller 24 used by the present invention. 
     FIG. 2 is an illustration of the gripper 20 and scanner 22 in front of the bank of storage cells 16. The library 10 may have many such banks of cells and each bank may have any number of cells. A bank may be arranged in any of various configurations, including the 4×20 array illustrated. When a library is assembled, each bank of cells may not be perfectly aligned with each other bank in one or more of the three coordinates, x, y and z, and, further, may also not be parallel with the axes of the motion of the accessor 18 through the library 10. Consequently, positional offsets of each bank should be determined. The arrangement of the cells 16 shown in FIG. 2 is for illustrative purposes only and it is not necessary for the present invention that a bank of cells have a particular configuration, or even that the cells be grouped into defined banks. Each of the cartridges 14 has a unique identifying bar code label, such as the label 142 affixed to the front of a cartridge 144, capable of being read by the scanner 22. Also shown in FIG. 2, and in more detail in FIG. 3, is an exemplary visual target or fiducial 30 affixed to the bank of cells 16. Multiple fiducials can be located on each bank of cells 16 to provide tilt and spacing information, if desired. Similar single or multiple fiducials can be affixed to or near each other bank of cells and to or near each other component in the library 10 to which the accessor 18 will travel, such as the drives 12 and a cartridge input/output station. 
     The fiducial 30 is rectangular and includes three rectangular light areas or marks 302, 304, 306 on a dark background 308. By way of example only, the light areas 302, 304 and 306 can be 5 mm on each side and separated from each other by 5 mm. It will be appreciated that a fiducial with a single mark against a contrasting background can also be used although, the multiple-mark fiducial 10 is preferred for its distinctiveness relative to any other object in the library 10. The fiducial 30 has left and right sides at x 1  and x 2 , respectively, top and bottom edges at y 1  and Y 2  respectively, and center coordinates of x c  y c  relative to a reference position in the library of x o  y o  (not shown). 
     A top schematic view of the bar code scanner 22 and fiducial 30 is shown in FIG. 4. Using a multi-sided, rotating, internal mirror, the scanner 22 sweeps a beam of light toward the fiducial 30 (in the z-direction of the y-plane) across an angle from Θ 0  at an initial time t 0  to Θ 3  at a time t 3  (the angles being measured from a reference angle Θ 1 ). A typical scanner 22 may sweep over a maximum of about Θ 3  -Θ 0  =45° in about t 3  =2 microseconds. (For clarity, the angle of the beam sweep has been exaggerated in the FIGS.) The scanner 22 includes a timing device to measure when during a sweep the left and right sides of the fiducial (at x 1  and x 2 ) are detected; the time at which the light crosses the center of the fiducial can then be determined and the actual coordinates of the center x c  y c  calculated and stored. 
     Just as there are some physical variations between libraries, so too are there variations between scanners 22, particularly in the precision with which the center of the beam sweep is established. Thus, as illustrated in FIG. 5, while the overall sweep angle β 0  to β 3  may be substantially constant (that is, equal to Θ 0  to Θ 3 ), the sweep itself may be offset by an unknown angular amount. And, even if there is no sweep offset, the positioning of the scanner 22 in front of a cell, drive or fiducial may be offset in the x-or y-directions, as illustrated in FIG. 6. Consequently, in order to obtain the most accurate positioning of the accessor 18, the foregoing offsets should be measured and the accessor 18 taught accordingly. Then, when the accessor 18 is directed by the controller 24 to retrieve a cartridge from a cell 14 in the bank 16, the offsets are factored into the positional commands transmitted to the accessor 18. 
     Referring again to FIGS. 4 and 5, an initial calibration procedure for the scanner 22 will be described. The scanner calibration can be performed at the factory after a scanner is manufactured or can be performed at a customer site when the scanner is installed; the procedure may also be performed during the life of the scanner if deemed necessary to counter any effects of vibration, aging or other factors. The scanner 22 is placed in a calibration fixture at a position A xc ,yc,z0 a known distance (z 1 ) from the center of the fiducial 30 on the calibration fixture (at F xc ,yc,z1) with the scanner 22 aimed directly toward the center of the fiducial 30. It has been found that a distance of about z 1  =17.78 cm provides satisfactory results. Under the direction of a scanner controller (or the library controller 24 if the calibration is performed in the library 10), the scanner 22 is then activated and its beam sweeps from Θ 0  at an initial time t 0  to Θ 3  at a time t 3 . During the sweep, the scanner 22 detects the leading edge (or left side) of the fiducial 30 at a time t 1  and detects the trailing edge (or right side) of the fiducial 30 at time t 2 , all times being measured from the sweep start time t 0 . The scanner then sends a message to the controller having the following information: the time t 1  in microseconds (ms) from the beginning of the scan t 0  to the leading edge of the fiducial; and the time t 2  in ms from the beginning of the scan t 0  to the trailing edge of the fiducial. Additional message elements, such as start-of-message and end-of-message and checksums, can be included for data integrity. 
     It will be apparent that, if the scanner 22 has been perfectly assembled (FIG. 4), the center of the fiducial will occur at the center of the scan such that: 
     
         t.sub.c =t.sub.3 /2.                                       (Eq. 1) 
    
     However, such precision is difficult, if not impossible, to achieve and would significantly raise the cost of the scanner 22. Therefore, the beam may have an angular deviation (FIG. 5) equal to the difference between Θ 0  and β 0 . The angular deviation is taken into account if the time the beam crosses the center x c  of the fiducial 30 is calculated as: 
     
         t.sub.c &#39;=(t.sub.2 &#39;+t.sub.1 &#39;)/2                          (Eq. 2) 
    
     To improve accuracy, the foregoing measurement and calculation can be performed many times and the results averaged. The average is stored in an EEPROM in the scanner 22 and applied to calculations during the following calibration procedure. 
     After the angular offset of the scanner 22 has been determined and stored and the scanner 22 installed in the library 10, a positional x,y measurement is performed by &#34;teaching&#34; the accessor 18 the location of each fiducial in the library 10. Referring to FIG. 6, the fiducial 30 will again be used to represent any fiducial in the library 10. The center of the fiducial 30 has actual coordinates x&#34; c  Y&#34; c  z&#34; c  (with reference to a known location in the library 10). The accessor 18 is directed by the library controller 24 to move to a location A xi ,yi,zi above an expected or nominal position of the fiducial 30. A first scan S 0  is performed and if, as desired, the fiducial 30 is not detected, the scanner 22 is moved incrementally downward (in the y-direction) and another scan S 1  performed. (If the fiducial 30 is detected during the first scan, the scanner 22 is moved upward and the scan repeated.) The scan/move/scan steps are repeated (FIG. 7) until the scanner 22 detects the top of the fiducial 30, at scan S j  and transmits a detection message. The scan/transmit/move/scan steps are repeated until the bottom fiducial 30 is no longer detected, after scan S k , representing the bottom of the fiducial 30. The direction of the accessor 18 is reversed and scan/transmit/move/scan steps are repeated in the upward direction until the scanner 22 detects the bottom of the fiducial 30, at scan S k . A speed for the downward motion of the accessor 18 at which measurements have been found to be sufficiently accurate is about 6.35 centimeters per second. 
     The time at which the light beam crosses the actual center x&#34; c  of the fiducial 30 in the x-direction during each scan is calculated in accordance with Eq. 2 and the results of the calculations from the separate scans are averaged. The angular offset stored in the EEPROM of the scanner 22 is subtracted from the calculated average value to obtain a lateral (horizontal) offset t (in milliseconds) and this result is converted from time into a distance x (in millimeters) as follows: 
     
         x=z.sub.1 *tan(Θ)                                    (Eq. 3) 
    
     where z 1  is the expected distance between the scanner 22 and the fiducial 30 and Θ=t*(Θ 3  -Θ 0 )/(t 3  -t 0 ) as shown in FIG. 4. 
     After the conversion, the actual x-coordinate x&#34; c  of the center of the fiducial 30 is determined to be the x-position of the accessor 18 A xi  plus the horizontal offset. The y-coordinate Y&#34; c  of the actual center of the fiducial 30 is determined by calculating the average y-position of the accessor 18 between the top and bottom edges of the fiducial 30; that is, y&#34; c  =(y&#34; 2  +y&#34; 1 )/2. 
     Preferably, one other determination should be made. If the horizontal offset of the scanner 22 from the center of the fiducial 30 is too large (that is, if the scanner 22 is too far to one side of the fiducial 30), a parallax error associated with the measured times will be undesirably large and the resulting calculations may not be sufficiently accurate. Consequently, the horizontal offset x is compared with a threshold value x th  which is computed as follows: The above calculations have been based upon the assumption that the distance from the scanner 22 to the fiducial 30 is a predetermined known distance z 1  (such as 7 inches). However, the actual distance z act  may vary by some error ε z  such that z act  =z 1+ ε z . The error in the z-direction will cause an error ε x  in the calculated lateral offset; the actual lateral offset is x act  =x+ε x . The relationship between the two errors is tan(Θ)=ε x  /ε z . Based upon the design tolerances of the library 10, the drives 12, the storage cells 16, the accessor 18, the gripper 20 and other related hardware, the maximum errors ε x-max  and ε z-max  can be estimated and their relationship is tan(Θ max )=ε x-max  /ε z-max . The threshold value will, therefore, be: 
     
         x.sub.th =z.sub.1 *tan(Θ.sub.max)=z.sub.1 *(ε.sub.x-max /ε.sub.z-max)                                     (Eq. 4) 
    
     It has been found that a maximum acceptable error value ε x-max  is about 0.1 mm and the corresponding expected maximum error value ε z-max  is 25 mm. Therefore, the threshold value x th  is 0.7 mm when z 1  is the preferred 17.78 cm. 
     If the calculated, tentative offset x is greater than the threshold value x th , the accessor 18 is moved in the x-direction closer to the fiducial 30. To reduce overshoot, which would occur if the accessor 18 was moved too far in the x-direction, the accessor 18 is moved a distance equal to about 90% of the calculated tentative offset x. The scanning process is then repeated at the new location until the horizontal offset x is within the allowed tolerance x th . 
     The calculated x&#34; c  y&#34; c  position of the actual center of the fiducial 30 is stored in a table in the library controller 24 and the center of each other fiducial in the library 10 is similarly calculated and stored. From the stored position of each fiducial and the known location of each cell within the bank of cells 16 relative to the fiducial 30, the position of each cell in the library 10 relative to the reference point x 0  y 0  can be determined for the accessor 18 to be moved with sufficient accuracy for proper cartridge storage and retrieval despite imperfect assembly of the library 10. The position of each data drive 12 in the library 10 can be similarly determined. 
     While the invention has been particularly shown and described with reference to preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.