Coordinate transformation matrix calculation method, device, equipment and readable storage medium
By establishing and orthogonizing the coordinate conversion equation sets, calculating the coordinate conversion matrix of the robotic arm, visual guidance sensor and work objects, the problem of the coordinate conversion matrix losing orthogonality and algorithm complexity in the existing technology is solved, and the accuracy is achieved coordinate transformation and position calculation.
Patent Information
- Application Number
- CN202111399313.5
- 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
In the prior art, when calculating the coordinate conversion matrix of robotic arms, visual guidance sensors and work objects, the rotation matrix loses orthogonality due to system errors and measurement noise, resulting in an increase in coordinate transformation distortion and position calculation errors, and the algorithm complexity high.
By obtaining the coordinate data of the characteristic points of the target object in the reference coordinate system and the coordinate system to be calibrated, establishing a coordinate conversion equation group, calculating the rotation matrix and orthogonizing it, obtaining an accurate rotation matrix and translation vector, thereby determining the coordinate conversion Matrix, avoiding the impact of measurement noise and system errors.
Accurate coordinate conversion matrix calculation is realized, coordinate transformation distortion is avoided, and the accuracy of position calculation and algorithm simplification is improved.
Smart Images

Figure CN114186189B_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 a robotic arm to perform automated operations using guidance sensors such as vision can effectively replace manual labor in repetitive, heavy, high-intensity, and high-risk tasks. Furthermore, robotic operations offer higher and more consistent quality control, and therefore have great potential for application in intelligent manufacturing industries such as 3C electronics and automobiles. One of the prerequisites for a robotic arm to perform automated operations according to a preset program is the need to determine the relative positions of the robotic arm, guidance sensors (such as vision), the work position, and the work object. In practical applications, this prerequisite is achieved by measuring the feature points of the guidance sensors (such as vision), the work position, and the work object, and using a calibration algorithm to calculate the coordinate transformation matrices of the guidance sensors, the work position, and the work object. The coordinate transformation matrix includes the rotation matrix R and the translation vector t.
[0003] Currently, coordinate transformation matrices are typically calculated using machine vision software such as Halcon. Halcon machine vision software essentially transforms the calibration problem into the mathematical equation AX = XB. It then uses algorithms such as Tsai-Lenz to sequentially solve the rotation matrix and translation vectors in the coordinate transformation matrix. However, the presence of systematic errors and measurement noise causes the calculated rotation matrix to lose orthogonality, resulting in coordinate transformation distortion and increased pose calculation errors. Furthermore, the algorithm's representation of the rotation axis angle introduces variable redundancy, introduces nonlinear constraints, and increases the complexity of the equation solution. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, apparatus, device, and readable storage medium for calculating a coordinate transformation matrix.
[0005] According to a 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 group of the reference coordinate system and the coordinate system to be calibrated based on the first coordinate data and the second coordinate data, the coordinate transformation equation group including a first rotation matrix and a translation vector to be calibrated; calculating the first rotation matrix based on the coordinate transformation equation group; orthogonalizing the first rotation matrix to obtain a second rotation matrix; calculating the translation vector based on the second rotation matrix and the coordinate transformation equation group; and determining the coordinate transformation matrix based on the calculated second rotation matrix and translation vector.
[0006] Optionally, calculating the first rotation matrix according to the coordinate transformation equation group includes: performing differential calculations on two adjacent equation groups to obtain multiple differential equations; merging the multiple differential equations to obtain a first equation; and performing pseudo-inverse calculations on the first equation to obtain a first rotation matrix.
[0007] Optionally, the first rotation matrix is orthogonalized to obtain a second rotation matrix, including: establishing an objective function with minimum matrix orthogonal error as the orthogonalization optimization target based on the first rotation matrix; the objective function includes the second rotation matrix, and the second rotation matrix includes the rotation angle to be optimized; iteratively calculating the objective function based on the initial value of the rotation angle 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 calculating the second rotation matrix based on the first updated value of the rotation angle to be optimized.
[0008] Optionally, the objective function is iteratively calculated based on the initial value of the rotation angle 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 based on the initial value of the rotation angle to be optimized; calculating the iteration increment based on the partial derivative and the initial value of the iteration parameter; calculating the iteration effect index based on the iteration increment; updating the rotation angle to be optimized and the iteration parameter based on the iteration effect index and the iteration increment, and returning the partial derivative calculation of the objective function based on the updated rotation angle to be optimized until the iteration termination condition is met.
[0009] Optionally, the rotation angle 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 is updated according to the iteration increment, and the iteration parameters are updated according to the iteration effect index.
[0010] Optionally, the coordinate transformation matrix calculation method further includes: when it is determined that the iteration effect index does not meet a preset condition, keeping the value of the rotation angle to be optimized unchanged and updating the iteration parameter.
[0011] 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.
[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 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; an establishment unit, used to establish a coordinate transformation equation group of the reference coordinate system and the coordinate system to be calibrated based on the first coordinate data and the second coordinate data, the coordinate transformation equation group including a first rotation matrix and a translation vector to be calibrated; a first calculation unit, used to calculate the first rotation matrix based on the coordinate transformation equation group; a processing unit, used to orthogonalize the first rotation matrix to obtain a second rotation matrix; a second calculation unit, used to calculate the translation vector based on the second rotation matrix and the coordinate transformation equation group; a determination unit, used to determine the coordinate transformation matrix based on the calculated second rotation matrix and translation vector.
[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 the method for calculating the coordinate transformation matrix as in the first aspect or any embodiment of the first aspect.
[0014] According to the 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 the coordinate transformation matrix calculation method as in the first aspect or any embodiment of the first aspect.
[0015] The coordinate conversion matrix calculation method, device, equipment and readable storage medium provided by the embodiments of the present invention obtain 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; establish a coordinate conversion equation group of the reference coordinate system and the coordinate system to be calibrated based on the first coordinate data and the second coordinate data, and the coordinate conversion equation group includes the first rotation matrix and the translation vector to be calibrated; calculate the first rotation matrix according to the coordinate conversion equation group; orthogonalize the first rotation matrix to obtain the second rotation matrix; calculate the translation vector based on the second rotation matrix and the coordinate conversion equation group; determine the coordinate conversion matrix based on the calculated second rotation matrix and the translation vector; thereby calculating the translation vector from the second rotation matrix obtained after the orthogonalization process and determining the coordinate conversion matrix, which can avoid the loss of orthogonality of the coordinate conversion matrix due to measurement noise and system errors of the first coordinate data and the second coordinate data, and can obtain an accurate coordinate conversion matrix, so that when the coordinates are transformed by the coordinate conversion matrix, no distortion will occur, and the posture calculation is accurate.
[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 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 transformation matrix calculation device according to 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] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 making any creative efforts shall fall 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 robotic arm, a visual guidance sensor, a working position, a working object, etc. in a robotic arm automated operation, such as 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 robotic 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 abbreviated as FR) and the coordinate system to be calibrated (hereinafter abbreviated 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 group of the reference coordinate system and the coordinate system to be calibrated according to the first coordinate data and the second coordinate data. The coordinate transformation equation group includes a first rotation matrix and a translation vector to be calibrated.
[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 group includes a first rotation matrix and translation vector t. During calibration, since the second coordinate data can be obtained by rotating and translating the first coordinate data, the following coordinate transformation equations can be established:
[0026]
[0027] In the formula, the first rotation matrix Translation vector t∈R 3×1 .
[0028] In this embodiment, by converting 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 precise physical meaning, so that the problem of solving the coordinate transformation matrix is no longer a purely mathematical problem, thereby enhancing the intuitiveness and comprehensibility of the coordinate transformation matrix calculation process.
[0029] S103. Calculate the first rotation matrix according to the coordinate transformation equation group.
[0030] In this embodiment, due to is the measured data, which is known, so according to By solving the coordinate transformation equations, the first rotation matrix can be calculated.
[0031] S104. Perform orthogonalization on the first rotation matrix to obtain a second rotation matrix.
[0032] Because measurement noise exists in the first and second coordinate data, the first rotation matrix obtained may not meet the requirements of a unit orthogonal matrix. Therefore, in this embodiment, the first rotation matrix needs to be orthogonalized. The second rotation matrix obtained after orthogonalization meets the requirements of a unit orthogonal matrix.
[0033] S105. Calculate the translation vector based on the second rotation matrix and the coordinate transformation equation group.
[0034] In this embodiment, the coordinate transformation equations are transformed to obtain the translation vector Substituting the second rotation matrix as the first rotation matrix into the translation vector calculation formula, the translation vector t can be calculated. Since the second rotation matrix meets the requirements of a unit orthogonal matrix, the translation vector calculated by the translation vector calculation formula eliminates the relative position distortion of the coordinate transformation.
[0035] S106. Determine a coordinate transformation matrix based on the calculated second rotation matrix and translation vector.
[0036] In this embodiment, since the second rotation matrix meets the requirement of a unit orthogonal matrix, the coordinate transformation matrix determined by the second rotation matrix and the translation vector eliminates the distortion phenomenon caused by the coordinate transformation.
[0037] The coordinate conversion matrix calculation method provided by the embodiment of the present invention obtains 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; establishes a coordinate conversion equation group of the reference coordinate system and the coordinate system to be calibrated according to the first coordinate data and the second coordinate data, and the coordinate conversion equation group includes the first rotation matrix and the translation vector to be calibrated; calculates the first rotation matrix according to the coordinate conversion equation group; orthogonalizes the first rotation matrix to obtain the second rotation matrix; calculates the translation vector according to the second rotation matrix and the coordinate conversion equation group; determines the coordinate conversion matrix according to the calculated second rotation matrix and the translation vector; thereby calculating the translation vector from the second rotation matrix obtained after the orthogonalization process and determining the coordinate conversion matrix, which can avoid the situation where the coordinate conversion matrix loses orthogonality due to measurement noise and system errors of the first coordinate data and the second coordinate data, and can obtain an accurate coordinate conversion matrix, so that when the coordinates are transformed by the coordinate conversion matrix, no distortion will occur, and the posture calculation is accurate.
[0038] In an optional embodiment, step S103, calculating the first rotation matrix based on the coordinate transformation equation group, includes: performing differential calculations on two adjacent equation groups to obtain multiple differential equations; merging the multiple differential equations to obtain a first equation; and performing pseudo-inverse calculations on the first equation to obtain a first rotation matrix.
[0039] Specifically, we can sort out the coordinate transformation equations based on the invariance of translation:
[0040]
[0041] For N sets of measurement data, we can get N-1 differential equations. Combining these N-1 differential equations, we can get the first equation:
[0042]
[0043] definition When the feature points are not coplanar, the pseudo-inverse calculation can be obtained: Thus the first rotation matrix is calculated.
[0044] In this embodiment, the first rotation matrix is calculated by using the difference principle, thereby eliminating the systematic measurement error of the measurement data, making the calculated first rotation matrix more accurate.
[0045] In an optional embodiment, in step S104, orthogonalizing the first rotation matrix to obtain a second rotation matrix includes: establishing an objective function with the minimum matrix orthogonal error as the orthogonalization optimization objective according to the first rotation matrix; the objective function includes the second rotation matrix, and the second rotation matrix includes the rotation angle to be optimized; performing iterative calculation on the objective function according to the initial value of the rotation angle to be optimized and the initial value of the iteration parameter until the iteration termination condition is satisfied, to obtain the first updated value of the rotation angle to be optimized; calculating the second rotation matrix according to the first updated value of the rotation angle to be optimized.
[0046] Specifically, the orthogonalization problem can be transformed into an unconstrained extreme value problem, and an objective function with the minimum value of the matrix orthogonal error as the optimization objective is established. Then the expression of the objective function is:
[0047]
[0048] where \(R(\alpha)\) is the second rotation matrix, \(tr\) is a function that takes the values on the diagonal of the matrix, and \(S\) is the optimization objective, referring to the matrix orthogonal error.
[0049]
[0050] \(\alpha = (\alpha_0\ \alpha_1\ \alpha_2)\) T is the rotation angle to be optimized corresponding to the second rotation matrix and is also the parameter to be optimized of the optimization objective.
[0051] In this embodiment, the optimization problem can be solved by an iterative algorithm. When iterating, it is necessary to set the initial value of the rotation angle \(\alpha\) to be optimized, and it is also necessary to set the initial value of the iteration parameter \(\mu\).
[0052] When iterating, it is necessary to calculate the iteration increment, the iteration effect index, and the calculated value of the optimization objective for each iteration. After each iteration, it is necessary to update the parameter to be optimized and the iteration parameter for the next iteration.
[0053] In an optional implementation manner, the step of determining that the iteration satisfies the iteration termination condition includes: when it is determined that the iteration count reaches the preset count threshold; or, when 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 satisfies the iteration termination condition.
[0054] Then the iteration termination conditions include: 1) The iteration count exceeds the limit;
[0055] 2) \(S < S_0\), where \(S\) is the optimization objective and \(S_0\) is the optimization index threshold;
[0056] 3) Δα<Δα0, Δα0 is the iteration step threshold; Δα is the iteration increment, that is, the iteration step.
[0057] The iteration terminates as long as any of the conditions are met. At the end of the iteration, the first updated value of the rotation angle to be optimized is obtained. Substituting the first updated value of the rotation angle to be optimized into the calculation formula for R(α) yields the second rotation matrix.
[0058] In this embodiment, during the orthogonalization process of the first rotation matrix, the rotation angle is selected as the optimization parameter, which can eliminate the constraints in the orthogonalization process and reduce the computational complexity of the algorithm.
[0059] In an optional embodiment, the objective function is iteratively calculated based on the initial value of the rotation angle 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 based on the initial value of the rotation angle to be optimized; calculating the iteration increment based on the partial derivative and the initial value of the iteration parameter; calculating the iteration effect index based on the iteration increment; updating the rotation angle to be optimized and the iteration parameter based on the iteration effect index and the iteration increment, and returning to calculate the partial derivative of the objective function based on the updated rotation angle to be optimized until the iteration termination condition is met.
[0060] Specifically, the optimization problem can be solved by an iterative algorithm. The specific calculation steps are as follows:
[0061] Step 1: You can set the initial value of the rotation angle α to be optimized to α k , the initial value of the iteration parameter μ is μ k (First iteration, k=0,).
[0062] 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:
[0063]
[0064] Step 3: Calculation of iterative increment Δα:
[0065] In an optional embodiment, calculating the iterative increment based on 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.
[0066] but
[0067] Step 4: Calculation of the iteration effect index ρ:
[0068]
[0069] Step 5: Iterative increment determination and update of the initial values of the rotation angle to be optimized and the iterative parameters according to the results of the iterative increment determination.
[0070] If |ρ| < ρ0, then α k+1 = α k - Δα, where ρ0 is the threshold of the effect index, α k+1 is the updated value of α k , and μ k+1 is the updated value of μ k ; otherwise, α k+1 = α k , μ k+1 = 2μ k .
[0071] Step 6: Return to Step 2 and continue the next iteration until the iteration termination condition is met.
[0072] The iteration termination conditions include: 1) The number of iterations exceeds the limit;
[0073] 2) S < S0, where S0 is the threshold of the optimization index;
[0074] 3) Δα < Δα0, where Δα0 is the threshold of the iteration step size;
[0075] As long as any one of the three conditions is met, the iteration terminates.
[0076] In this embodiment, when solving the solution of the optimization problem by the iterative algorithm, a diagonal real matrix μI with sufficiently small diagonal elements is added to the calculation of the iterative increment, which can ensure that the rotation angles to be optimized are definitely invertible and can solve problems such as the singularity of the coefficient matrix caused by coplanarity of feature points.
[0077] In an optional embodiment, the rotation angle to be optimized and the iterative parameters are updated according to the iterative effect index and the iterative increment, including: when it is determined that the iterative effect index meets the preset condition, the rotation angle to be optimized is updated according to the iterative increment, and the iterative parameters are updated according to the iterative effect index. When it is determined that the iterative effect index does not meet the preset condition, the value of the rotation angle to be optimized remains unchanged, and the iterative parameters are updated.
[0078] Specifically, it can be set that if |ρ| < ρ0, then a k+1 = a k - Δα, otherwise a k+1 = a k , μ k+1 = 2μ k , and in this embodiment, when updating the iterative parameters, it is based on μ k+1 = 2μk The update is performed as an example, and is not limited to this in other embodiments or other scenarios.
[0079] In an embodiment of the present invention, when it is determined that the iteration effect index meets the preset conditions, the rotation angle to be optimized is 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 value of the rotation angle to be optimized is 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.
[0080] The embodiment of the present invention also provides a coordinate transformation matrix calculation device, such as Figure 2 Shown, including:
[0081] 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 described in step S101 of the above method embodiment and will not be repeated here.
[0082] Establishing unit 22, used to establish a coordinate transformation equation group of the reference coordinate system and the coordinate system to be calibrated based on the first coordinate data and the second coordinate data, the coordinate transformation equation group includes the first rotation matrix and translation vector to be calibrated; the specific implementation method is detailed in the description of step S102 of the above method embodiment, which will not be repeated here.
[0083] The first calculation unit 23 is used to calculate the first rotation matrix according to the coordinate transformation equation group. The specific implementation method is described in the description of step S103 of the above method embodiment, which will not be repeated here.
[0084] The processing unit 24 is configured to perform orthogonalization processing on the first rotation matrix to obtain a second rotation matrix. The specific implementation method is described in the description of step S104 of the above method embodiment and will not be repeated here.
[0085] The second calculation unit 25 is used to calculate the translation vector according to the second rotation matrix and the coordinate transformation equation group; the specific implementation method is detailed in the description of step S105 of the above method embodiment, which will not be repeated here.
[0086] The determination unit 26 is configured to determine a coordinate transformation matrix based on the calculated second rotation matrix and translation vector. Specific implementations are described in the description of step S106 of the above method embodiment, which will not be repeated here.
[0087] The coordinate conversion matrix calculation device provided by the embodiment of the present invention obtains 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; establishes a coordinate conversion equation group of the reference coordinate system and the coordinate system to be calibrated according to the first coordinate data and the second coordinate data, and the coordinate conversion equation group includes the first rotation matrix and the translation vector to be calibrated; calculates the first rotation matrix according to the coordinate conversion equation group; orthogonalizes the first rotation matrix to obtain the second rotation matrix; calculates the translation vector according to the second rotation matrix and the coordinate conversion equation group; determines the coordinate conversion matrix according to the calculated second rotation matrix and the translation vector; thereby calculating the translation vector from the second rotation matrix obtained after the orthogonalization process and determining the coordinate conversion matrix, which can avoid the situation where the coordinate conversion matrix loses orthogonality due to measurement noise and system errors of the first coordinate data and the second coordinate data, and can obtain an accurate coordinate conversion matrix, so that when the coordinates are transformed by the coordinate conversion matrix, no distortion will occur, and the posture calculation is accurate.
[0088] 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.
[0089] 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.
[0090] Memory 32, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the program instructions / modules corresponding to the coordinate transformation matrix calculation method in the embodiments of the present invention. Processor 31 executes the non-transitory software programs, instructions, and modules stored in memory 32 to perform various processor functions and data processing, thereby implementing the coordinate transformation matrix calculation method in the above-mentioned method embodiment.
[0091] 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 application programs 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 device. In some embodiments, the memory 32 may optionally include a memory remotely located 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.
[0092] The above one or more modules are stored in the memory 32, and when executed by the processor 31, the execution is as follows: Figure 1 The calculation method of the coordinate transformation matrix in the illustrated embodiment.
[0093] For details of the above electronic equipment, please refer to Figure 1 The corresponding descriptions and effects in the embodiments shown can be understood and will not be repeated here.
[0094] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a magnetic 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). The storage medium can also include a combination of the above-mentioned types of memory.
[0095] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, 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 magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0096] 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 flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, 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 produce 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 flowcharts and / or block diagrams. 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.
[0097] 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 an article of manufacture including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0098] These computer program instructions can also be loaded onto a computer or other programmable information processing device so that a series of operating 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.
[0099] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
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 automated 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 operation position, and the operation object; Establishing a coordinate transformation equation group of a reference coordinate system and a coordinate system to be calibrated according to the first coordinate data and the second coordinate data, wherein the coordinate transformation equation group includes a first rotation matrix and a translation vector to be calibrated; Calculating the first rotation matrix according to the coordinate transformation equation group includes: performing differential calculations on two adjacent equation groups to obtain a plurality of differential equations; merging the plurality of differential equations to obtain a first equation; performing pseudo-inverse calculations on the first equation to obtain the first rotation matrix; Orthogonalizing the first rotation matrix to obtain a second rotation matrix includes: establishing an objective function with a minimum matrix orthogonal error as an orthogonalization optimization objective according to the first rotation matrix; the objective function includes a second rotation matrix, and the second rotation matrix includes a rotation angle to be optimized; iteratively calculating the objective function according to an initial value of the rotation angle to be optimized and an initial value of an iteration parameter until an iteration termination condition is met, thereby obtaining a first updated value of the rotation angle to be optimized; and calculating the second rotation matrix according to the first updated value of the rotation angle to be optimized; Calculate the translation vector according to the second rotation matrix and the coordinate transformation equation group; A coordinate transformation matrix of the target object is determined according to the calculated second rotation matrix and the translation vector, so as to calculate a relative position and 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: The iterative calculation of the objective function according to the initial value of the rotation angle to be optimized and the initial value of the iteration parameter until the iteration termination condition is met includes: Calculating a partial derivative of the objective function according to the initial value of the rotation angle to be optimized; Calculating an iterative increment according to the partial derivative and an initial value of an iterative parameter; Calculate an iteration effect indicator according to the iteration increment; The rotation angle to be optimized and the iteration parameter are updated according to the iteration effect index and the iteration increment, and the partial derivative calculation of the objective function is performed according to the updated rotation angle to be optimized until the iteration termination condition is met.
3. The method for calculating the coordinate transformation matrix according to claim 2, characterized in that: The updating of the rotation angle 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 is 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 value of the rotation angle to be optimized is kept unchanged, and the iteration parameter is updated.
5. The method for calculating the coordinate transformation matrix according to claim 2, 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. 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 automated 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 operation position, and the operation object; An establishing unit, used for establishing a coordinate transformation equation group of a reference coordinate system and a coordinate system to be calibrated according to the first coordinate data and the second coordinate data, wherein the coordinate transformation equation group includes a first rotation matrix and a translation vector to be calibrated; A first calculation unit is used to calculate the first rotation matrix according to the coordinate transformation equation group, including: performing difference calculation on the equation groups adjacent to each other to obtain a plurality of difference equations; merging the plurality of difference equations to obtain a first equation; performing pseudo-inverse calculation on the first equation to obtain the first rotation matrix; A processing unit, used for orthogonalizing the first rotation matrix to obtain a second rotation matrix, including: establishing an objective function with a minimum matrix orthogonal error as an orthogonalization optimization objective according to the first rotation matrix; the objective function includes a second rotation matrix, and the second rotation matrix includes a rotation angle to be optimized; iteratively calculating the objective function according to an initial value of the rotation angle to be optimized and an initial value of an iteration parameter until an iteration termination condition is met, thereby obtaining a first updated value of the rotation angle to be optimized; and calculating the second rotation matrix according to the first updated value of the rotation angle to be optimized; A second calculation unit, used for calculating the translation vector according to the second rotation matrix and the coordinate transformation equation group; A determination unit is used to determine a coordinate transformation matrix of the target object according to the calculated second rotation matrix and the translation vector, so as to calculate a relative position and posture of the target object and the robotic arm based on the coordinate transformation matrix.
7. 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-5.
8. 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 5.
Citation Information
Patent Citations
Mechanical arm real-time tracking method based on binocular vision guidance
CN112132894A
Coordinate conversion relation acquisition method and device, electronic equipment and storage medium
CN112837391A