Method and apparatus for generating and applying common teaching data of robots
BACKGROUND OF THE INVENTION 
     The present invention relates to generation and utilization of teaching data of a robot and, more particularly, to a method and apparatus for generating and applying teaching data whereby teaching data of one robot can be commonly used for another robot. 
     A servo command value for a robot is frequently indicated by joint angles, e.g. θ 1A , θ 2A  shown in FIG. 3A. There is a relation of 
     
         X(P) 
    
     between joint angles and a command position D A  by a mechanism parameter P including the angle θ 2A . X denotes a vector indicative of the position and orientation of a robot. P is a mechanism parameter indicative of the length of arm, attaching angle, or the like. 
     When considering a 2 degree-freedom SCARA robot shown in, e.g., FIG. 4A, the command values are θ 1  and θ 2  in FIG. 4B. (Although the definitions of the θ 1  and θ 2  differ in every robot, they are defined as shown in FIG. 4B in this example). Only arm lengths r 1  and r 2  are provided as mechanism parameters. Consequently, the following equation is derived. ##EQU1## 
     On the contrary, joint angles can be also obtained from X(P) by the well-known coordinates transformation of a robot. 
     For instance, in the case of FIGS. 4A and 4B, assuming that ##EQU2## θ 1  and θ 2  can be obtained by ##EQU3## 
     However, since the mechanism parameter P includes the assembling error and the machining error of the dimensions and angle ΔP (which is referred to as the mechanism errors) which occur upon working, even if the robot is operated in accordance with a command value, the robot does not reach the command position D A  but actually moves to a position T A . 
     For example, when the arm lengths r 1  and r 2  of the robot shown in FIG. 4A include errors of Δr 1  and Δr 2 , if θ 1  and θ 2  are given, the robot does not reach the position D A  ##EQU4## but it obviously moves to the position T A  ##EQU5## 
     Further, if the origin positions (the positions when θ=0) of θ 1  and θ 2  are deviated by Δθ 1  and Δθ 2 , the equation (4) becomes as follows. ##EQU6## 
     That is, even if the robot is desired to move to the position D A  of the equation (3) by using (r 1 , r 2 , θ 1 , θ 1 ), the robot arrives at the position T A  of the equation (5) due to (Δr 1 , Δr 2 , Δθ 1 , Δθ 2 ). 
     In other words, when the robot is controlled by the command position D A  =X(P), the robot eventually reaches the position T A  =X(P+ΔP). Therefore, the operator performs a teaching work for allowing the robot to be positioned to the actual position T A , and the command position X(P) is stored as teaching data into a memory, and playback processes are executed on the basis of this teaching data. 
     A method of obtaining the mechanism error ΔP has been disclosed in U.S. Pat. No. 4,670,849 by Okada et al, filed on June 2, 1987. On the other hand, a method of obtaining what is called a coordinates transformation equations corresponding to the equations (1) and (2) suitable for general robots such as robots other than the SCARA robot has been disclosed in detail in Richard P. Paul, &#34;Robot Manipurators: Mathematics, Programming and Control&#34;, The MIT Press. 
     In the case of using a plurality of robots of the same type, there is a large demand such that the data taught to one of the robots is used even for the other robots. However, since the mechanism error ΔP of the robot as mentioned above differs in each robot, the data taught to one robot cannot be directly used for the other robots. Therefore, hitherto, when the teaching data is implanted to the other robots, the complicated adjustments of the positioning points are executed by using a teaching box after the teaching data was implanted. Namely, hitherto, the teaching data cannot be mutually used by the other robots. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a method and apparatus for generating and utilizing teaching data whereby teaching data are commonly usable among a plurality of robots. 
     Another object of the invention is to provide a robot control unit which is able to use another robot&#39;s teaching data without adjusting it manually. 
     The above object is accomplished by presuming the mechanism errors of individual robots and by making standard position information from which the mechanism errors were eliminated as teaching data. 
     Generation of the standard position information from which the mechanism errors were eliminated has the following meanings. That is, the current position of a robot in the robot coordinate system assumes X(P). X denotes the position and orientation of the robot and P represents the mechanism parameter (arm length, attaching angle, etc.). 
     The state of a robot in the space can be represented by six independent data of the position coordinates of the robot hand and the orientation thereof. It is sufficient that the position coordinates are set to three points (x, y, z) in a three-dimensional space. The orientation can be represented by various expressing methods. Typical examples of the expressing methods are shown in FIGS. 5A to 5C. (Refer to the foregoing literature of R. Paul.) 
     The method of FIG. 5A is called a robot hand coordinates system expression. The method of FIG. 5B is called an Eulerian angle expression. The method of FIG. 5C is called a roll pitch yaw expression. In the cases of the Eulerian angle and the roll pitch yaw, three independent data are used. In the case of the robot hand coordinates system, three vectors f, g, and h are used. However, since 
     
         h=f×g 
    
     there is no need to store h. Since f and g between the remaining two vectors f and g (the number of components is six) are the direction cosine, its length is set to 1. That is, ##EQU7## Therefore, since either one of (f x , f y , f z ) or either one of (g x , g y , g z ) is expressed by the other components, it is also unnecessary to store it. 
     For instance, since f z   2  =1-f x   2  -f y   2 , f z  can be omitted. On the other hand, since f and g cross perpendicularly, the inner product is 1. That is, 
     
         f·g=f.sub.x ·g.sub.x +f.sub.y ·g.sub.y +f.sub.z ·g.sub.z =1 
    
     From this equation, another component becomes unnecessary. For example, g y  can be completely expressed by the other components f x , g x  and f y . Therefore, in the case of the robot hand coordinates system, even if there are three vectors (the number of components is 9), the number of independent components among them is still three. For instance, it is sufficient to have the data of only f x , f y  and g x . However, actually, six data of f and g are provided as redundancy data for convenience of the calculations. 
     The current position after the teaching operation is expressed as X(P+ΔP) in the absolute coordinates system in which the installing position of the robot is set to an origin. ΔP denotes an error of the mechanism parameter. 
     The robot coordinates system and absolute coordinates system will now be described. First, absolute coordinates system is the ordinary xyz coordinates system in which the installing position of the robot is set to an origin as mentioned above. Although the definitions of x, y and z differ in dependence on the respective robot manufacturers, they are defined as shown in FIG. 16 in this embodiment. 
     On the other hand, the robot coordinates system relates to a space which is drawn by each articulated angle (in the case of a mechanism having a joint which translates, a translational distance thereof) to control the robot. For instance, in the case of the robot shown in FIG. 4B, the robot coordinates system corresponds to a two-dimensional plane in which θ 1  and θ 2  are set to axes. The points (θ 1 , θ 2 ) (which are equal to X(P)) in the robot coordinates system are set to X(P+ΔP) in the case of the absolute coordinates system. 
     That is, if the current position of a robot is X(P+ΔP) in the absolute coordinates system, the command values to the robot is actually the value X(P) in the robot coordinates system. In other words, the robot moves to the position of X(P+ΔP) due to the mechanism errors when the robot is controlled so as to move to the position of the command value X(P). No problem occurs so long as teaching data is given and executed by using the same robot. However, when the command value (teaching data) X(P) is transferred to the other robot and executed, this robot moves to the position of X(P+ΔP B ) because the mechanism errors ΔP B  differ. Therefore, the standard position information X(P+ΔP) is previously made from the command value X(P) by using the known mechanism errors ΔP and the command value for positioning is made on the basis of the standard position information. Due to this, the teaching data can be efficiently mutually used. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a control unit for a robot to which a teaching data generating method according to an embodiment of the present invention is applied; 
     FIG. 2 is a flowchart showing a procedure of the teaching data generating method according to the embodiment of the invention; 
     FIGS. 3A and 3B are diagrams showing the coordinates systems of robots A and B, respectively; 
     FIGS. 4A and 4B are a diagram showing an example of a biaxial SCARA robot and a diagram showing a coordinates system expression, respectively; 
     FIGS. 5A to 5C are a diagram showing a robot hand coordinates system expression, an explanatory diagram of an Eulerian angle, and an explanatory diagram of a roll pitch yaw, respectively; 
     FIG. 6 is a diagram showing an example of a storage format of teaching points; 
     FIG. 7 is an explanatory diagram of the moving operation among a plurality of points; 
     FIG. 8 is a format diagram of error parameters; 
     FIG. 9 is a flowchart for explaining a method of obtaining the current position of a robot; 
     FIG. 10 is a diagram showing a method of obtaining the current position of a robot whose degree of freedom is two; 
     FIG. 11 is a flowchart for explaining the operating steps of previously calculating a command value with respect to a special robot and storing into a memory; 
     FIG. 12 is a diagram showing a storage format of the command value X(P) and the current position X(P+ΔP); 
     FIG. 13 is a diagram showing a modification of FIG. 12; 
     FIG. 14 is a flowchart for explaining a processing procedure when a mechanism parameter changes; 
     FIG. 15 is a flowchart for explaining the processes in another embodiment according to the invention; and 
     FIG. 16 is an explanatory diagram of the absolute coordinates system. 
    
    
     DETAILED DESCRIPTION OF THE PRESENT INVENTION 
     An embodiment of the present invention will be described hereinbelow with reference to the drawings. 
     FIG. 1 is a block diagram of a control unit for a robot. Reference numeral 1 denotes a robot and 2 indicates a control unit for the robot. The control unit 2 comprises: a servo section 3; an arithmetic operating unit 4; an input/output (I/O) processing section 5; an internal memory 6; and an external memory 7 to store teaching data. A teaching pendant 8 to input the teaching operation, an input apparatus 9 to input commands, and an output apparatus 10 are connected to the control unit 2. Arrows 11 to 21 show flows of information among the respective components and represent a command value 11 to an actuator of the robot from the servo section 3, a status signal 12 of the actuator, a signal 13 indicative of a servo command and a servo status, input/output (I/O) information 14, I/O information 15 to the teaching pendant 8, input information 16 from the input apparatus 9, output information 17 to the output apparatus 10, I/O data 18 and 19 of teaching data from/into the internal memory 6, and I/O data 20 and 21 of the teaching data from/into the external memory 7. 
     The control by the teaching playback of the robot is executed in the following steps. 
     (a) The robot is positioned at a desired position in the space, at a certain orientation, by pressing buttons (for instance, X+ denotes that the robot is moved in the + direction on the x axis but not shown) on the teaching pendant 8. 
     (b) To take in the command values X(P) of the position and orientation, the button to &#34;take in the teaching points&#34; (not shown) on the teaching pendant is pressed. 
     (c) The arithmetic operating unit 4 performs the following operation for those processes. 
     (i) The status 12 of the actuator is taken in (the status includes the data regarding the current position of each actuator). 
     (ii) Each of the articulated angles (θ 1  to θ n  in FIG. 3) of the robot is obtained from the data regarding the current position of each actuator. 
     (iii) The position (x, y, z) and orientation (f, g) of the robot hand are obtained from the respective articulated angles. 
     (iv) The position and orientation data obtained are stored in the external memory 7. At this time, a storage format is as shown in FIG. 6. The orientation can be also expressed as shown in FIG. 5B or 5C without limiting to (f, g). On the other hand, the articulated angles θ 1  to θ n  in the step (ii) may be also together provided (as shown in an example of FIG. 6). Or only the articulated angles can be also stored. Even if those data were stored, they can be mutually converted and they can be said to be all equivalent for purposes of this operation. 
     (d) A plurality of teaching points are set to positioning points and such a playback operation as to connect these points is executed. This operating process has been described in detail, for example, in the fifth chapter, 6th to 9th paragraphs, of the book by R. Paul. 
     FIG. 2 is a flowchart showing a procedure of a teaching data generating method according to the present invention and shows the case where teaching data of the robot B is made from teaching data of the robot A. In this embodiment, the teaching data is made in five steps comprising: a step 22 of estimating the mechanism errors of the robot A; a step 23 of generating teaching data; a step 24 of generating the standard position information; a step 25 of estimating the mechanism errors of the robot B; and a step 26 of generating teaching data of the robot B from the standard position information of the robot A. 
     In the steps 22 and 25 of estimating the mechanism errors, the mechanism errors of the robots are estimated. As a method of obtaining the mechanism errors (also including the installation errors of the robots in more detail) ΔP, the method described in, e.g., Okada et al, U.S. Patent mentioned above can be also used. After the mechanism errors were once obtained, they are not changed so long as the robot is not moved to the other place or struck with obstacles. Therefore, they are stored in the external memory 7 in a format as shown in FIG. 8. The mechanism errors relate to the errors of the parts of the robot and the degree of freedom of the part in the space is six, so that each part has six parameters. Therefore, in the case of the robot whose degree of freedom is n, at most 6n error parameters exist. Further, when the installation errors are also included in those parameters, 6(n+1) parameters exist. 
     In the next step 23, the teaching data is made. This step 23 relates to the teaching operation. In this step, the robot A is moved to a desired position by using the teaching pendant 8, the current position of the robot is obtained from the status 12 including the encoder value from the robot, and the current position obtained is stored into the internal memory 6 or external memory 7. The details of these processes are as mentioned above. 
     The robot A has only the teaching data of the command position X(P). However, the position and orientation at which the operator wants to actually position the robot are the position X(P+ΔP) in the absolute coordinates system. Therefore, in step 24, the position X(P+ΔP) is obtained from the command position X(P) by using the mechanism parameter errors ΔP obtained in step 22. 
     The details of the method are as shown in FIG. 9. 
     In the case of explaining the method as an example in the robot shown in FIG. 4, it is assumed that ##EQU8## 
     (limited to only the errors in the plane) have already been given, and the X(P+ΔP) is derived as shown in FIG. 10 by using the equation (2) and (5). The X(P+ΔP) indicates the actual position of the robot A in the space when it is controlled by using the command values X(P). 
     Consequently, X(P+ΔP) is the position to which the robot B is to be actually moved. The X(P+ΔP) can be said to be the standard position information when the teaching data is mutually used among the robots. 
     In step 26, the teaching data of the robot B is obtained by the standard position information. In order to actually move both of the robots A and B to the same position, the standard position information also corresponds to the values T B  =Y(P+.sub.Δ P B ) (=X(P+ΔP)) of the positioning points of the robot B in the absolute coordinates system (FIG. 3B). ΔP B  indicates the mechanism errors of the robot B. Y denotes a vector indicative of the position and orientation of the robot B. The practical functional form of Y is the same as that of X if the robots A and B have the same mechanism. Y(P) is obtained from the Y(P+ΔP B ) and the robot B is moved by using the Y(P) as the command position. Thus, the robot B can be positioned to the position Y(P+ΔP B ), that is, to the positioning point X(P+ΔP) of the robot A. In this manner, the teaching data can be mutually used. 
     The Y(P) can be obtained from the position Y(P+ΔP B ) to which the robot B is to be moved by performing the arithmetic operations (namely, the process to subtracting the mechanism errors ΔP B ) opposite to those in step 24. 
     In other words, a situation such that the robot moves to the position X(P+ΔP) in spite of the instruction of the command value X(P) means that the mechanism errors ΔP are cancelled and the robot moves to the position X(P) on the basis of the instruction of the command value X(P+ΔP). By use of this meaning, it can be said that the command value to position the robot to the position Y(P) is Y(P+ΔP B ) 
     Since Y(P) is equal to X(P+ΔP), when using the same arithmetic operating equations as those in step 24, the command position D B  can be obtained by 
     
         Y(P)=X(P+ΔP+ΔP.sub.B)                          (6) 
    
     because it is sufficient to eliminate the influence by ΔP B . The right side of the equation (6) can be approximated as follows. ##EQU9## Now, since ##EQU10## this equation can be modified as follows. ##EQU11## By substituting this equation to the equation (7), we have ##EQU12## Since the mechanism errors ΔP and ΔP B  are small, their product is further small. By ignoring this product, X(P+ΔP+ΔP B ) can be also obtained. At this time, ##EQU13## (where X i , P i , ΔP i  are the i-th components of the vectors X, P, and ΔP.) 
     Since each X i  (P) has already been known as shown in the equation (1), ##EQU14## can be calculated. For example, in the case of the robot of FIG. 4A, ##EQU15## 
     Now, θ 1  and θ 2  are obtained from X(P), r 1  and r 2  are constants, and Δr 1 , Δr 2 , Δθ 1 , and Δθ 2  are obtained as the mechanism errors. Therefore, by substituting these values to the equation (8), ##EQU16## Therefore, ##EQU17## where, x&#39; and y&#39; denote x&#39; and y&#39; in FIG. 10. 
     The teaching data D B  obtained in this manner and indicative of the command position for the robot B is stored into the memory 6 or 7 in the same format as that of FIG. 6. This data indicates the command position of the robot B. 
     The Y(P) are previously calculated in correspondence to all of the X(P) of the robot A and stored in the memory. This procedure is shown in FIG. 11. 
     Therefore, in the robot B, by playing back at the command position D B  =Y(P), the robot can be positioned to the positioning point X(P+ΔP) of the robot A. 
     It is also possible to control the robot while calculating the Y(P) upon playback without calculating them at once. 
     For this purpose, the X(P+ΔP) itself is stored into the memory 6 or 7 in the format of FIG. 6, and each time the point data X(P+ΔP) is read out of the memory, the processes in steps 30 to 42 in FIG. 11 are calculated by using the mechanism errors ΔP B . 
     On the other hand, the X(P) and X(P+ΔP) can be also stored in place of the teaching data shown in FIG. 6. 
     This example is shown in FIG. 12. In this case, θ 1  to θ n  in step 32 in FIG. 11 are obtained from the X(P). 
     In addition, since the ΔP have already been stored, only the X(P) can be also stored. This example is shown in FIG. 13. 
     At this time, θ 1  to θ n  in step 32 in FIG. 11 are obtained from the X(P) as shown in step 26 in FIG. 9. The X(P+ΔP) in step 32 in FIG. 11 is obtained by using the ΔP by the same method as FIG. 9. 
     The system of the present invention is not limited to only the mutual use of the teaching data for the other robots but can be also effective even if the mechanism parameters are changed due to some reason (for example, an end-effector was struck or the like). For this purpose, it is sufficient to execute the processes in steps 44 to 50 shown in FIG. 14. 
     In the present system, it will be obviously understood that the robots A and B are not necessarily the same type when considering the processing system. If the equations to obtain the position and orientation of the robot A and the mechanism parameters X A  (P A ) of the robot A and the equations to obtain the position and orientation of the robot B and the mechanism parameters X B  (P B ) of the robot B are known, the invention can be extended by the same method as shown in steps 52 to 62 in FIG. 15. 
     On the other hand, the precision of the approximate expression can be improved by considering the partial differentiation of second or higher order. The following is the equation when considering until the second order. ##EQU18## The equation of X can be calculated without any problem since it is partially differentiable many times. 
     Although the foregoing embodiment has been described as an example with respect to the robots A and B, the invention can be also similarly applied to three or more robots 1 to n. For instance, it will be understood that arbitrary one of a group of robots is set to the foregoing robot A and the other robots are handled as the robots B, so that desired teaching data can be used commonly for each robot. In this case, an arbitrary robot is not necessarily a standard apparatus of the special specifications. As already mentioned above, the teaching data can be also supplied to the robot using the teaching data in any of the online and offline control manners. Particularly, in the case of the online control, the teaching data is supplied from one robot to the other robots by using communication lines or the like due to the parallel connection, ring-shaped connection, or hierarchy connection and each of the other robots is automatically controlled in accordance with the common teaching data. Thus, the teaching operation of the operator becomes unnecessary. 
     According to the present invention, teaching data can be mutually used and there is an advantage such that even in the robot itself, even if the mechanism errors change due to some reason, the old teaching data can be used.