METHOD OF DETECTING POSITION IN A LASER SENSOR AND DEVICE THEREFOR

Abstract: A position detection method featuring improved detection precision for a laser sensor that uses CCD as a light-receiving element in the laser sensor, and a device therefor. The sum of products of cell outputs (Ci) and cell positions (Xi) of light-receiving elements (14) is found (42), and the cell outputs are added up (46). A counter (45) is reset when the cell output becomes greater than a preset threshold value, and sample-holding signals (SH) are counted when it becomes smaller than the preset threshold value. The sum of products is divided by an added value through a division circuit (47), and the barycentric position the sum of products is found as a light-receiving position and is stored in the latch buffer. When two or more light-receiving positions are found, the controller finds a position by the primary light of reflection and finds the position of the object. The position is not detected by the CCD cell unit, but the light-receiving position among the CCDs is detected, contributing to improving precision of position detection.

Description: The present invention relates to a laser sensor to be equipped, for example, in a robot performing arc welding, sealing and the like, more particularly (but not necessarily exclusively) to a position detecting method and a corresponding apparatus for detecting an object position in an operation of welding, sealing and the like by use of such sensor. Conventionally, an arc welding robot, a sealing robot and the like are equipped with a laser sensor for detecting a welding position or a sealing position etc. This laser sensor is constituted as shown in Fig. 1. In Fig. 1, a detecting unit 10 includes a laser oscillator 11, a swing mirror (i.e. galvanometer) 12 that causes a laser beam emitted from the laser oscillator 11 to scan, and an optical system 13 that converges a reflection beam reflected back on an objective so as to form an image on a light receiving element 14. A control unit 20 includes a laser actuating unit 21 for actuating the laser oscillator 11 to generate a laser beam, a mirror scanning unit 22 that causes the swing mirror 12 to pivot about its axis, and a signal detecting unit 23 for detecting a position of a received beam according to the position detected by the light receiving element 14. The laser oscillator 11 is actuated by the laser actuating unit 21 to emit a laser beam. The mirror scanning unit 22 cooperates with the laser actuating unit 21 to cause the swing mirror 12 to perform a scanning so that the laser beam emitted from the laser oscillator 11 is directed toward a predetermined point on the object 30. The laser beam reflected back on the object 30 is converged by means of the optical system 13 to form an image on the light receiving element 14 in accordance with the reflected position on the object 30. This light receiving element is normally constituted of a PSD (Position Sensitive Detector) of non-split & integration type element, or a CCD (Charged Coupled Device) of split type element. In the case where a PSD is used as a light receiving element, a beam received on a light receiving surface as shown in Fig. 2, i.e., an image of a reflected beam, is converted into a photoelectric current, and then outputted from electrodes on both sides of the element. A light receiving position x a is determined based on the values of two electric currents outputted from the electrodes on both sides of the light receiving element. To be more specific, given that a distance from the center of the light receiving element to respective electrode is L; a distance from the center of the light receiving element to the light receiving position is x a ; and further the two electric current values are I 1 and I 2 , the distance x a can be obtained by the following equation 1. x a = L·(I 2 - I 1 ) / (I 2 + I 1 ) On the basis of thus obtained position x a on the light receiving element, a position of the object 30 with respect to the sensor is calculated as will be described later. In the case where a CCD is used as the light receiving element, a beam received on a light receiving surface, i.e., an image of a reflected beam, is converted into a photoelectron and then stored into its cell. Electric charges stored in respective cells are outputted one after another from an outermost end at predetermined intervals. In the case of a CCD, the larger the quantity of the light received by a cell, the larger the amount of the electric charge stored by the cell. Accordingly, a position that has received the largest quantity of light reflected can be identified by detecting the position of the cell that gives the largest output. Thus, on the basis of such a position, the position of the object 30 with respect to the sensor can be calculated. Fig. 3 is a view illustrating a method for determining a coordinate position (X, Y) of the object 30 with respect to the sensor on the basis of the position x a detected by the light receiving element 14. In this method, assuming that a sensor origin (0, 0) is located on a straight line passing the center of the optical system 13 and the center of the light receiving element 14; this straight line is hereinafter referred to as Y-axis, whereas a straight line perpendicular to the Y-axis is referred to as X-axis; further, a distance between the origin of the sensor and the center of the optical system 13 is defined as L 1 ; a distance between the center of the optical system and the center of the light receiving element 14 is defined as L 2 ; an X-axis distance between the origin of the sensor and the pivot center of swing mirror 14 is defined as D; a Y-axis distance between the sensor origin and the pivot center of swing mirror is defined as L 0 ; a reflection angle of laser beam that is reflected at the swing mirror 12 toward the object 30 is defined as  with respect to the Y-axis; and then a distance of light receiving position on the light receiving element 14 is defined as x a , the coordinate position (X, Y) at which the laser beam is received and reflected can be determined by calculating the following equations. X = x a · [(L 1 - L 0 ) · tan  + D] / (x a + L 2 · tan  ) Y = [L 1 · x a + L 2 · (L 0 · tan  -D)] / (x a + L 2 · tan  ) In the case where a PSD is used as a light receiving element, as the PSD is a non-split & integration type element, such a light receiving element has very high detecting resolution. However, a PSD is disadvantageous in that the entire quantity of the light received on the light receiving surface is converted into photoelectric current, and thus the light receiving surface of the PSD tends to pick up not only a reflection beam required to be detected but also a noise light occurring such as an arc light occurring in case of arc welding or a secondary reflection beam. Accordingly, such a noise light is also converted, together with the required reflection beam, into a photoelectric current, and outputted from the electrodes provided at both ends of the light receiving element. As a result, thus obtained photoelectric current adversely affects the detection of beam position in such a manner that the detected beam position, i.e., an incident position of the reflected beam, is offset from an actual position. Then, such a deviation of the detected beam position results in an overall deviation of the object position obtained through the calculation by above second and third equations, thereby deteriorating a detecting accuracy of the sensor. For example, as shown in Fig. 4, a beam B 0 having been reflected on the swing mirror 12 is then reflected back at the object 30 as a primary reflection beam B 1 to form an image on the light receiving element 14. On the other hand, part of the beam reflected at the object 30 is further reflected at another portion of the object as a secondary reflection beam B 2 to form another image on the light receiving element 14. Accordingly, the light receiving element 14 receives both the primary and secondary reflection beams. Thus, photoelectric currents outputted from both ends of the light receiving element 14 are affected by these primary and secondary reflection beams in such a manner that the output position x a is obtained as a position based on the composition of the primary reflection beam and the secondary reflection beam. Hence, the position of the object 30 calculated based on thus wrongly obtained output position x a is offset from an actual position, as indicated by 30' in Fig. 4. Whereas, in the case where a CCD is used as the light receiving element 14, as each of cells constituting the CCD can perform a photoelectrical conversion independently, it is possible to detect the noise light or the secondary reflection beam separately from the primary reflection beam. Therefore, the CCD is more advantageous compared with the above-described PSD in that it is free from the adverse effect of secondary reflection beam and the like. However, this CCD has another disadvantage. That is, each cell of the CCD has to occupy a relatively large area required for receiving significant light quantity on it. Therefore, a distance between adjacent two cells is inherently large. This may result in a deterioration in a sensor resolution. In order to improve sensor resolution, it may be possible to provide a narrow cell which is capable of receiving a satisfactory light quantity. But it is not desirable in that, if aimed to fabricate it, a production cost of element become expensive. Otherwise, in order to improve sensor resolution, it will be possible to increase the number of cells constituting the CCD. However, such an element will unnecessarily increase an overall size of element and, therefore, will not be practically used. Furthermore, as the laser beam has coherency, an output waveform of the CCD is likely to become uneven. Therefore, CCD has a problem such that the position of the cell to produce the largest output tends to change, and so it becomes impossible to correctly detect the beam receiving position. In the publication "Optics & Laser Technology", vol. 20, no 1, Feb 1988, published in the UK, pages 19-24 disclose a method of optical depth ranging employing a centre of gravity expression relevant to the present invention. EP-A-422249 and JP-A-56-138204 disclose an optical distance sensor and an optical displacement measuring equipment. An object of the present invention is to provide a position detecting method and a corresponding apparatus that uses a CCD as a light receiving element and is capable of improving its detecting resolution by executing the same integration processing as a PSD. In order to accomplish above object, a first aspect of the present invention adopts a CCD as a light receiving element in a laser sensor for detecting an object position. According to this aspect, a sum of products is obtained by successively multiplying an output value of each cell arrayed in said CCD by a position value of the cell so as to sum up thus multiplied values, and the sum total of said output values of respective cells is obtained. Then, a light receiving position is obtained by dividing said sum of products by said sum total. Furthermore there is provided a counting means capable of being reset when said output value of the CCD exceeds a predetermined threshold value, counting a number of cells to be scanned after said output value of the CCD decreases down below the threshold value until said number of cells reaches a predetermined value, and then generating an output value of CCD which has reached the predetermined value. Said sum of products is divided by said sum total in response to this output value from the counting means to obtain a light receiving position; said sum of products and said sum total are reset together; at least one light receiving position that exceeds said threshold value is detected during a predetermined interval; and a light receiving position of the primary reflection beam of a laser beam is obtained on the basis of the thus detected at least one light receiving position so as to detect the object position. Furthermore, in a preferable mode, a scanning angle of said laser beam is changed in order to successively detect at least one light receiving position at the same scanning angle. A first light receiving position that corresponds to a scanning angle immediately before a plurality of light receiving positions has become detectable at the same scanning angle is stored, and a second light receiving position that corresponds to a scanning angle immediately after a plurality of light receiving positions has become undetectable at the same scanning angle is stored too. Then, a first straight line, which is to pass two object positions respectively corresponding to the first light receiving position and another light receiving position to be scanned before said first light receiving position is scanned, and a second straight line, which is to pass two object positions respectively corresponding to the second light receiving position and another light receiving position to be scanned after said second light receiving position is scanned, are obtained to represent the position of the object. In a more preferable mode, an intersection of said two straight lines is obtained as a bent point of the object. Still further, in another preferable mode, at least one light receiving position detected by changing a scanning angle of said laser beam is successively stored. The most closest scanning angle at which a plurality of light receiving positions detected at the same scanning angle approach one another most closely is obtained. A light receiving position of smaller value is selected from -among said plurality of light receiving positions as the light receiving position of the primary reflection beam when the scanning angle is less than said most closest scanning angle, while one with a larger value is selected from among said plurality of light receiving positions as the light receiving position of the primary reflection beam when the scanning angle is larger than said most closest scanning angle. Yet further, in a development the object position is obtained from said light receiving position of the primary reflection beam. A first straight line is obtained on the basis of said object position obtained from said light receiving position of the primary reflection light beam in a scanning angle region from the minimum scanning angle to said most closest scanning angle. A second straight line is obtained on the basis of said object position obtained from said light receiving position of the primary reflection beam in a scanning angle region from said most closest scanning angle to the maximum scanning angle. And, a position of a bent point of the object is identified as an intersection point of these first and second straight lines. Moreover, according to a second aspect of the present invention, there is provided a position detecting apparatus for a laser sensor comprising: a light receiving cell consisting of a CCD that contains a plurality of cells, each to generate an output in accordance with an electric charge stored in proportion to a light quantity received on a cell surface; a timing signal generating means for generating a sample hold signal to successively scan respective cells from the beginning after a gate signal is outputted; a cell counter capable of being reset by said gate signal and counting said sample hold signals to output a value x i of cell position in the light receiving element; an adder means capable of being reset by said gate signal for successively adding said output C i of each cell in the light receiving element to be scanned in response to said sample hold signal to obtain the sum total ΣC i ; a sum of products calculating means capable of being reset by said gate signal for multiplying said output C i of each cell in the light receiving element to be scanned in response to said sample hold signal by said value x i of each cell position outputted from said cell counter and successively summing up these multiplied values so as to obtain a summation value ΣC i ·x i ; and a division means for dividing said summation value ΣC i ·x i , obtained through the sum of products calculating means, by said sum total ΣC i , obtained by the adder means, to calculate a center of gravity position ΣC i ·x i /ΣC i of received beams and outputting this center of gravity position as the light receiving position. Furthermore, there are further provided a comparator that compares the output C i of each cell with a predetermined threshold value V s and generates an output when the output C i of each cell is equal to or greater than the predetermined threshold value V s ; a counter capable of being reset in response to the output signal fed from said comparator, counting the cell number to be scanned after said output signal disappears and generating an output signal when the cell number exceeds a predetermined value to reset said adder means, sum of products calculating means and division means; a plurality of latch buffers capable of being connected in series, respectively transferring stored data to their succeeding buffers in response to the output signal fed from said counter, storing the output fed from said division means in a first step buffer thereof, and being reset by said gate signal; and a means for obtaining the light receiving position of the primary reflection beam from the data stored in said plurality of latch buffers. Still further, in a preferable mode, there are provided a means for changing a scanning angle of a laser beam in synchronization with said gate signal; a means for obtaining a first light receiving position at which only one stored data is supplied from said plurality of latch buffers in the beginning of the scanning operation of the laser beam, a second light receiving position corresponding to a scanning angle immediately before a plurality of stored data are available, a third light receiving position corresponding to a scanning angle immediately after a plurality of stored data are no longer available, and a fourth light receiving position at which only one stored data is supplied from said plurality of latch buffers in the end of the scanning operation which constitutes said means for obtaining the light receiving position of the primary reflection beam, and storage means for storing respective light receiving positions. Yet further, in this mode, there may be further provided a means for obtaining a first straight line to pass the two object positions respectively corresponding to said first and second light receiving positions and a second straight line to pass the two object positions -respectively corresponding to said third and fourth light receiving positions, whereby said first and second straight lines are used to identify the object position. Moreover, in another preferable mode, there is further provided a means for changing a scanning angle of a laser beam in synchronization with said gate signal, in this mode, and said means for obtaining the light receiving position of the primary reflection beam further includes a storage means for storing a plurality of light receiving positions supplied from said plurality of latch buffers and a detecting means for detecting the most closest scanning angle at which said plurality of light receiving positions approach most closely one another to detect the light receiving position of the smallest value from said storage means as a first light receiving position of primary reflection beam in a region from the minimum scanning angle to said most closest scanning angle, and also to detect the one with the largest value from said storage means as a second light receiving position of primary reflection beam in a region from said most closest scanning angle to the maximum scanning angle. Furthermore, in a development there are further provided a means for obtaining the object position from said first and second light receiving positions of primary reflection beam; a means for obtaining one straight line representing a first object position on primary reflection beam and the other straight line representing a second object position on the basis of said second light receiving position of primary reflection beam; and a means for obtaining an intersection of said two straight lines representing said first and second object positions as a point of a bent portion of the object. As described above, according to the present invention, an output of each cell in the CCD and a position of each cell are multiplied to obtain the sum of products. The obtained sum of products is divided by the sum total of outputs of respective cells to obtain a center of gravity position of the sum of products. This center of gravity position on the light receiving element is obtained as the light receiving position, which will not be adversely affected by a significant size of respective cells that deteriorates the detecting resolution. In other words, the light receiving position obtained by the method according to the present invention is no longer affected by the inferior detecting resolution of the CCD, thereby enabling position detection at a higher accuracy. That is, it becomes possible to realize an accurate detection of the object position by determining the object position on the basis of this light receiving position. Furthermore, every time an output of cell exceeds the predetermined threshold value until it then decreases down below the threshold value until a scanning point reaches a point apart by a predetermined distance, a center of gravity is obtained based on the above-described sum of products and summation value. Thus, a plurality of light receiving positions of the primary reflection beam or secondary reflection beam and the like can independently be detected. Moreover, in the case where a plurality of light receiving positions are detected at the same scanning angle during a scanning operation in which the scanning angle of the laser beam is changed to detect the light receiving positions, all the stored data that correspond to a plurality of light receiving positions detected at the same scanning angle, i.e., all the stored data, in which the light receiving position of the secondary reflection beam is contained together with the light receiving position of the primary reflection beam, are disregarded. Thus, the object position is rather obtained as an intersection of two loci of shifting laser beam that are calculated on the basis of stored data of only the light receiving position of the primary reflection beam. Still further, in the case where two or more light receiving positions are detected at the same scanning angle, the scanning angle of the laser beam is divided into two regions by the most closest scanning angle where two or more light receiving positions approach one another most closely at the same scanning angle. In each of the divided scanning angle regions, only the light receiving position of the primary reflection beam is chosen based on the largest or smallest value of the light receiving position among a plurality of light receiving positions in order to identify the position of the object. Fig. 1 is a schematic block diagram of a laser sensor; Fig. 2 is an illustrative view showing calculation of light receiving position when a PSD is adopted as a light receiving element; Fig. 3 is an illustrative view for obtaining the position of an object with respect to a light receiving position on the light receiving element; Fig. 4 is an illustrative view showing an interrelation between a secondary reflection beam and the object; Fig. 5 is a block diagram showing a signal detecting portion in accordance with an embodiment of the present invention; Fig. 6 is a graph showing one example of an output from the light receiving element in the embodiment of the present invention; Fig. 7 is a flow chart showing a position detecting processing in accordance with a first embodiment of the present invention that is executed on a processor of a control unit according to the same embodiment; Fig. 8 is an illustrative view showing an example of the light receiving position in accordance with the first embodiment; Fig. 9 is a flow chart showing a position detecting processing in accordance with a second embodiment of the present invention that is executed on the processor of the control unit according to the first embodiment; Fig. 10 is a flow chart showing the remainder of the position detecting processing in accordance with the second embodiment of the present invention that is executed on the processor of the control unit according to the first embodiment; Fig. 11 is an illustrative view showing one example of the light receiving position in accordance with the second embodiment; Fig. 12 is an illustrative view schematically showing arrayed light receiving position data stored in respective registers in accordance with the second embodiment; and, Fig. 13 is an illustrative view schematically showing arrayed light receiving data of primary reflection beam stored in respective registers in accordance with the second embodiment. Overall Constitution of Laser Sensor A laser sensor in accordance with the present invention has almost the same constitution as the conventional laser sensor shown in Fig. 1. This laser sensor is characterized by that a CCD is adopted as a light receiving element 14, and is different from the conventional one in that a signal detecting unit 23 has a different constitution. Fig. 5 is a block diagram of the signal detecting unit 23 in accordance with one embodiment of the present invention. In Fig. 5, a timing IC 40 outputs a sample hold signal SH and a gate signal TG in such a manner that sample hold signals SH are outputted as many as the number of the cells of light receiving element 14 during one period defined by the gate signal TG. In this embodiment, the light receiving element 14 consists of 1024 cells respectively receiving reflection beam and two groups of 28 optical black cells that are not sensitive to the reflection beam and are respectively located on both sides of the above block of 1024 cells. That is, the light receiving element 14 has 1080 cells as a whole, and 1080 pieces of sample hold signal SH are outputted within the duration of one gate signal TG. The light receiving element 14 constituted of the CCD designates respective cells successively in response to the above sample hold signals SH, and outputs a voltage corresponding to an electric charge stored in each cell in accordance with the intensity of light received by each cell. This outputted voltage is converted into a digital signal by an A/D converter 43 in synchronization with the sample hold signal SH, and its output C i is supplied to later described comparator 44, an adder circuit 46, and a sum of products calculating circuit 42. Here, a suffix i of C i varies from 1 to the total number of cells. That is, in the above example, it varies from 1 to 1080. A cell counter 41 is reset in response to the gate signal TG, and counts the number of the sample hold signals SH. A sum of products calculating circuit 42 is used to multiply the output x i of the cell counter 41 by the output C i of the A/D converter 43 in response to the sample hold signal SH, and successively add the resulting products. That is, an operation defined by the following equation is carried out. ΣC i · x i Furthermore, the sum of products calculation circuit 42 is reset by an output of a later described counter 45 and the gate signal TG. The comparator 44 compares the output C i of the A/D converter 43 and a predetermined threshold value V s in response to the sample hold signal SH, and generates an output to reset the counter 45 when the output C i exceeds the threshold value V s . The counter 45 counts the sample hold signals SH, and is reset in response to each output signal from the comparator 44. Then, the counter 45 generates an output if its counting value exceeds a predetermined value N, to reset the sum of products calculating circuit 42 and later described adder circuit 46 and division circuit 47, and stops its counting operation, whereas, if the comparator 44 generates an output again, the counter 45 is reset to resume the counting operation. The adder circuit 46 successively adds the output C i fed from the A/D converter 43 in response to the sample hold signal SH, supplies its output ΣC i to the division circuit 47, and is reset by the output of the counter 45 and the gate signal TG. The division circuit 47 divides the output ΣC i ·x i of the sum of products calculation circuit 42 by the output ΣC i of the adder circuit 46 to obtain the light receiving position of the light receiving element 14. That is, the light receiving position x a is obtained by determining a center of gravity of the received beam through the following equation. x a = (ΣC i · x i ) / ΣC i Latch buffers 48 and 49 are connected in series as many as necessary. Though usually two latch buffers connected in series are used to store the information of the primary reflection beam and the secondary reflection beam, the number of latch buffers may be increased depending on the frequency at which the noise light occurs. In response to the output of the counter 45, the latch buffer 48, which stores the position information x a previously sent from the division circuit 47 transfers this currently stored information x a to the next latch buffer 49 in order to store a newly outputted light receiving position x a supplied from the division circuit 47. Moreover, the latch buffers 48 and 49,---supply their stored light receiving positions x a to a control unit 50 in response to the gate signal TG and, in turn, are reset. The control unit 50 is constituted of a processor, memories and the like, and used to obtain the position of the object through later-described processing. Incidentally, this control unit needs not be provided exclusively and, therefore, any control unit of welding robot or sealing robot that is equipped with the laser sensor can be used as the control unit of the position detecting apparatus according to the present invention. Processing of Position Detecting Signal An operation of the signal detecting unit 23 shown in Fig. 5 will be explained hereinafter. It is now supposed, for example, that each cell x i (i = 1 to 1080) of the light receiving element 14 has stored an electric charge C i as shown in Fig. 6. In Fig. 6, an abscissa represents the cell position (i.e. cell number) x i , and an ordinate the electric charge value C i memorized in each cell. First of all, the timing IC generates the gate signal TG to reset all the elements. Subsequently, every time the sample hold signal SH is outputted, the cell counter 41 counts the sample hold signal SH and outputs its counted value. In other words, the cell counter 41 successively outputs the cell position x i starting from x 1 . On the other hand, the light receiving element 14 responds to each of the sample hold signal SH to successively output a voltage representative of the electric charge stored in the corresponding cell starting from the first cell. The voltage outputted from the light receiving element 14 is converted into the digital signal C i by the A/D converter 43. The sum of products calculation circuit 42 executes the operation defined by the fourth equation and supplies its result ΣC i ·x i to the division circuit 47. Furthermore, the adder circuit 46 adds the output C i fed from the A/D converter 43 and supplies its result ΣC i to the division circuit 47. Then, the division circuit 47 executes the operation defined by the equation (5). On the other hand, the comparator 44 compares the output C i of the A/D converter 43 with the predetermined threshold value V s . Above-described processing is carried out in respective elements every time the sample hold signal SH is generated. In the example of Fig. 6, when the output x i of the cell counter 41 becomes x k1 , and the output C i of corresponding cell exceeds the threshold value V s , the comparator 44 generates an output to reset the counter 45. Furthermore, when the output x i of the cell counter 41 becomes x k2 , and the output C i of corresponding cell decreases down below the threshold value V s , the comparator 44 stops its output, and the counter 45 initiates to count the number of sample hold signals SH. Then, it is now supposed that the counting value of the counter 45 exceeds the predetermined value N when the output x i of the cell counter 41 becomes x k3 . At this moment, the counter 45 generates an output to stop the counting operation, and also the latch buffer 48 transfers its stored value to the latch buffer 49 to store the output from the division circuit 47 in the latch buffer 48. Subsequently, the adder circuit 46, the sum of products calculating circuit 42, and the division circuit 47 are all reset. That is, the division circuit 47 executes the operation defined by the fifth equation on the basis of both outputs from the sum of products calculating circuit 42 and the adder circuit 46. As a result, at the point the counter 45 generates the output, of gravity position in a region from the cell position x 1 to the cell position x k3 , i.e., the light receiving position x a1 . Then, this value x a1 is stored in the latch buffer 48. Still further, when the output x i of the cell counter 41 becomes x k4 , and the output value of the A/D converter 43 exceeds the threshold value V s , the comparator 44 generates an output to reset the counter 45 again. Furthermore, when the output x i of the cell counter 41 becomes x k5 , and the output of A/D converter 43 decreases below the threshold value V s , the comparator 44 stops its output, and the counter 45 resumes to count the number of sample hold signals SH. However, in the example of Fig. 6, the output of the A/D converter 43 exceeds the threshold value V s before the counted value of the counter 45 reaches the predetermined value N, and so the counter 45 is reset again. When the output x i of the cell counter 41 becomes x k6 , the output value of the A/D converter 43 decreases down below the threshold value V s , and the counter 45 starts the counting operation. Then, when the output x i of the cell counter 41 becomes x k7 , and the counted value of the counter 45 exceeds the predetermined value N, the counter 45 generates an output to stop the counting operation and, at the same time, the light receiving position x a1 stored in the latch buffer 48 is transferred into the latch buffer 49, and the output from the division circuit 47 is stored in the latch buffer 48. Subsequently, the adder circuit 46, the sum of products calculating circuit 42, and the division circuit 47 are all reset. In this case, the sum of products calculation circuit 42 generates a sum of products value ΣC i ·x i from the position x k3 that was previously reset, and the adder circuit 46 generates, from the position x k3 , an output ΣC i corresponding to the sum of output C i of the A/D converter 43. Therefore, when the counter 45 generates an output, the division circuit 47 outputs the gravity position in a region from the cell position x 3 to the cell position x k7 , that is, the light receiving position x a2 . Thus, this value x a2 is stored in the latch buffer 48. Then, if the gate signal TG is outputted, the stored values in the latch buffers 48 and 49 are both supplied to the control unit 50, and the latch buffers 48 and 49 are reset. Also, the sum of products calculating circuit 42, the adder circuit 46 and the cell counter 41 are all reset by the gate signal TG. Accordingly, the scanning operation is resumed from the first cell of the light receiving element 14 to repeat the above-described operation. Next, an operation of the first embodiment of the present invention relating to the processing, which is executed by the control unit 50 to detect the object position, will be explained with reference to a flow chart of the processing to be executed the processor of the same control unit 50 shown in Fig. 7. In this embodiment, the light receiving position is successively detected by changing the scanning angle of the laser beam; both the primary reflection beam position corresponding to the scanning angle immediately before the secondary reflection beam comes to be detected and the primary reflection beam position corresponding to the scanning angle immediately after the secondary reflection beam comes to be not detected are stored; then, the position of the object is detected on the basis of the relationship between these primary reflection beam positions and two light receiving positions, which correspond to the minimum and maximum scanning angles. First of all, the control unit of the robot accommodating this laser sensor generates a scanning instruction. In the case where the processor of this robot control unit also serves as the control unit of the laser sensor, this processor generates a scanning instruction in accordance with the operation of the robot. In response to the given instruction, the laser actuating unit 21 starts to operate to cause the laser oscillator 11 to emits a laser beam. Then, the processor outputs a scanning start instruction to the mirror scanning unit 22, as shown in a step S1 of the flow chart. The mirror scanning unit 22 changes the angle of the swing mirror 12 stepwise at a predetermined pitch in response to the gate signal TG until the angle of the swing mirror 12 is adjusted to a predetermined angle. By the way, the scanning angle of the laser beam is determined by the swingable angle of the mirror 12, which is set in such a manner that the swingable limit of the swing mirror 12 in a counterclockwise direction of Fig. 4 corresponds to the minimum scanning angle, and the scanning angle of the laser beam increases as the swing mirror 12 turns in a clockwise direction. On the other hand, in response to the gate signal, the processor reads in the light receiving position x a1 and x a2 supplied from the latch buffers 48 and 49. Usually, when the scanning start instruction is generated, the mirror angle is positioned in such a manner that the laser beam can be reflected in one plane of the object 30 without causing the generation of the secondary reflection beam. Therefore, the position x a fed from the latch buffers 48 and 49 is a data corresponding to the primary reflection beam. For example, in the case of the object 30 shown in Fig. 4, no secondary reflection beam is obtained in the beginning of the scanning operation, and, therefore, only the position data derived from the primary reflection beam is supplied. The processor stores this data into the register R(Pa) as a data obtained at the scanning initiation point as shown in step S2, and a condition storage flag F is set to 0, as shown in step S3. Fig. 8 is a view illustrating a relationship of the laser beam scanning angle (i.e. the swing mirror angle) with respect to the object 30 shown in Fig. 4 versus the light receiving position x a on the light receiving element 14. In this case, the laser beam is first reflected at a point far from a bent portion to be welded or sealed. Therefore, only primary reflection beam is generated. That is, only one light receiving position x a on the light receiving element 14 is obtained, and thus only the data stored in the latch buffer 48 is supplied to the control unit 50. However, if the laser beam scanning angle increases so that the position irradiated by the laser beam approaches the bent portion on the object 30, the secondary reflection beam comes into existence, whereby light receiving positions increases to two due to primary reflection beam and the secondary reflection beam, respectively. Thus, two data will be coming from two latch buffers 48 and 49. Then, in the case where the primary reflection beam and the secondary reflection beam approach very closely or are overlapped each other, the secondary reflection beam looks disappeared momentarily. Accordingly, at this moment, it becomes that only one data is supplied from the latch buffer 48. As the scanning angle increases further, however, the primary reflection beam and the secondary reflection beam come to be separated from each other again, and, therefore, two light receiving positions will be detected again. Furthermore, as the scanning angle is increased further, the position on the object where the laser beam is received and reflected is shifted far away from the bent portion, and thus the secondary reflection beam will no longer appears, so that only one light receiving position will be obtained. Accordingly, the processor stores one light receiving data, which is supplied at the point at which the scanning operation is initiated, into the register R(Pa). In the example of Fig. 8, this light receiving position is shown as Pa, and this position Pa is stored in the register R(Pa). Subsequently, every time the gate signal TG is outputted, the mirror scanning unit 22 causes the swing mirror 12 to swing by one pitch. On the other hand, the processor is synchronized with the gate signal TG to selectively and repeatedly execute the processing described in steps S4 to S19 every time when the scanning angle of the laser beam is changed. First of all, in a stage immediately after the start of the scanning operation, only one reflection component is obtained, and the condition storage flag F is equal to its initial value 0. Moreover, since the scanning angle of the laser beam has not yet reached the maximum scanning angle, the processor in the control unit 50 executes the processing defined in the step S4. That is, in response to the change of scanning angle of the laser beam, the data stored in the latch buffer 48 is read out, and the processing defined by the steps S5 to S8 is executed repeatedly so that the light receiving position data of the primary reflection beam at the latest scanning angle is stored in the register R(Pb) to renew its stored data corresponding to the latest scanning angle, as shown in step S7. Then, when the laser beam position on the object 30 shifts toward the bent portion until the secondary reflection beam appears, two data will be supplied from the latch buffers 48 and 49. In this case, the processor in the control unit 50 judges the beam to be the secondary reflection beam in the step S5. After executing the judgement processing in step S9, the processor sets the condition storage flag F to 1, as shown in a step S10, and executes judgement processing in the steps S14 (a processing for judging whether or not the flag F is set to "2") and S8. Then, the processing returns to the step S4. At this point, the data stored in the register (Pb) is the value of the latch buffer 48 corresponding to the scanning angle immediately before the secondary reflection beam is detected, that is, the light receiving position data of the register (Pb) shown in Fig. 8 (the first light receiving position). The condition storage flag F is set to 1 when the secondary reflection beam is detected. Therefore, in the succeeding scanning angles, the processing defined by the steps S5, S9, S14 and S8 are repeatedly executed, every time the scanning angle of the laser beam varies in executing the processing in step S4 wherein the scanning angle of the laser beam is changed stepwise. Besides, as the laser beam position on the object 30 approaches the bent portion, the secondary reflection beam position on the object 30 also gradually approaches the bent portion from the opposite direction, as shown in Fig. 8. When the primary reflection beam and the secondary reflection beam approach each other very closely, it is not always easy to distinguish the first reflection beam from the secondary reflection beam, and vice versa, depending on the set value Vs or setting of N. Therefore, the judgement may be made as if the secondary reflection beam is not existing. Also, when a pitch of the scanning angle is extremely small, such confusing cases may occur not a few number of times. (Refer to an intersection of the primary reflection component and the secondary reflection component in Fig. 8) In such a case, as only one data is supplied from the latch buffer 48, the processor that repeatedly executes the processing defined in the steps S4, S5, S9, S14 and S8 will judge in the step S5 that the secondary reflection beam is not detected and goes to the step S6. In this case, as the condition storage flag F is already set to 1, the processor proceeds to the step S12 to set the condition storage flag F to 2 after having executed the judgement in the step S11. And then, the processor executes the judgement processing in the step S8 and returns to the step S4 again. When the discrimination between the primary reflection beam and the secondary reflection beam cannot be made, and when the secondary reflection beam has disappeared momentarily, the result of judgement in step 5 will become FALSE, but the processings defined in steps S4, S5, S6, S11, S13 and S8 will be repeatedly executed, since the value of condition storage flag is 2. Then, when the scanning angle of the laser beam is further increased to enable the primary reflection beam and the secondary reflection beam to be discriminated from each other, two data will become available again from the latch buffers 48 and 49. In this condition, the processor in the control unit 50 will judge in the step S5 that the secondary reflection beam is existing, and, in turn, proceeds to step S15 to set the condition storage flag F to 3 after having executed the processing in the steps S9 and S14. And then, the processor again returns to the step S4 after having executed the judgement processing in the step S8. As the value of the condition storage flag F is 3 as long as the secondary reflection beam is detected, the processor repeatedly executes the processing of the steps S4, S5, S9, S14 and S8 in the succeeding scanning angles. Next, if the primary reflection beam and the secondary reflection beam are further apart so far away that the secondary reflection beam comes to be no longer detected, the judgement in the step S5 turns to NO. In this case, the processor executes the judgement processing in the steps S6, S11, S13 and S16, and proceeds to step S17. In the step S17, the processor stores a light receiving position data corresponding to the latest scanning angle, i.e. a value stored in the latch buffer 48 that corresponds to the scanning angle immediately after the secondary reflection beam has not been detected. That is, the light receiving data indicated by Pc in Fig. 8 is stored in the register R(Pc). Furthermore, the processor sets the condition storage flag F to 4 in step S18, executes the judgement processing in the step S8, and subsequently returns to the step S4. As the value of the condition storage flag F is 4 at this moment, the secondary reflection beam is no longer detected in the succeeding scanning angles. The processor repeatedly executes the judgement processing of steps S4, S5, S6, S11, S13 and S16, a processing in a step S19 and further the judgement processing of step S8. That is, the latest value in the latch buffer 48 is stored in the register R(Pd) one after another corresponding to the scanning angle in the processing of step S19 so as to renew the value previously stored in the register. Accordingly, when the scanning angle reaches the maximum angle, and the judgement in the step S8 is turned to YES, the register R(Pd) stores the light receiving position of the primary reflection beam corresponding to the maximum scanning angle; i.e. the data of Pd in Fig. 8. The registers R(Pa)-R(d) respectively store the light receiving positions of primary reflection beams. When the laser beam moves on the plane of the object in accordance with the swing motion of the swing mirror 12, the light receiving position at which the reflected beam is received varies linearly on the light receiving element. That is, the register R(Pa) stores the first light receiving position Pa of primary reflection beam that is reflected back at a point far from the bent portion of the object. The register R(Pb) stores the light receiving position Pb of primary reflection beam that is located close to the bent portion and corresponds to the scanning angle immediately before the secondary reflection beam become detectable. Therefore, a straight line passing both the light receiving positions Pa and Pb coincides with the straight line of the light receiving position generated when the laser beam moves on one plane of the object. In the same manner, a straight line passing the light receiving positions Pc and Pd stored in the registers R(Pc) and R(Pd) coincides with the straight line of the light receiving position generated when the laser beam moves on the other plane of the object. Then, a position where these two straight lines intersect represents the light receiving position corresponding to the bent portion of the object. Accordingly, the processor executes the second and third equations with respect to the positions Pa, Pb, Pc and Pd stored in respective registers R(Pa), R(Pb), R(Pc) and R(Pd) to obtain coordinate positions (X a , Y a ), (X b , Y b ), (X c , Y c ), and (X d , Y d ) corresponding to respective positions. Then, equations of these two straight lines are obtained on the basis of the combination of (X a , Y a ), (X b , Y b ) and (X c , Y c ), (X d , Y d ), respectively. Furthermore, an intersection of thus obtained two straight lines is obtained. This intersecting point coincides with the bent portion, and, therefore, is determined as a welding or sealing point, as shown in step S20. Above-described operation is for the detecting of only one welding or sealing point. However, in the case where the welding or sealing position is to be detected continuously, the swing direction of the swing mirror 12 is reversed after completing the processing of step S20, and the processing starting from the step S1 is repeatedly executed. In this case, the register R(Pa) stores the light receiving position Pd in Fig. 8, and the register R(Pb) stores the light receiving position Pc. Further, the register R(Pc) stores the light receiving position Pb, and the register R(Pd) stores the light receiving position Pa, respectively. Next, a second embodiment of the present invention will be explained with reference to the flow chart shown in Figs. 9 and 10. In this second embodiment, the most closest scanning angle is obtained. This most closest scanning angle is defined as a scanning angle at which two light receiving positions of the primary reflection beam and the secondary reflection beam at the same scanning angle approach most closely each other. The most closest scanning angle is used to separate the light receiving position data into the data relating to the primary reflection beam and the data relating to the secondary reflection beam. Thus, only the light receiving positions relating to the primary reflection beam are picked up. In this embodiment, the minimum scanning angle corresponds to an original position of the swing mirror 12, while the maximum scanning angle corresponds to a maximum swingable angle of the swing mirror 12 measured from the original position. Furthermore, respective components in the laser sensor and the object 30 are the same as those disclosed in the first embodiment. In other words, this second embodiment is different from the first embodiment only in that the processor in the control unit 50 functions differently. The relationship of the laser beam scanning angle (i.e. the swing mirror angle) with respect to the object 30 versus the light receiving position x a is newly shown in Fig. 11. In the processing shown in Fig. 9, the processor first initialize an address index j, as shown in a step T1, and sets the condition memorizing flag f to 0, as shown in a step S2. Subsequently, the processor proceeds to step T3 to read in light receiving data from the latch buffers 48 and 49. However, as there is no secondary reflection beam immediately after the scanning operation is just started, only the data x a1 is inputted from the latch buffer 48. Accordingly, a judgement result in step T4 becomes NO. Thus, the processor proceeds to step T5 to store the light receiving position x a1 read out from the latch buffer 48 into two registers RL(j) and RS(j) respectively, with the address j provided in the RAM and the like of the control unit. These two registers RL(j) and RS(j) store light receiving positions corresponding to the scanning angle of the swing mirror 12. That is, each of these registers RL(j) and RS(j) stores the light receiving position corresponding to the scanning angle equal to a pitch angle Δ multiplied by j. After storing the light receiving position data, the processor proceeds to step T6 to increment the address index j, and further proceeds to step T7 to judge whether or not the scanning angle of the swing mirror 12 has reached the maximum scanning angle. As the scanning angle has not reached the maximum scanning angle yet in returns to the step T3. In the succeeding scanning operation, as long as the judgement result becomes NO in the step T4, the processor repeatedly executes the processing in the steps T5 to T7 every time a light receiving position data is newly inputted in response to the change of swing angle of the swing mirror 12 in the step T3. Thus, a light receiving position data x a1 of primary reflection beam with respect to the new scanning angle jΔ is stored in the register RL(j) and RS(j). Accordingly, in the example of Fig. 11, each of the light receiving position data x a1 of primary reflection beam respectively corresponding to each of the scanning angle 0 to aΔ will be stored in a register having the corresponding address (0-a for each), i.e. in each one of the registers RL(0) to RL(a) and in each of the registers RS(0) to RS(a). The light receiving position data stored in the registers RL(0) to RL(a) and the registers RS(0) to RS(a) become elements for tracing a shifting locus LD1 of the primary reflection beam on the light receiving element 14 as shown in Fig. 11. If the scanning angle exceeds aΔ, and the secondary reflection beam is generated, two light receiving position data x a1 and x a2 come to be inputted from both the latch buffers 48 and 49, and the judgement result turns to YES in the step T4. Then, the processor proceeds to the step T8 to judge whether or not the condition storage flag f is 0. That is, this condition storage flag f is used to check whether or not the secondary reflection beam is detected for the first time. As the condition storage flag f is 0 at this moment, this means that the secondary reflection beam is detected for the first time. Therefore, the processor proceeds to step T9 to store a present value of the address index j in a register A s that stores the address of the position where the secondary reflection beam occurred, and further goes to step T10 to set the condition storage flag f to 1. By the way, in the example of Fig. 11, the register A s stores a+1 since the secondary reflection beam is generated for the first time after the scanning angle exceeds aΔ. Subsequently, the processor proceeds to step T11 to compare the light receiving position data x a1 fed from the latch buffer 48 with the light receiving position data x a2 fed from the latch buffer 49. And, whichever larger of these light receiving position data x a1 and x a2 is stored in the register RL(j) and the smaller one of these light receiving position data x a1 and x a2 is stored in the register RS(j) in step T12 or step T13. Further, the processor goes to the step T6 to increment the address index j, and, in turn, goes to the step T7 to judge whether or not the scanning angle of the swing mirror 12 has reached the maximum scanning angle. As the scanning angle has not reached the maximum scanning angle yet at this moment, the processor returns to the step T3. In the succeeding scanning operation, as long as two light receiving position data x a1 and x a2 of primary reflection beam and secondary reflection beam are supplied from the latch buffers 48 and 49, the judgement result becomes YES in the step T4. However, as the condition storage flag f is already set to 1, the judgement result becomes NO in the step T8 this time. Accordingly, each time a new light receiving position data is inputted following the change of swing angle of the swing mirror 12, the processor proceeds to step T14, after finishing the judgement processing in the step T8, to renew the present value of address index j stored in register Ae, which is for storing the position where the secondary reflection beam has disappeared. Then, the processor proceeds to the step T11 to compare the light receiving position data x a1 fed from the latch buffer 48 with the light receiving position data x a2 fed from the latch buffer 49 to store whichever larger of these light receiving position data x a1 and x a2 is stored in the register RL(j), and the smaller one of the light receiving position data x a1 and x a2 is stored in the register RS(j) in the step T12 or the step T13. Further, the processor goes to the step T6 to increment the address index j, goes further to the step T7 to execute the judgement processing, and returns to the step T3 again. As long as the judgement result is YES in the step T4, the processor repeatedly executes the above-described processing every time the scanning angle of the swing mirror 12 is changed stepwise to input a new light receiving position data. However, if the primary reflection beam and the secondary reflection beam approach very closely each other at the scanning angle bΔ as shown in Fig. 11, discrimination of two reflection beams may become impossible. In such a case, only the light receiving data x a1 is supplied from the latch buffer 48. Therefore, the judgement result in the step T4 turns to NO in this instance. And then, the light receiving data x a1 fed from the latch buffer 48 is stored in both of the registers RL(j) and RS(j) in the step T5. Subsequently, when the primary reflection beam and the secondary reflection beam further shift to depart from each other until they become distinguishable, the judgement result in the step T4 becomes YES. Therefore, the processor re-starts to renew the present value of the address index j and store it in the register A e that serves to store the position where the secondary reflection beam disappears. Then, the light receiving position data having a larger value is stored successively in the register RL(j), and the light receiving position data having a smaller value is stored in the same way in the register RS(j). By the way, in the example shown in Fig. 11, the address index j of c-1 is finally stored in the register A e that stores the position where the secondary reflection beam disappears, because the secondary reflection beam is no longer detected after the scanning angle reaches cΔ. As the secondary reflection beam is no longer detected after the scanning angle of the swing mirror 12 reaches cΔ, the processor repeatedly executes the processing in the step T5 in response to every detection of primary reflection beam so that the light receiving position x a1 of primary reflection beam can be successively stored in both of the registers RL(j) and RS(j) until the scanning angle of the swing mirror 12 reaches the maximum scanning angle. When the scanning angle of the swing mirror 12 becomes the maximum scanning angle dΔ to change the judgement result of the step T7 to YES, the processor proceeds to a new step T15. Fig. 12 is an illustrative view schematically showing the light receiving data stored in the registers RL(0) to RL(d) and the registers RS(0) to RS(d) through the above-described processing. As can be understood from Figs. 11 and 12, the light receiving position data stored in the registers RS(a+1) to RS(b-1) become elements for tracing a shifting locus LD2 of primary reflection beam on the light receiving element 14. Whereas, the light receiving position data stored in the registers RL(a+1) to RL(b-1) become elements for tracing a shifting locus LU1 of secondary reflection beam on the light receiving element 14. Furthermore, the light receiving position data stored in the registers RS(b+1) to RS(c-1) become elements for tracing a shifting locus LD3 of secondary reflection beam on the light receiving element 14. Whereas, the light receiving position data stored in the registers RL(b+1) to RL(c-1) become elements for tracing a shifting locus LU2 of primary reflection beam on the light receiving element 14. Moreover, the light receiving position data stored in the registers RL(b) and RS(b) are elements common to the primary reflection beam shifting loci LD2 and LU2, the secondary reflection beam shifting loci LU1 and LD3. As a resolution for discriminating the primary reflection beam and the secondary reflection beam is dependent on the threshold value V s or the predetermined value N, the region where the primary reflection beam and secondary reflection beam are not always overlapped at only one point. Therefore, the same light receiving position data x a1 can be stored in a plurality of registers such as the registers RL(b) and RL(b+1), or RS(b) and RS(b+1). As the generation of the secondary reflection beam will not be detected before the scanning angle of the swing mirror 12 reaches aΔ, and after the scanning angle of the swing mirror 12 reaches cΔ, the registers RL(0) to RL(a) and RS(0) to RS(a) stores elements for tracing a shifting locus LD1 of the primary reflection beam on the light receiving element 14, whereas the registers RL(c) to RL(d) and RS(c) to RS(d) stores elements for tracing a shifting locus LU3 of the primary reflection beam on the light receiving element 14. In this manner, after having finished all the detecting operations ranging all the scanning angles, the processor of the control unit goes to the step T15 in order to initiate a processing for detecting the most closest scanning angle where two light receiving positions of the primary reflection beam and secondary reflection beam come most closely to each other. After having proceeded to the step T15, the processor sets both the register A c , which stores the address corresponding to the most closest scanning angle, and the address index j to the value of the register A s , which stores the position where the secondary reflection beam appears. Furthermore, in accordance with a value of this address index j, the processor calculates a difference between the light receiving positions of the primary reflection beam and the secondary reflection beam at the position where the secondary reflection beam comes into existence. And, the obtained difference value is stored in a minimum value storage register W as its initial value, as shown in step T16. In this instance, a value of the index j is A s that corresponds to a scanning angle (a+1)Δ in Fig. 11. Next, the processor of the control unit increments the value of index j for correspondence to the following scanning angle (a+2)Δ as shown in a step T17. Then, the processor goes to step T18 to judge whether or not the value of address index j reaches the value of register A e that stores the position where the secondary reflection light disappears. If the address index j has not reached the value yet, the processor calculates a difference between the light receiving position of the primary reflection beam and the light receiving position of the secondary reflection beam at this scanning angle. And then, it is judged whether or not thus obtained difference is smaller than or equal to the present value of minimum value storage register W, as shown in a step T19. In this case, if the obtained difference is smaller than or equal to the present value of minimum value storage register W, this difference value is stored in the minimum value storage register W to renew its stored value, as shown in a step T20. Also, the present value of index j is stored in the register A c to renew its stored value, as shown in a step T21. On the other hand, if the difference value obtained in the step T19 is larger than the present value of minimum value storage register W, the minimum value storage register W and the register A c will be left intact. Then, the processor returns the step T17 again, and, in turn, increments the value of index j. And further, on the basis of a renewed value of index j, the processor repeatedly executes the processing of the step 18 and succeeding steps. That is, as long as the value of address index j has not reached the value of register A e , which stores the position where the secondary reflection beam disappears (step T18), the processor in the control unit repeats the above-described processing. Further, the difference between the light receiving position of the primary reflection beam and the light receiving position of the secondary reflection beam is successively calculated. And, every time when the calculated value becomes smaller than or equal to the minimum value already stored in the minimum value storage register W, the register A c is renewed by a value of the address index at corresponding scanning angle. Accordingly, the register A c stores, as an address at the most closest scanning angle, an address corresponding to the scanning angle where the difference between the light receiving position of the primary reflection beam and the light receiving position of the secondary reflection beam becomes minimum in the scanning angle region between (a+1)Δ and (c-1)Δ wherein the primary reflection beam and the secondary reflection beam are detected simultaneously. In the example of Fig. 11, the difference between the light receiving position of the primary reflection beam and the light receiving position of the secondary reflection beam becomes a minimum value 0 when the scanning angle is bΔ. Therefore, the register A c stores the value of address b. However, in the case where the discrimination of two reflection beams becomes impossible temporarily plural number of times, the minimum value continues to be 0 during this period of time. Therefore, an address immediately before the discrimination of two reflection beams is restored will be stored in the register A c . By the way, if the judgement standard in the step T19 is set to |RL(j) → RS(j)|< W, an address of the position where the discrimination of two reflection beams has become impossible for the first time will be stored in the register A c . After having detected the address register A c of the most closest scanning angle in this manner, the processor identifies the smaller light receiving position data RS(j) as the light receiving position data of the primary reflection beam in the region from the 0 address that corresponds to the minimum scanning angle to the A c (=b) address that corresponds to the most closest scanning angle, while the larger light receiving position data RL(j) will be identified as the light receiving position data of the primary reflection beam in the region from the A c (=b) address to the d address that corresponds to the maximum scanning angle. (See step T22) Fig. 13 is a view illustrating an arrayed condition of the light receiving position data identified by the processor. The smaller light receiving position data RS(j) corresponding to the address indexes j=0-b become elements for tracing the shifting loci LD1 and DL2 of the primary reflection beam on the light receiving element 14 in Fig. 11. On the other hand, the larger light receiving position data RL(j) corresponding to the address indexes j=b-d become elements for tracing the shifting loci LU2 and LU3 of the primary reflection beam. The processor in the control unit executes the second and third equations with respect to respective light receiving position data of the primary reflection beam stored in respective registers to calculate each coordinate position (X j , Y j ) of the object corresponding to each light receiving position. Then, the processor stores these coordinate position data as cross-sectional position data of the object, as shown in step T23. Furthermore, two straight lines are obtained by applying a linear interpolation to the coordinate position (X j , Y j ) of the object in each of regions j=0-b and j=b-d. Then, an intersection of thus obtained two straight lines is calculated to obtain the bent portion of the object. The above-described second embodiment operates at higher accuracy than the first embodiment, since the adverse effect caused by disturbance can be suppressed due to that only the light receiving position data of primary reflection beam is chosen from the plurality of light receiving data stored corresponding to the same scanning angle, and the bent portion is obtained after finishing the calculation of the coordinate position of object for every scanning angle. Moreover, though the foregoing description of the position detecting operation shown in Figs. 9 and 10 is concerned with a case of processing where the swing mirror 12 is turned from its original position toward the maximum scanning angle, the position detecting operation can also be carried out similarly even in the case where the swing mirror 12 is reversely turned from the maximum scanning angle (i.e. the swingable limit) to the original position. However, the latter case differs from the former case in that the address maximum value d will be set as the address index j in the processing of step T1; the address index j will be decremented in the processing of step T6; the judgement standard in the step T7 will be changed to the minimum scanning angle; the value of index j will be stored in the register A e in the step T9; and the value of index j will be stored in the register A s in the step T14. Accordingly, regardless of whether the swing mirror 12 is turned from the original position toward the maximum position or from the maximum position toward the original position, values stored in respective registers at the start of the processing of step T15 are identical in both cases as long as the scanning operation is carried out with respect to the same object. In the case of the position detecting method according to the present invention, the object position can be detected with higher resolution as compared with the conventional detecting method using a CCD as a light receiving element. Moreover, it becomes possible to eliminate or reduce detection error due to noise lights such as secondary reflection beams.

