Coordinate transformation matrix calculation method, device, equipment and readable storage medium
By establishing a coordinate conversion equation containing the rotation matrix and the translation vector, the optimization objective function aims at the minimum calibration error, and solves the problem of degradation of the translation vector accuracy caused by the accumulation of rotation matrix errors in the machine vision algorithm package, achieving higher calculation accuracy and Intuitive.
Patent Information
- Application Number
- CN202111399322.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-19
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-11-19
AI Technical Summary
When calculating the coordinate transformation matrix, the accumulation of calibration errors of the rotation matrix leads to a decrease in the calculation accuracy of the translation vector, and the algorithm loses its intuitiveness and comprehensibility.
By establishing a coordinate conversion equation containing the rotation matrix and translation vector, the optimization objective function aims at the minimum calibration error, and using an iterative algorithm to calculate the rotation matrix and translation vector, ensuring that the calibration error of the rotation matrix does not accumulate into the translation vector calculation, enhancing the calculation process intuitive and understandable.
It improves the accuracy of coordinate conversion matrix calculation and the intuitiveness of the algorithm, avoids the accumulation of rotation matrix errors, simplifies the calculation process, reduces the complexity, and speeds up the calculation speed.
Smart Images

Figure CN114186190B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and readable storage medium for calculating a coordinate transformation matrix. Background Art
[0002] Guiding the robot arm to perform automated operations through guidance sensors such as vision can effectively replace manual repetitive, heavy, high-intensity, and high-risk operations. In addition, mechanical operations have higher and more consistent quality control, so it has great application potential in smart manufacturing industries such as 3C electronics and automobiles. One of the prerequisites for the robot arm to perform automated operations according to the preset program is to determine the relative posture between the robot arm, (vision, etc.) guidance sensors, work positions, and work objects. In practical applications, this prerequisite is achieved by measuring the feature points of (vision, etc.) guidance sensors, work positions, and work objects, and using calibration algorithms to calculate the coordinate transformation matrices of the guidance sensors, work positions, and work objects. The coordinate transformation matrix includes the rotation matrix R and the translation vector t.
[0003] At present, the coordinate transformation matrix is generally calculated through a complete set of standard machine vision algorithm packages (such as halcon machine vision software). The machine vision algorithm package essentially converts the calibration problem into a mathematical problem of AX=XB, and then uses algorithms such as Tsai-Lenz to solve the rotation matrix and translation vector in the coordinate transformation matrix in sequence. However, in this method of solving the rotation matrix and translation vector step by step, the calibration error of the rotation matrix will accumulate in the calculation of the translation vector, resulting in a decrease in the calculation accuracy of the translation vector; and because the machine vision algorithm package converts the calibration problem into a pure mathematical problem for solution, the algorithm loses its intuitiveness and understandability. Summary of the invention
[0004] In view of this, in order to solve at least one of the above problems, an embodiment of the present invention provides a method, an apparatus, a device and a readable storage medium for calculating a coordinate transformation matrix.
[0005] According to the first aspect, an embodiment of the present invention provides a method for calculating a coordinate transformation matrix, including: obtaining first coordinate data of a feature point of a target object in a reference coordinate system and second coordinate data in a coordinate system to be calibrated; establishing a coordinate transformation equation based on the first coordinate data and the second coordinate data, the coordinate transformation equation including a rotation matrix and a translation vector; the rotation matrix includes a rotation angle to be optimized, and the translation vector includes a translation parameter to be optimized; establishing an objective function with a minimum calibration error as an optimization target based on the coordinate transformation equation; iteratively calculating the objective function based on an initial value of the rotation angle to be optimized, an initial value of the translation parameter to be optimized, and an initial value of the iteration parameter until an iteration termination condition is met, and obtaining a first updated value of the rotation angle to be optimized and a second updated value of the translation parameter to be optimized; calculating the rotation matrix based on the first updated value of the rotation angle to be optimized, and calculating the translation vector based on the second updated value of the translation parameter to be optimized, to obtain a coordinate transformation matrix.
[0006] Optionally, before establishing the coordinate transformation equation according to the first coordinate data and the second coordinate data, the method for calculating the coordinate transformation matrix further includes: normalizing the first coordinate data and the second coordinate data.
[0007] Optionally, the objective function is iteratively calculated according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter until the iteration termination condition is met, including: calculating the partial derivative of the objective function according to the initial value of the rotation angle to be optimized and the initial value of the translation parameter to be optimized; calculating the iteration increment according to the partial derivative and the initial value of the iteration parameter; calculating the iteration effect index according to the iteration increment; updating the rotation angle to be optimized, the translation parameter to be optimized and the iteration parameter according to the iteration effect index and the iteration increment, and returning the partial derivative calculation of the objective function according to the updated rotation angle to be optimized and the translation parameter to be optimized until the iteration termination condition is met.
[0008] Optionally, the rotation angle to be optimized, the translation parameters to be optimized and the iteration parameters are updated according to the iteration effect index and the iteration increment, including: when it is determined that the iteration effect index meets the preset conditions, the rotation angle to be optimized and the translation parameters to be optimized are updated according to the iteration increment, and the iteration parameters are updated according to the iteration effect index.
[0009] Optionally, the coordinate transformation matrix calculation method further includes: when it is determined that the iteration effect index does not meet the preset conditions, keeping the values of the rotation angle to be optimized and the translation parameter to be optimized unchanged, and updating the iteration parameters.
[0010] Optionally, calculating the iterative increment according to the partial derivatives and the initial values of the iterative parameters includes: calculating the iterative increment using the partial derivatives and the initial values of the iterative parameters through a ridge regression algorithm.
[0011] Optionally, the step of determining whether an iteration satisfies an iteration termination condition includes: determining that the iteration satisfies an iteration termination condition when the number of iterations reaches a preset number threshold; or, determining that a calibration error is less than an optimization index threshold; or, determining that an iteration increment is less than an iteration step threshold.
[0012] According to the second aspect, an embodiment of the present invention provides a coordinate transformation matrix calculation device, including: an acquisition unit, used to acquire first coordinate data of a feature point of a target object in a reference coordinate system and second coordinate data in a coordinate system to be calibrated; a first establishment unit, used to establish a coordinate transformation equation based on the first coordinate data and the second coordinate data, the coordinate transformation equation including a rotation matrix and a translation vector; the rotation matrix includes a rotation angle to be optimized, and the translation vector includes a translation parameter to be optimized; a second establishment unit, used to establish an objective function with a minimum calibration error as an optimization target according to the coordinate transformation equation; a first calculation unit, used to iteratively calculate the objective function according to an initial value of the rotation angle to be optimized, an initial value of the translation parameter to be optimized, and an initial value of the iteration parameter until an iteration termination condition is met, to obtain a first updated value of the rotation angle to be optimized, and a second updated value of the translation parameter to be optimized; a second calculation unit, used to calculate the rotation matrix according to the first updated value of the rotation angle to be optimized, and calculate the translation vector according to the second updated value of the translation parameter to be optimized, to obtain a coordinate transformation matrix.
[0013] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes a method for calculating a coordinate transformation matrix as in the first aspect or any embodiment of the first aspect.
[0014] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute a method for calculating a coordinate transformation matrix as in the first aspect or any method of the first aspect.
[0015] The coordinate transformation matrix calculation method, device, equipment and readable storage medium provided in the embodiments of the present invention convert the problem of solving the coordinate transformation matrix of the target object into the problem of solving the coordinate transformation equation. Since the coordinate transformation equation includes the rotation matrix and the translation vector, the established coordinate transformation equation has a definite physical meaning, so that the problem of solving the coordinate transformation matrix is no longer a pure mathematical problem, thereby enhancing the intuitiveness and comprehensibility of the coordinate transformation matrix calculation process; and by converting the problem of solving the coordinate transformation equation into an optimization problem, the objective function is solved by an iterative algorithm, and the rotation matrix and the translation vector can be calculated at the same time, so that the calibration error of the rotation matrix will not be accumulated in the calculation of the translation vector, and the calculation accuracy of the translation vector will not decrease; and in the calculation process of the coordinate transformation matrix, the rotation angle is used to characterize the rotation matrix, which can eliminate redundant variables, simplify the calculation process, reduce the complexity of the calculation, and speed up the algorithm calculation speed.
[0016] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of a flow chart of a method for calculating a coordinate transformation matrix in an embodiment of the present invention;
[0018] Figure 2 Schematic diagram of the structure of a coordinate conversion matrix calculation device in an embodiment of the present invention;
[0019] Figure 3 The figure is a schematic diagram of the hardware structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0021] The embodiment of the present invention provides a method for calculating a coordinate transformation matrix, which can be applied to the calculation of the relative posture of a robot arm, a visual guidance sensor, a work position, a work object, etc. in a robot arm automated operation. Figure 1 As shown, the method includes:
[0022] S101. Obtain first coordinate data of a feature point of a target object in a reference coordinate system and second coordinate data in a coordinate system to be calibrated.
[0023] In this embodiment, the target object can be any one of a robot arm, a visual guidance sensor, a work position, and a work object. The coordinate data of the feature points of the target object in the reference coordinate system (hereinafter referred to as FR) and the coordinate system to be calibrated (hereinafter referred to as FC) are: Among them, N is the number of feature points, is the coordinate vector of feature point i in the FR coordinate system, is the coordinate vector of feature point i in the FC coordinate system.
[0024] S102. Establish a coordinate transformation equation according to the first coordinate data and the second coordinate data, the coordinate transformation equation including a rotation matrix and a translation vector; the rotation matrix includes a rotation angle to be optimized, and the translation vector includes a translation parameter to be optimized.
[0025] In this embodiment, the first coordinate data and the second coordinate data need to be calibrated to obtain a coordinate transformation matrix between the reference coordinate system and the coordinate system to be calibrated. The coordinate transformation equation includes a rotation matrix R and a translation vector t. When calibrating, since the second coordinate data can be obtained by rotating and translating the first coordinate data, the following coordinate transformation equation can be established:
[0026]
[0027] In the formula, the rotation matrix R∈R 3×3 , translation vector t∈R 3×1 .
[0028] The coordinate transformation matrix (R and t) is parameterized and expressed as the parameter to be optimized α = (α 0 α 1 α 2 α 3 α 4 α 5 ) T (The rotation angle α to be optimized 0 ,α 1 ,α 2 and the translation parameter α to be optimized 3 ,α 4 ,α 5 )’s mapping R(α) and t(α):
[0029]
[0030] t=(α 3 α 4 α 5 )T .
[0031] In this embodiment, when a parameter model is established for the rotation matrix R, the orthogonalization constraint is satisfied, so that after the rotation matrix is calculated using the parameter model, it is not necessary to perform orthogonalization again.
[0032] S103. Establish an objective function with minimum calibration error as the optimization target according to the coordinate transformation equation.
[0033] In this embodiment, after the coordinate transformation equation is established, the coordinate transformation equation needs to be solved. In this embodiment, the calibration error can be minimized as the optimization goal, and the calibration problem can be transformed into the following optimization problem:
[0034]
[0035] in, It is the second coordinate data of the feature point in the FC coordinate system.
[0036] It is the nominal coordinate of the feature point of the target object in the FC coordinate, which is calculated by the coordinate transformation matrix to be calibrated (rotation matrix R and translation matrix t) and the first coordinate data of the feature point in the FR coordinate. The optimization target S represents the Euclidean distance error between the nominal feature point and the second coordinate data introduced by the coordinate transformation matrix to be calibrated (R and t).
[0037] S104. Perform iterative calculation on the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter until the iteration termination condition is met, thereby obtaining a first updated value of the rotation angle to be optimized and a second updated value of the translation parameter to be optimized.
[0038] In this embodiment, the optimization problem can be solved by an iterative algorithm. During iteration, it is necessary to set the initial value of the parameter to be optimized α, including the initial value of the rotation angle to be optimized and the initial value of the translation parameter to be optimized. It is also necessary to set the initial value of the iteration parameter μ.
[0039] During iteration, it is necessary to calculate the iteration increment, iteration effect index, and calculated value of optimization target for each iteration. After each iteration, it is necessary to update the optimization parameters and iteration parameters for the next iteration.
[0040] In an optional embodiment, the step of determining whether an iteration satisfies an iteration termination condition includes: determining that the iteration satisfies the iteration termination condition when the number of iterations reaches a preset number threshold; or, determining that a calibration error is less than an optimization index threshold; or, determining that an iteration increment is less than an iteration step threshold.
[0041] The iteration termination conditions include: 1) the number of iterations exceeds the limit;
[0042] 2) S 0 , S is the optimization target, S 0 is the optimization indicator threshold;
[0043] 3) Δα<Δα 0 , Δα 0 is the iteration step threshold; Δα is the iteration increment, that is, the iteration step.
[0044] As long as any one of the conditions is met, the iteration is terminated. When the iteration is terminated, the first updated value of the rotation angle to be optimized and the second updated value of the translation parameter to be optimized can be obtained.
[0045] S105. Calculate a rotation matrix according to the first updated value of the rotation angle to be optimized, and calculate a translation vector according to the second updated value of the translation parameter to be optimized, to obtain a coordinate transformation matrix.
[0046] In this embodiment, the first updated value of the rotation angle to be optimized and the second updated value of the translation parameter to be optimized are substituted into the calculation formula of R(α) and t(α), and R and t can be calculated to obtain the coordinate transformation matrix. Through simulation calculation, the rotation angle α to be optimized is simulated in the measurement error scenario with a white noise with an amplitude of 0.05. 0 ,α 1 ,α 2 The calculation error is between -0.01 and 0.01 degrees, and the translation parameter α needs to be optimized. 3 ,α 4 ,α 5 The calculation error is between -0.01mm and 0.1mm, and the accuracy of the coordinate transformation matrix is between -0.04 and 0.04. It can be seen that the calculation accuracy of the calculated rotation angle to be optimized and the translation parameter to be optimized meets the requirements, and the coordinate transformation matrix is calculated accurately.
[0047] The coordinate transformation matrix calculation method provided by the embodiment of the present invention converts the problem of solving the coordinate transformation matrix of the target object into the problem of solving the coordinate transformation equation. Since the coordinate transformation equation includes the rotation matrix and the translation vector, the established coordinate transformation equation has a definite physical meaning, so that the problem of solving the coordinate transformation matrix is no longer a pure mathematical problem, thereby enhancing the intuitiveness and comprehensibility of the coordinate transformation matrix calculation process; and by converting the problem of solving the coordinate transformation equation into an optimization problem, the objective function is solved by an iterative algorithm, and the rotation matrix and the translation vector can be calculated at the same time, so that the calibration error of the rotation matrix will not be accumulated in the calculation of the translation vector, and the calculation accuracy of the translation vector will not decrease; and in the calculation process of the coordinate transformation matrix, the rotation angle is used to characterize the rotation matrix, which can eliminate redundant variables, simplify the calculation process, reduce the complexity of the calculation, and speed up the algorithm calculation speed.
[0048] In an optional embodiment, in step S102, before establishing a coordinate transformation equation according to the first coordinate data and the second coordinate data, the method for calculating the coordinate transformation matrix further includes: normalizing the first coordinate data and the second coordinate data.
[0049] Specifically, the first coordinate data and the second coordinate data can be normalized by the following formula:
[0050]
[0051]
[0052] Among them, max is the maximum value processing, scalar is the maximum value of the first coordinate data and the second coordinate data, for The corresponding normalized data is for The corresponding normalized data.
[0053] In this embodiment, the first coordinate data and the second coordinate data are normalized, thereby eliminating the problem of algorithm parameter heterogeneity caused by inconsistent target object sizes, simplifying the algorithm usage method, and broadening the applicability of the algorithm.
[0054] In an optional embodiment, step S104, iteratively calculates the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter until the iteration termination condition is met, including: calculating the partial derivative of the objective function according to the initial value of the rotation angle to be optimized and the initial value of the translation parameter to be optimized; calculating the iteration increment according to the partial derivative and the initial value of the iteration parameter; calculating the iteration effect index according to the iteration increment; updating the rotation angle to be optimized, the translation parameter to be optimized and the iteration parameter according to the iteration effect index and the iteration increment, and returning to calculate the partial derivative of the objective function according to the updated rotation angle to be optimized and the translation parameter to be optimized until the iteration termination condition is met.
[0055] Specifically, the optimization problem can be solved by an iterative algorithm. The specific calculation steps are as follows:
[0056] Step 1: You can set the initial value of the parameter to be optimized to α k , the initial value of the iteration parameter μ is μ k (First iteration, k=0,).
[0057] Step 2: The partial derivative (Jacobi matrix J) can be calculated for the optimization target S of the optimization problem. The calculation process is as follows:
[0058]
[0059] Among them, the sub-Jacobi matrix J corresponding to each feature point i for:
[0060]
[0061] That is, it consists of a rotation part and a translation part. The coordinate vector of feature point i in the FR coordinate system is Then the calculation result of the rotation part in the sub-Jacobi matrix is:
[0062]
[0063] Among them, r 1 、r 2 and r 3 is the coordinate axis.
[0064] Therefore, the sub-Jacobi matrix corresponding to the feature point i is obtained as follows:
[0065]
[0066] Where I is the identity matrix.
[0067] Step 3: Calculation of iterative increment Δα:
[0068] In an optional implementation, calculating the iteration increment based on the partial derivatives and the initial values of the iteration parameters includes: calculating the iteration increment using the partial derivatives and the initial values of the iteration parameters through a ridge regression algorithm.
[0069] but
[0070] Step 4: Calculation of iteration effect index ρ:
[0071]
[0072] Step 5: Iteration increment determination: update the initial values of the parameters to be optimized and the iteration parameters according to the results of the iterative increment determination.
[0073] If |ρ|<ρ 0 , then α k+1 =α k -Δα, ρ 0 is the effect indicator threshold, α k+1 is α k The updated value of μ k+1 μ k The updated value of k+1 =α k ,μ k+1 =2μ k .
[0074] Step 6: Return to step 2 and continue with the next iteration until the iteration termination condition is met.
[0075] Iteration termination conditions include: 1) the number of iterations exceeds the limit;
[0076] 2) S 0 , S 0 is the optimization indicator threshold;
[0077] 3) Δα<Δα 0 , Δα 0 is the iteration step threshold;
[0078] As long as any of the three conditions is met, the iteration terminates.
[0079] In this embodiment, when the iterative algorithm is used to solve the optimization problem, a diagonal real matrix μI with sufficiently small diagonal elements is added to the calculation of the iterative increment. This ensures that the rotation angles to be optimized are reversible and solves problems such as singular coefficient matrix caused by coplanarity of feature points.
[0080] In an optional embodiment, the rotation angle to be optimized, the translation parameter to be optimized, and the iteration parameter are updated according to the iteration effect index and the iteration increment, including: when it is determined that the iteration effect index meets the preset conditions, the rotation angle to be optimized and the translation parameter to be optimized are updated according to the iteration increment, and the iteration parameter is updated according to the iteration effect index. When it is determined that the iteration effect index does not meet the preset conditions, the values of the rotation angle to be optimized and the translation parameter to be optimized are kept unchanged, and the iteration parameter is updated.
[0081] Specifically, we can set if |ρ|<ρ 0 , then a k+1 =a k -Δα, Otherwise k+1 =a k ,μ k+1 =2μ k In this embodiment, when the iterative parameter is updated, μ k+1 =2μ k The update is performed as an example, and is not limited to this in other embodiments or other scenarios.
[0082] In an embodiment of the present invention, when it is determined that the iteration effect index meets the preset conditions, the parameters to be optimized are updated according to the iteration increment, and the iteration parameters are updated according to the iteration effect index; when it is determined that the iteration effect index does not meet the preset conditions, the values of the parameters to be optimized are kept unchanged, and the iteration parameters are updated; thereby, different updating methods of iteration variables are executed under different iteration effect indicators, making the algorithm more accurate.
[0083] The embodiment of the present invention also provides a coordinate transformation matrix calculation device, which can be applied to the calculation of the relative posture of the robot arm, the visual guidance sensor, the operation position, the operation object, etc. in the robot arm automation operation, such as Figure 2 As shown, the device comprises:
[0084] The acquisition unit 21 is used to acquire the first coordinate data of the feature point of the target object in the reference coordinate system and the second coordinate data in the coordinate system to be calibrated; the specific implementation method is detailed in the description of step S101 of the above method embodiment, which will not be repeated here.
[0085] The first establishing unit 22 is used to establish a coordinate transformation equation according to the first coordinate data and the second coordinate data. The coordinate transformation equation includes a rotation matrix and a translation vector. The rotation matrix includes a rotation angle to be optimized, and the translation vector includes a translation parameter to be optimized. The specific implementation method is described in detail in step S102 of the above method embodiment, which will not be repeated here.
[0086] The second establishing unit 23 is used to establish an objective function with the minimum calibration error as the optimization target according to the coordinate transformation equation; the specific implementation method is detailed in the description of step S103 of the above method embodiment, which will not be repeated here.
[0087] The first calculation unit 24 is used to iteratively calculate the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter until the iteration termination condition is met, thereby obtaining a first updated value of the rotation angle to be optimized and a second updated value of the translation parameter to be optimized; the specific implementation method is detailed in the description of step S104 of the above method embodiment, which will not be repeated here.
[0088] The second calculation unit 25 is used to calculate the rotation matrix according to the first updated value of the rotation angle to be optimized, and calculate the translation vector according to the second updated value of the translation parameter to be optimized, so as to obtain the coordinate transformation matrix. The specific implementation method is described in step S105 of the above method embodiment, which will not be repeated here.
[0089] The coordinate transformation matrix calculation device provided by the embodiment of the present invention converts the problem of solving the coordinate transformation matrix of the target object into the problem of solving the coordinate transformation equation. Since the coordinate transformation equation includes the rotation matrix and the translation vector, the established coordinate transformation equation has a definite physical meaning, so that the problem of solving the coordinate transformation matrix is no longer a pure mathematical problem, which enhances the intuitiveness and comprehensibility of the coordinate transformation matrix calculation process; and by converting the problem of solving the coordinate transformation equation into an optimization problem, the objective function is solved by an iterative algorithm, and the rotation matrix and the translation vector can be calculated at the same time, so that the calibration error of the rotation matrix will not be accumulated in the calculation of the translation vector, and the calculation accuracy of the translation vector will not decrease; and in the calculation process of the coordinate transformation matrix, the rotation angle is used to characterize the rotation matrix, which can eliminate redundant variables, simplify the calculation process, reduce the complexity of the calculation, and speed up the algorithm calculation speed.
[0090] Based on the same inventive concept as the method for calculating a coordinate transformation matrix in the aforementioned embodiment, an embodiment of the present invention further provides an electronic device, such as Figure 3 As shown, it includes: a processor 31 and a memory 32, wherein the processor 31 and the memory 32 can be connected via a bus or other means. Figure 3 The bus connection is used as an example for explanation.
[0091] The processor 31 may be a central processing unit (CPU). The processor 31 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0092] The memory 32 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method for calculating the coordinate transformation matrix in the embodiment of the present invention. The processor 31 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory 32, that is, implements the method for calculating the coordinate transformation matrix in the above method embodiment.
[0093] The memory 32 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created by the processor 31, etc. In addition, the memory 32 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 32 may optionally include a memory remotely arranged relative to the processor 31, and these remote memories may be connected to the processor 31 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0094] The above one or more modules are stored in the memory 32, and when executed by the processor 31, the following is performed: Figure 1 The calculation method of the coordinate transformation matrix in the illustrated embodiment.
[0095] For details of the above electronic equipment, please refer to Figure 1 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.
[0096] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0097] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0098] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable information processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable information processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0099] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0100] These computer program instructions can also be loaded onto a computer or other programmable information processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0101] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for calculating a coordinate transformation matrix, which is applied to the calculation of the relative posture of a robot arm, a visual guidance sensor, a work position, and a work object in a robot arm automation operation, characterized in that: include: Acquire first coordinate data of a feature point of a target object in a reference coordinate system and second coordinate data in a coordinate system to be calibrated; The target object is any one of the vision guidance sensor, the working position, and the working object; Establishing a coordinate conversion equation according to the first coordinate data and the second coordinate data, wherein the coordinate conversion equation includes a rotation matrix and a translation vector; the rotation matrix includes a rotation angle to be optimized, and the translation vector includes a translation parameter to be optimized; Establishing an objective function with minimum calibration error as optimization target according to the coordinate transformation equation; Iteratively calculate the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter, until the iteration termination condition is met, and obtain the first updated value of the rotation angle to be optimized and the second updated value of the translation parameter to be optimized; iteratively calculate the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter, until the iteration termination condition is met, including: calculating the partial derivative of the objective function according to the initial value of the rotation angle to be optimized and the initial value of the translation parameter to be optimized; calculating the iteration increment according to the partial derivative and the initial value of the iteration parameter; calculating the iteration effect index according to the iteration increment; updating the rotation angle to be optimized, the translation parameter to be optimized, and the iteration parameter according to the iteration effect index and the iteration increment, and returning the partial derivative calculation of the objective function according to the updated rotation angle to be optimized and the translation parameter to be optimized, until the iteration termination condition is met; The rotation matrix is calculated according to the first updated value of the rotation angle to be optimized, and the translation vector is calculated according to the second updated value of the translation parameter to be optimized to obtain the coordinate transformation matrix of the target object, so as to calculate the relative posture of the target object and the robotic arm based on the coordinate transformation matrix.
2. The method for calculating the coordinate transformation matrix according to claim 1, characterized in that: Before establishing a coordinate conversion equation according to the first coordinate data and the second coordinate data, the method further includes: The first coordinate data and the second coordinate data are normalized.
3. The method for calculating the coordinate transformation matrix according to claim 1, characterized in that: The updating of the rotation angle to be optimized, the translation parameter to be optimized and the iteration parameter according to the iteration effect index and the iteration increment includes: When it is determined that the iteration effect index satisfies a preset condition, the rotation angle to be optimized and the translation parameter to be optimized are updated according to the iteration increment, and the iteration parameter is updated according to the iteration effect index.
4. The method for calculating the coordinate transformation matrix according to claim 3, characterized in that: Also includes: When it is determined that the iteration effect index does not meet the preset condition, the values of the rotation angle to be optimized and the translation parameter to be optimized are kept unchanged, and the iteration parameter is updated.
5. The method for calculating the coordinate transformation matrix according to claim 1, characterized in that: Calculating an iterative increment according to the partial derivative and the initial value of the iterative parameter includes: The iterative increment is calculated by the ridge regression algorithm using the partial derivative and the initial value of the iterative parameter.
6. The method for calculating the coordinate transformation matrix according to claim 1, characterized in that: The steps of determining whether an iteration satisfies the iteration termination condition include: When it is determined that the number of iterations reaches a preset number threshold; or, In the case where it is determined that the calibration error is less than the optimization index threshold; or, When it is determined that the iteration increment is less than the iteration step threshold, it is determined that the iteration meets the iteration termination condition.
7. A coordinate transformation matrix calculation device, used in the calculation of the relative posture of a robot arm, a visual guidance sensor, a work position, and a work object in a robot arm automation operation, characterized in that: include: An acquisition unit, used to acquire first coordinate data of a feature point of a target object in a reference coordinate system and second coordinate data in a coordinate system to be calibrated; The target object is any one of the vision guidance sensor, the working position, and the working object; A first establishing unit, configured to establish a coordinate transformation equation according to the first coordinate data and the second coordinate data, wherein the coordinate transformation equation includes a rotation matrix and a translation vector; the rotation matrix includes a rotation angle to be optimized, and the translation vector includes a translation parameter to be optimized; A second establishing unit is used to establish an objective function with a minimum calibration error as an optimization target according to the coordinate transformation equation; A first calculation unit is used to iteratively calculate the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter until the iteration termination condition is met, and obtain the first updated value of the rotation angle to be optimized and the second updated value of the translation parameter to be optimized; the iterative calculation of the objective function according to the initial value of the rotation angle to be optimized, the initial value of the translation parameter to be optimized, and the initial value of the iteration parameter until the iteration termination condition is met, including: calculating the partial derivative of the objective function according to the initial value of the rotation angle to be optimized and the initial value of the translation parameter to be optimized; calculating the iteration increment according to the partial derivative and the initial value of the iteration parameter; calculating the iteration effect index according to the iteration increment; updating the rotation angle to be optimized, the translation parameter to be optimized, and the iteration parameter according to the iteration effect index and the iteration increment, and returning the partial derivative calculation of the objective function according to the updated rotation angle to be optimized and the translation parameter to be optimized, until the iteration termination condition is met; The second calculation unit is used to calculate the rotation matrix according to the first updated value of the rotation angle to be optimized, calculate the translation vector according to the second updated value of the translation parameter to be optimized, and obtain the coordinate transformation matrix of the target object, so as to calculate the relative position and posture of the target object and the robotic arm based on the coordinate transformation matrix.
8. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the method for calculating the coordinate transformation matrix as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the coordinate transformation matrix calculation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Image detection device and method of engine crankshaft journal shape errors
CN104089586A
Point set affine transformation algorithm in visual positioning
CN110428457A