Abstract:
A system for calibrating a robot having a movable part with a calibration marker including: positioning the calibration marker along an optical line of a camera unit; imaging the calibration marker along the optical line to establish line positions P 1  . . . P N  within a tolerance k, while monitoring joint values j 1  . . . j M  of the robot; establishing an error function based on resulting calculated robot positions P′ 1  . . . P′ N , for the calibration marker for joint values j 1  . . . j M  at each line position P 1  . . . P N  for the calibration marker; identifying a set of robot kinematic parameters by solving an optimization problem based on the error function; and updating a kinematic model of the robot via the identified set of robot kinematic parameters.

Description:
TECHNICAL FIELD 
       [0001]    The present invention relates to techniques for calibrating a robot, and in particular a method for calibrating a robot and a robot system. The invention also relates to a robot controller, a robot unit, use of the robot unit, a program for calibrating a robot and a computer readable medium. 
       BACKGROUND 
       [0002]    For calculating a position for a robot end effector based on robot joint values, a kinematic model of the robot can be used. For high accuracy positioning of the robot, the kinematic parameters of the robot must be precisely identified. The procedure of performing some motion with the robot, measuring an outcome and fitting a calculated outcome to the measured outcome by adjusting the kinematic parameters is known as robot calibration. 
         [0003]    Most commonly an external measurement system is used for calibration. Typically this measurement system is a high precision three dimensional device such as a laser tracker. So called self-calibration methods using constraints have also been proposed. Three dimensional systems are however associated with high costs, and self-calibration systems have limited accuracy as uncertainties from friction will come into play. 
         [0004]    One method that has been proposed for robot calibration is to use a laser pointer and a position sensitive device (PSD). However, a problem with laser pointers and PSDs is that they are normally not used in production. Installing them for the sole purpose of calibration would add cost and complexity to the system. For field calibration, i.e. calibration on site after the robot has been installed, a more simple method is needed. Ideally the calibration should be performed without additional sensors or devices, since any external equipment will be associated with cost and complexity. 
         [0005]    In the case of a vision guided robot, the camera is part of the system. It would thus be desirable to use the camera to calibrate the robot, in case the robot accuracy needs to be improved for the vision guided hand. 
         [0006]    Robot camera calibration has been proposed in literature and tested. By formulating an error function that includes the robot kinematic parameters and the intrinsic and extrinsic camera parameters, the robot and camera parameters can be retrieved by simultaneously optimizing the robot kinematic parameters and camera parameters. 
         [0007]    For example, US2013/0274921A1 describes a robot system including a digital camera, where a movable part of the robot has got a mark attached thereto. The digital camera outputs image data by imaging a range of movements of the mark, and a calibrator creates a transformation parameter for correlating a two dimensional coordinate system of the image data with a three-dimensional coordinate system of the movable part. 
         [0008]    A drawback with this simultaneous optimization of robot and camera parameters is that a plurality of additional camera parameters must be identified at the same time as the robot parameters. This will make the optimization problem harder and limit the final accuracy of the parameters. 
         [0009]    There is thus a need for a simpler and less complex method for identifying the robot parameters. 
       SUMMARY 
       [0010]    According to a first aspect, the object is at least partly achieved by a method for calibrating a robot, wherein the robot comprises a movable part with a calibration marker. The method comprises:
       positioning the calibration marker in a plurality of positions along an optical line of a camera unit;   imaging the calibration marker at the plurality of positions along the optical line to establish line positions P 1  . . . P N  of the calibration marker along the optical line within a tolerance k, while monitoring joint values j 1  . . . j M  of the robot;   establishing an error function based on resulting calculated robot positions P′ 1  . . . P′ N  for the calibration marker for joint values j 1  . . . j M  at each line position P 1  . . . P N  for the calibration marker;   identifying a set of robot kinematic parameters by solving an optimization problem based on the error function; and   updating a kinematic model of the robot by means of the identified set of robot kinematic parameters.       
 
         [0016]    With the method it is possible to separate the identification of the robot parameters from the camera parameters. The camera unit is only used to ascertain that the calibration marker really is positioned along the same optical line, and for that the parameters of the camera do not have to be accurately determined. Kinematic parameters of the robot are identified with high accuracy, since camera errors are eliminated by the proposed method. The optimization problem becomes easier to solve and the accuracy of the final parameters is increased compared to when solving an optimization problem with more unknown parameters, e.g. the camera parameters. The method is easy to implement, which makes it a cheap solution for calibrating the robot. No additional hardware is needed, except the often already existing robot camera. 
         [0017]    Further, other parameters than kinematic parameters of the robot may be determined and thus calibrated. For example, the coordinates of the tool centre point of the calibration marker may be established. 
         [0018]    According to one embodiment, the method comprises positioning the calibration marker with a unique orientation of the robot in at least some of the line positions P 1  . . . P N  of the calibration marker. 
         [0019]    According to one embodiment, the method comprises performing an iterative process to cause the robot to position the calibration marker along the optical line within the tolerance to establish a line position P k  of the calibration marker. It can then be assured that the calibration marker is positioned sufficiently close to the optical line. 
         [0020]    According to one embodiment, the method comprises calculating an error between a position of the calibration marker in an image plane of a camera unit imaging the calibration marker and a position of the optical line in the image plane of the camera unit, compare the error with the tolerance and adjusting the position of the calibration marker based on the result of the comparison in order to establish a line position P k  of the calibration marker. Thus, by using the camera unit the error in position of the robot unit may be established. 
         [0021]    According to one embodiment, the error function is calculating a line fitting the resulting calculated robot positions P′ 1  . . . P′ N  for the calibration marker. By establishing a best fit line of the positions the most optimal kinematic parameters may be determined. The error function may be based on minimizing the distance of the resulting calculated robot positions P′ 1  . . . P′ N  for the calibration marker to the line. 
         [0022]    According to one embodiment, the optimization problem includes minimizing an error of the error function. The most optimal kinematic parameters of the robot may be determined by finding the parameters that gives a solution with the smallest error. 
         [0023]    According to one embodiment, the number N of positions for the calibration marker is at least six, to be able to retrieve accurate kinematic parameters of the robot and to solve the optimization problem. 
         [0024]    According to a second aspect, the object is at least partly achieved by a robot controller configured to execute the method. 
         [0025]    According to a third aspect, the object is at least partly achieved by a robot unit comprising a camera unit, wherein the robot unit is configured to execute the method. 
         [0026]    According to a fourth aspect, the object is at least partly achieved by using a robot unit. 
         [0027]    According to a fifth aspect, the object is at least partly achieved with a computer program, P, in connection with a robot system, where the computer program P comprises computer instructions configured to cause a computer unit to perform the method. 
         [0028]    According to a sixth aspect, the object is at least partly achieved with a computer readable medium storing computer program code for performing the method, when running on a processor associated with a computer unit. 
         [0029]    According to a seventh aspect, the object is at least partly achieved with a robot system. The robot system comprises a robot with a movable part with a calibration marker and a robot controller with a kinematic model of the robot, wherein the robot controller is arranged to control the movable part in a three-dimensional space based on control input. The robot system further comprises a camera unit that is arranged to capture images of the calibration marker on the movable part. The robot system is arranged to:
       position the calibration marker in a plurality of positions along an optical line of the camera unit;   image the calibration marker at the plurality of positions along the optical line to establish line positions P 1  . . . P N  of the calibration marker along the optical line within a tolerance, while monitoring joint values j 1  . . . j M  of the robot;   establish an error function based on resulting calculated robot positions P′ 1  . . . P′ N  for the calibration marker for joint values j 1  . . . j M  at each line position P 1  . . . P N  for the calibration marker;   identify a set of robot kinematic parameters by solving an optimization problem based on the error function; and   update the kinematic model of the robot by means of the identified set of robot kinematic parameters.       
 
         [0035]    Preferred embodiments are set forth in the dependent claims and in the detailed description. 
     
    
     
       DESCRIPTION OF THE DRAWINGS 
         [0036]    Below the invention will be described in detail with reference to the appended figures, of which: 
           [0037]      FIG. 1  shows a dual-arm robot arranged with a camera unit. 
           [0038]      FIG. 2  illustrates how line positions P k  are established. 
           [0039]      FIG. 3  illustrates a line fit to a plurality of resulting calculated positions P′ k    
           [0040]      FIG. 4  shows a flowchart with the method according to one embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0041]      FIG. 1  illustrates an example of a robot system  14 . The robot system  14  comprises a robot  1  defining a robot coordinate system R f  and an object identification unit  2  defining a camera coordinate system C f . The robot  1  is a redundant robot and has seven degrees of freedom. The robot  1  shown in  FIG. 1  is a dual-arm robot with two robot arms  3 , but the invention may be used with all kinds of robots. In particular it is also applicable for articulated arm robots with six degrees of freedom. 
         [0042]    Each robot arm  3  in  FIG. 1  has a plurality of links connected in series. Movement of each of these links may be a translational movement or a rotation around an axis, or a combination. Both of these movement variations give each link a mechanical degree of freedom around or along what in the following will be referred to as a joint. A joint may be actuated by a servo-controlled electrical motor, which is controlled via feedback from the measured motion of the motor. In the following it is referred to a joint value j m  meaning a joint angle of a joint m of the robot  1 . A robot with seven degrees of freedom normally has seven joints; a robot with six degrees of freedom normally has six joints. Each robot arm  3  is also provided with a tool flange  21  defining a tool flange coordinate system T 0   f . An end effector  4  is attached to each tool flange  21 . The relationship between the robot and tool flange coordinate systems R f  and T 0   f  is a known relationship. A robot arm  3  or end effector  4  may be seen as a movable part of the robot  1 . A calibration marker  13  is here attached to each of the end effectors  4 , but may instead be attached to another movable part of the robot, i.e. any other link of the robot  1 . 
         [0043]    The robot  1  and the object identification unit  2  are located at a work station  20 . The robot  1  is configured to perform work at the work station  20 . The robot  1  and the object identification unit  2  may be referred to as a robot unit  24 . 
         [0044]    The robot  1  comprises a robot controller  9  configured to control movement of one or both of the robot arms  3  in a three-dimensional space by means of controlling a plurality of electric motors on the robot arms  3  based on control input. The robot controller  9  comprises a programming unit  10 , e.g. a computer programming unit (CPU), a computer readable storage medium  11  and a drive unit  12 . The robot controller  9  comprises a kinematic model of the robot  1 , e.g. stored in the computer readable storage medium  11 . The kinematic model includes a model of the joints and the links of the robot  1  and their geometric relations. The programming unit  10  is configured to execute a robot program located on the computer readable storage medium  11 , wherein one or both of the robot arms  3  are moved to a plurality of positions. The drive unit  12  is configured to control the electric motors of the robot arm or arms  3  in dependency of the executed robot program. The robot  1  is further configured to measure the pose of the tool flange coordinate system T 0   f  using angular measurement of the joints of the robot  1  and a direct kinematic model of the robot  1 . 
         [0045]    The object identification unit  2  comprises a camera unit  5  and an information processing unit  6 . The camera unit  5  is configured to be directed to the work station  20  of the robot  1 . The information processing unit  6  comprises a programming unit  7 , e.g. a CPU, and a computer readable storage medium  8 . The information processing unit  6  is configured to receive information from the camera unit  5  in the form of an image of one or more objects at the work station  20 . The camera unit  5  is configured to measure u and v values of the object in image coordinates in an image coordinate system IP f  of the image plane  19  ( FIG. 2 ) of the camera unit  5 . The image coordinates can be either raw pixel data or data transformed to a reference frame, for instance by means of a checkerboard, as the calibration method that will be described works well for both kinds of data. The information processing unit  6  is configured to process the image information so that the object is recognized and a position of the object is determined in the camera coordinate system C f  by means of object recognition algorithms. In particular, the camera unit  5  is arranged to capture images of the calibration marker  13  on a movable part of the robot  1 , the end effector  4 . With other words, the object identification unit  2  is configured to measure u and v values of the calibration marker  13  on the end effector  4 . The exact location T f  of the calibration marker  13  on the end effector  4  in relation to the tool flange  21  does not need to be known in advance. Consequently, the calibration marker  13  does not need to be permanently attached on the end effector  4  but it can be attached temporarily for the purpose of calibration, and it can take the form of a removable sticker, a magnet, or the like. In the  FIG. 1 , the calibration marker  13  has the form of an “ABB”-sticker. The calibration marker  13  may however have another appearance. For the purpose of performing the method a certain point of the calibration marker  13  is used. 
         [0046]    Based on the position of the recognized object, the robot  1  is configured to move any or both of the robot arms  3  to the position of the object and perform work on the object, such as picking, welding, painting, assembling, etc. Accordingly, the robot  1  and the object identification unit  2  are co-operating in the work at the work station  20 . 
         [0047]    In order to enable co-operation between camera and robot, the relationship between the robot coordinate system R f  of the robot  1  and the camera coordinate system C f  of the object identification unit  2  has to be known. Therefore, the coordinate systems must be calibrated with each other prior to performing work at the work station  20 . It shall be understood that calibration may comprise correcting one of the robot and the camera coordinate systems R f , C f  with the other of the robot and camera coordinate system R f , C f . 
         [0048]    The robot system  14  further comprises a computer unit  15  with a programming unit  17 , e.g. a CPU, and a computer readable storage medium  16 . The computer readable storage medium  16  may store a computer program P, where the computer program P comprises computer instructions configured to cause the computer unit  15  to perform the calibration method according to any of the steps of the method. The computer instructions can thus be executed by the computer unit  15 , whereby the method will be performed. 
         [0049]    The computer unit  15  is e.g. configured to generate a plurality of poses to which the end effector  4  is to be moved by the robot arm  3 . A pose thus includes both an orientation and a position of the end effector  4 . The computer unit  15  is further configured to move the calibration marker  13  to a plurality of positions along a same optical line of the camera unit  5 . The computer unit  15  is also configured to coordinate the information processing unit  6  and the robot  1 , such that e.g. poses of the robot  1  and measurements made with the information processing unit  6  can be related to each other. Further, the computer unit  15  is configured to make the calculations etc. which will be described in the following. 
         [0050]    The computer readable storage mediums  8 ,  11 ,  16  are here illustrated as independent storage areas, but might all be implemented as one computer readable storage medium. A computer readable storage medium is a non-transitory computer readable storage medium, e.g. a flash memory, a RAM (Random Access Memory) or similar. Further, the programming units  7 ,  10 ,  17  may be implemented as one or several programming units. 
         [0051]    A method will now be described how the robot  1  may be calibrated without the need for simultaneous calibration of the camera unit  5 . Thereafter, when the robot  1  has been calibrated, the camera unit  5  may be calibrated in an easier way than before to enable cooperation between the robot  1  and the camera unit  5 . To explain the method, reference will be made to the  FIGS. 2, 3 and 4 . 
         [0052]    The method includes a data collecting part, where a movable part of the robot  1  with a calibration marker  13  attached thereon is positioned in a plurality of positions. The aim with the measurement part is to retrieve data from the robot  1  that can be used for an optimization. After enough data from the robot  1  has been retrieved, a calculation part follows where calibrated robot parameters such as kinematic parameters of the robot  1  are calculated. 
         [0053]    Before the data collecting part and the calculation part of the method are carried out, a rough camera calibration may be performed to make the camera unit  5  better prepared for iterative searching of an optical line  22  of the camera unit  5 . It is made sure that the object identification unit  2  may locate the calibration marker  13  in an image taken by the camera unit  5  and extract the u, v position of the marker  13 . The u, v position of the marker  13  is for example a corner of the marker  13 . It may also be ensured that a focus and a shutter of the camera unit  5  are set to appropriate values so that the marker  13  can be found in the image for a region used in the calibration. 
         [0054]    The data collecting part and the calculation part will now be described in connection with the flowchart in  FIG. 4 . 
         [0055]    Data Collecting Part 
         [0056]    In the data collecting part, the robot system  14  positions the calibration marker  13  in a plurality of positions along an optical line  22  of the camera unit  5  (A 1 ). The robot system  14  knows the extension of the optical line  22 , which can be any optical line  22  of the camera unit  5 . This optical line  22  may be determined starting from any first positioning of the calibration marker  13  in the field of view of the camera unit  5 . The optical line  22  is thus a straight line extending from the camera unit  5  in the field of view from the camera unit  5 . If something is positioned along the same optical line  22 , it will give the same pixel reading on an image plane  19  of the camera unit  5 . If the robot  1  was not influenced by wear etc, the robot system  14  would always position the calibration marker  13  at the optical line  22  if instructed to do so. But, as the physical links and joints of the robot  1  do not always correspond to the un-calibrated kinematic model of the robot  1 , the calibration marker  13  will be physically offset from the optical line  22 . Therefore, the calibration marker  13  is imaged by the camera unit  5  at the plurality of positions along the optical line  22  to finally establish line positions P 1  . . . P N  of the calibration marker  13  along the optical line  22  within a tolerance. The tolerance may be set by the operator, or automatically by the robot system  14 . The tolerance is one parameter that determines the final accuracy of the calibration. During the positioning, the joint values j 1  . . . j M  of the robot  1  are monitored (A 2 ). “M” is the number of joints of the robot  1 , or at least the number of joints of the robot  1  of interest for the calibration. 
         [0057]    To further explain this, reference is made to  FIG. 2 . In  FIG. 2 , the image plane  19  of the camera unit  5  is illustrated. Every optical line of the camera unit  5  has a unique measurement value along the axes u and v in the coordinate system IP f  of the image plane  19 . The measurement value is typically a pixel value. Each positioning along a same optical line  22  of the camera unit  5  may then be recognized with a unique pixel value. The point  13  denotes the position of the calibration marker  13 . The robot system  14  has, when instructed to do so, tried to position the calibration marker  13  along the optical line  22  according to the robot coordinate system R f . As the robot  1  here is not calibrated, the calibration marker  13  is however placed at a distance d 1  from the optical line  22 , and thus along a different optical line  23 . The calibration marker  13  is imaged in the image plane  19  via a lens  18  in the camera unit  5  and is in the example located a distance d 2  from the optical line  22  in the image plane  19  of the camera unit  5 . d 2  is also referred to as a correction vector. 
         [0058]    An iterative process may now be performed to cause the robot  1  to position the calibration marker  13  along the optical line  22 . For each new position of the calibration marker  13  a correction vector d 2  may be calculated to correctly position the calibration marker  13  on the optical line  22 . The correction vector d 2  has a two dimensional extension along the axes u and v in the image plane  19 . The correction vector d 2  is fed back to the robot controller  9  which re-positions the calibration marker  13  in order to minimize the error. The correction vector d 2  is for this converted to a correction vector in the robot coordinate system R f . The robot  1  is thus corrected in accordance with the correction vector d 2  and this procedure is iterated until the calibration marker  13  is sufficiently close to the optical line  22 . The camera unit  5  may thus take a plurality of images of each unique positioning of the calibration marker  13 . “Sufficiently close” here means within a tolerance. When the calibration marker  13  is positioned along the optical line  22  within a tolerance, the position of the calibration is called a “line position P k ” of the calibration marker  13 . 
         [0059]    For example, the correction vector may be calculated as an error between the position of the calibration marker  13 ′ in the image plane  19  of the camera unit  5  and a position of the optical line  22  in the image plane  19  of the camera unit  5 . The error can be compared with the tolerance, and the position of the calibration marker  13  may be adjusted based on the result of the comparison in order to establish a line position P k  of the calibration marker  13 . If the calibration marker  13 ′ after the adjustment is within the tolerance, a line position P k  (in the  FIG. 2 : P 1 ) is established. If the calibration marker  13 ′ after the adjustment is not within the tolerance, a new correction vector or error is calculated, and the robot  1  re-positions the calibration marker  13  accordingly to reduce or remove the error. 
         [0060]    The robot  1  positions the calibration marker  13  in a plurality of line positions P 1  . . . P N  that are sufficiently close to the optical line  22 . For at least some of the line positions P 1  . . . P N , the robot  1  has a unique orientation. At least some of the line positions P 1  . . . P N  are separated apart along the optical line  22 . The robot configuration, e.g. signs of wrist, elbow or shoulder singularity, may also be varied in each or at least some of the line positions P 1  . . . P N . A robot  1  may reach the same position in a plurality of different configurations. For an articulated robot with six axes, the same position may be reached in typically eight different ways. By moving the robot to the same position using different configurations and using joint values from these different configurations in the calculations, a better calibration of the robot  1  may be achieved. For a redundant robot, e.g. a dual-arm robot, it may also be beneficial to vary the arm angle. The number N of line positions for the calibration marker  13  is according to one embodiment at least six. 
         [0061]    When the calibration marker  13  is in a line position P k  that according to the camera unit  5  is on the intended optical line  22  within a tolerance, a position reading from the robot  1  gives the impression that the calibration marker  13  is in another position P′ k  as the robot  1  is not yet calibrated. These incorrect positions indications of the calibration marker  13  are referred to as resulting calculated robot positions P′ k . The resulting calculated robot positions P′ k  may be expressed in the robot coordinate system R f  of the robot  1 . 
         [0062]    When a line position P k  has been established, the corresponding joint value or values j m  of the robot  1  are read and recorded. Based on joint values j m  and the kinematic model of the robot  1 , the resulting robot positions P′ k  may be calculated. The output from the data collection part is a set of N line positions P k , their corresponding joint values j m , and the resulting calculated robot positions P′ k . For each line position P k , joint values j m  for each joint of the robot  1  are retrieved. Thus, if the number of joints is six, a joint value for each joint, thus six values, may be recorded for each line position P k . These parameters can be saved e.g. in the computer readable storage medium  16  of the computer unit  15 . The programming unit  17  is configured to make the calculations herein described. 
         [0063]    When it is referred to moving the robot  1  to a certain point, position, orientation or pose, it here means to move the tool flange  21  to a certain point, position, orientation or pose. 
         [0064]    Calculation Part 
         [0065]    Once a sufficient set of measurements along the optical line  22  has been produced, an error function e for the robot  1  is established (A 3 ). The error function calculates a principal line  25  based on the resulting calculated robot positions P′ k  and a distance for each individual position P′ k  to the principal line  25 . In  FIG. 3 , an example of a principle line  25  that is fitting the resulting calculated robot positions P′ 1  . . . P′ N  for the calibration marker  13  is shown. Below it is explained how the principal line  25  fitting the resulting calculated robot positions P′ 1 , . . . P′ N  may be calculated, and how an error function e may be established. 
         [0066]    A line in three dimensional space can be described as follows: 
         [0000]        P   0   +tv   (1)
 
         [0000]    where P 0 =[x 0 ,y 0 ,z 0 ] is a point on the line, v=[α, β, γ] is the direction vector of the line and t is a scalar number. For any point P n =[x n , y n , z n ], a distance d to the line described by equation (1) may be calculated as: 
         [0000]    
       
         
           
             
               
                 
                   
                     d 
                     = 
                     
                       
                          
                         
                           v 
                           × 
                           
                             P 
                             0 
                           
                            
                           
                             P 
                             n 
                           
                         
                          
                       
                       
                          
                         V 
                          
                       
                     
                   
                    
                   
                     
 
                   
                    
                   where 
                    
                   
                     
 
                   
                    
                   
                     
                       
                         P 
                         0 
                       
                        
                       
                         P 
                         n 
                       
                     
                     = 
                     
                       
                         P 
                         n 
                       
                       - 
                       
                         
                           P 
                           0 
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
         [0067]    For a set of resulting calculated robot positions or points P′ 1  . . . P′ N  known to lie along a line given by P 0  and v we can thus calculate an error function e=e 1 , e 2 , . . . , e n  where 
         [0000]    
       
         
           
             
               
                 
                   
                     e 
                     k 
                   
                   = 
                   
                     
                        
                       
                         v 
                         × 
                         
                           P 
                           0 
                         
                          
                         
                           P 
                           k 
                         
                       
                        
                     
                     
                        
                       V 
                        
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0068]    The distance d k  for each resulting calculated robot position P′ k  to the principal line  25  may thus be seen as an error e k . As an alternative, averages of groups of errors may be established. 
         [0069]    To identify robot kinematic parameters that are calibrated, an optimization problem is solved based on the error function (A 4 ). The total error of the error function e shall be minimized to find an optimal principal line  25  that fits the resulting calculated robot positions P′ k . To do this, an error function is formed as follows: 
         [0000]        f ( j ,φ)= e   (4)
 
         [0070]    where f is a direct kinematic model, j are the joint values for each resulting calculated robot position P′ k  and φ represent the unknown kinematic parameters of the robot  1 . The unknown kinematic parameters may be represented by the Denavit-Hartenberg parameters, which are known to the skilled person in the art. φ may also include the unknown tool center point T tcp  and φ may then be referred to as internal parameters of the robot  1 . According to one embodiment, N number of equations f is established. 
         [0071]    The error may be minimized using non-linear least squares optimization. For instance a Gauss Newton method is used to minimize the error function (4), which may be done by calculating a Jacobian: 
         [0000]    
       
         
           
             
               
                 
                   
                     J 
                     ij 
                   
                   = 
                   
                     
                       ∂ 
                       
                         e 
                         i 
                       
                     
                     
                       ∂ 
                       
                         ϕ 
                         j 
                       
                     
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
           
         
       
     
         [0072]    The optimization may then be done by updating an initial guess of the kinematic parameters, φ 0  according to: 
         [0000]      φ n+1 =φ n −( J   T   J ) −1   Jf ( j ,φ)  (6)
 
         [0073]    The iteration is repeated until convergence is achieved. 
         [0074]    The result of the optimization is a set of robot kinematic parameters φ k,k=1 . . . n . The kinematic model of the robot  1  is then updated by means of the robot kinematic parameters φ k,k=1 . . . n  (A 5 ). The method may e.g. be used to calibrate joint offsets of a robot  1 . 
         [0075]    The method may be executed automatically by the robot  1 , for example initiated by an operator via a robot user interface. 
         [0076]    The present invention is not limited to the above-described preferred embodiments. Various alternatives, modifications and equivalents may be used. Therefore, the above embodiments should not be taken as limiting the scope of the invention, which is defined by the appending claims.