Claims: A position detecting method for a laser sensor that contains a CCD as a light receiving element for detecting an object position, wherein said position detecting method comprises steps of: obtaining a sum of products by successively multiplying an output value of each cell arrayed in said CCD by the position value of this each cell, and summing up the thus-multiplied values; obtaining the sum total of said output values of the respective cells; and obtaining a light receiving position by dividing said sum of products by said sum total; the method being characterized by providing a counting means, which will be reset when said output value of said CCD exceeds a predetermined threshold value, will count a number of cells to be scanned when said output value of said CCD decreases down below said threshold value until said number of cells reaches a predetermined value and will generate an output value when the predetermined value is reached, wherein said sum of products is divided by said sum total in response to this output value from the counting means; said sum of products and said sum total are reset together; not less than one light receiving position that exceeds said threshold value is detected during a predetermined interval; and a light receiving position of the primary reflection beam of a laser beam is obtained on the basis of said detected not less than one light receiving position in order to detect the object position. A position detecting method for a laser sensor in accordance with claim 1, further comprising steps of: changing a scanning angle of said laser beam in order to successively detect not less than one light receiving position; storing a first light receiving position corresponding to a scanning angle immediately before a plurality of light receiving positions come to be detected at the same scanning angle and a second light receiving position corresponding to a scanning angle immediately after a plurality of light receiving positions come to be not detected at the same scanning angle; and obtaining a first straight line passing two object positions respectively corresponding to said first light receiving position and another light receiving position at a scanning angle before said first light receiving position is scanned, and a second straight line passing two object positions respectively corresponding to said second light receiving position and another light receiving position at a scanning angle after said second light receiving position is scanned in order to identify the object position. A position detecting method for a laser sensor in accordance with claim 2, wherein an intersection point of said two straight lines is obtained to detect a position of a bent portion of the object. A position detecting method for a laser sensor in accordance with claim 1, further comprising steps of: successively storing not less than one light receiving position detected by changing a scanning angle of said laser beam; obtaining the most closest scanning angle at which a plurality of light receiving positions detected at the same scanning angle approach each other most closely; selecting a smaller valued one from among said plurality of light receiving positions when the scanning angle is less than said most closest scanning angle and, to the contrary, selecting a larger valued one from among said plurality of light receiving positions when the scanning angle is larger than said most closest scanning angle so that these selected light receiving positions can be obtained as said light receiving position of the primary reflection beam. A position detecting method for a laser sensor in accordance with claim 4, further comprising steps of: obtaining the object position from said light receiving position of the primary reflection beam; obtaining a first straight line on the basis of said object position obtained from said light receiving position of the primary reflection beam in a scanning angle region from the minimum scanning angle to said most closest scanning angle; obtaining a second straight line on the basis of said object position obtained from said light receiving position of the primary reflection beam in a scanning angle region from said most closest scanning angle to the maximum scanning angle; and identifying an intersection point of these first and second straight lines as a position of a bent portion of the object. A position detecting method for a laser sensor in accordance with claim 3 or 5, wherein said intersection point of the bent portion is a welding or sealing position. A position detecting apparatus for a laser sensor comprising: a light receiving cell consisting of a CCD that contains a plurality of cells, each generating an output in accordance with an electric charge stored in proportion to a light quantity received on a cell surface; a timing signal generating means for generating a sample hold signal to successively scan respective cells from the beginning after a gate signal is outputted; a cell counter capable of being reset by said gate signal and counting said sample hold signals to output a value x i of cell position in the light receiving element; an adder means capable of being reset by said gate signal and successively adding said output C i of each cell in the light receiving element to be scanned in response to said sample hold signal to obtain an addition value ΣC i ; a sum of products calculating means capable of being reset by said gate signal and for multiplying said output C i of each cell in the light receiving element to be scanned in response to said sample hold signal by said value x i of each cell position outputted from said cell counter and successively summing up these multiplied values to obtain a summed-up value ΣC i ·x i ; and a division means for dividing said summed-up value ΣC i ·x i obtained by the sum of products calculating means by said addition value ΣC i obtained by the adder means to calculate a center of gravity position ΣC i ·x i / ΣC i of receiving beams and outputting this center of gravity position as the light receiving position; the apparatus being characterized by: a comparator that compares the output C i of each cell with a predetermined threshold value V s and generates an output when the output C i of each cell is equal to or greater than the predetermined threshold value V s ; a counter capable of being reset in response to the output signal fed from said comparator, and functioning to count the cell number to be scanned after said output signal disappears and generating an output signal when the cell number exceeds a predetermined value so that said adder means, sum of products calculating means and division means are all reset in response to this output signal; a plurality of latch buffers capable of being connected in series, respectively functioning to transfer stored data to their succeeding buffers in response to the output signal fed from said counter, storing the output fed from said division means in a first step buffer thereof, and being reset by said gate signal; and a position detecting means for obtaining the light receiving position of the primary reflection beam on the basis of data stored in said plurality of latch buffers. A position detecting apparatus for a laser sensor in accordance with claim 7, further comprising a means for changing a scanning angle of a laser beam in synchronization with said gate signal, wherein said means for obtaining the light receiving position of the primary reflection beam includes a means for obtaining a first light receiving position at which only one memorizing data is supplied from said plurality of latch buffers in the beginning of the scanning operation of the laser beam, a second light receiving position corresponding to a scanning angle immediately before a plurality of memorizing data come to be obtained, a third light receiving position corresponding to a scanning angle immediately after a plurality of memorizing data come to be no longer obtained, and a fourth light receiving position at which only one stored data is supplied from said plurality of latch buffers in the end of the scanning operation, and storage means for storing respective light receiving positions. A position detecting apparatus for a laser sensor in accordance with claim 8, further comprising a means for obtaining a first straight line passing two object positions respectively corresponding to said first and second light receiving positions and a second straight line passing two object positions respectively corresponding to said third and fourth light receiving positions, whereby said first and second straight lines are identified as the object position. A position detecting apparatus for a laser sensor in accordance with claim 9, further comprising a means for detecting an intersection point of said first and second straight lines as a bent point of the object. A position detecting apparatus for a laser sensor in accordance with claim 7, further comprising a means for changing a scanning angle of a laser beam in synchronization with said gate signal, wherein said means for obtaining the light receiving position of the primary reflection beam includes a storage means for storing a plurality of light receiving positions supplied from said plurality of latch buffers and a detecting means for detecting the most closest scanning angle at which said plurality of light receiving positions approach most closely one another, thereby detecting light receiving position of the smallest value from said storage means as a first light receiving position of primary reflection beam in a region from the minimum scanning angle to said most closest scanning angle, and also detecting light receiving position of the largest value from said storage means as a second light receiving position of primary reflection beam in a region from said most closest scanning angle to the maximum scanning angle. A position detecting apparatus for a laser sensor in accordance with claim 11, further comprising: a means for obtaining the object position from said first and second light receiving positions of primary reflection beam; a means for obtaining one straight line representing a first object position on the basis of said first light receiving position of primary reflection beam and the other straight line representing a second object position on the basis of said second light receiving position of primary reflection beam; and a means for obtaining an intersection of said two straight lines representing said first and second object positions as a position of a bent portion of the object. A position detecting apparatus for a laser sensor in accordance with claim 10 or 12, wherein said bent portion is a welding or sealing position.

Inventors: IWAMOTO TAKASHI, NAITO YASUO, NIHEI RYO, TORII NOBUTOSHI, WAKIO HIROSHI, IWAMOTO, TAKASHI, NAITO, YASUO, NIHEI, RYO, TORII, NOBUTOSHI, WAKIO, HIROSHI, IWAMOTO, TAKASHI FANUC DAI-3 VIRA-KARAMATSU, NAITO, YASUO ROOM 7-205, FANUC MANSHONHARIMOMI, NIHEI, RYO ROOM 7-210, FANUC MANSHONHARIMOMI, WAKIO, HIROSHI FANUC DAI-3 VIRA-KARAMATSU
Applicants: FANUC LTD, FANUC LTD.
Application year: 1992
Main classification: G01B11
IPC codes: B25J19, G05D3, G01S17, G01C3, G01B11