Hand-eye calibration how do I use the hand-eye matrix?

Hello, I’m Xiao Zhi. In the last few issues, WE have shared the method of hand-eye calibration. If you are not clear about how to make hand-eye calibration, you can refer to the following article:

Many students have finished the hand-eye calibration after the hand-eye matrix, but do not know how to use it in the program, there are many students do not know the relationship between each coordinate system, today xiaozhi will tell you about the use of the hand-eye matrix.

First, why is the length of the hand-eye matrix different?

After hand-eye calibration, the length of the hand-eye matrix may be different, because there are many ways to express the rotation transformation.

1. Representation of rotation

1.1 Three digits

Euler Angle (is the corner of Euler’s house), Euler Angle and radian system. Usually use English: rx,ry,rz

1.2 Four Numbers

Quaternion, the euler Angle representation of three numbers is actually singular (I’ll talk about rotation later) so quaternion can avoid this problem. Common English symbols for quaternions: qx,qy,qz,qw

Be sure to pay attention to the order of quaternion, qW is the first or the last, small wisdom has suffered a loss.

1.3 Nine-digit

The rotation matrix, which uses nine numbers to represent rotations, is a 3 by 3 square matrix.

2. Hand-eye matrix = translation from end of manipulator arm to camera + rotation from end of manipulator arm to camera

So what is the hand-eye matrix?

What you know is that the translation must be three numbers, and the table is the length of the translation along the original x,y, and z axes.

So the common hand-eye matrix has three forms:

2.1 Euler Angle version

[x,y,z,rx,ry,rz]
Copy the code

2.2 Quaternion edition

[x,y,z,qx,qy,qz,qw]
Copy the code

2.3 Rotation matrix version

[
    [r11,r12,r13,x],
    [r21,r22,r23,y],
    [r31,r32,r33,z]
]
Copy the code

2.4 Homogeneous matrix

To facilitate the operation, we add a row [0,0,0,1] to the rotation matrix version to form the homogeneous matrix, which is also the legendary homogeneous matrix

[[r11, r12, r13, x], [r21, r22, r23, y], [r31, r32, r33, z], [0, 0, 0, 1]]Copy the code

2. What are the algorithms of the hand-eye matrix and what are the corresponding physical meanings?

So we have the hand-eye matrix, so how do we do this?

We only need to do two operations, one called multiplication and one called inverse.

1. The multiplication

Multiplication is just a transformation:

For example, the pose matrix from the end to the camera is represented as Tgc, and the workpiece pose recognized by the camera is Tct, then how to calculate the pose from the end to the workpiece? It’s easy. Multiply them

Tgt = Tgc*Tct
Copy the code

And rest assured, a 4×4 matrix times a 4×4 matrix is still going to be a 4×4 matrix.

2. The inverse

The most amazing thing is to do the inverse operation, and to do the inverse is to actually transpose the coordinate system.

Given the coordinate system Tcm of the marker in the camera, what is the coordinate system Tmc of the camera in the marker?

It’s really simple:

Tmc = Tcm. Inverse () //Copy the code

The inverse matrix is also 4X4, and Tmc*Tcm=I,I is the identity matrix show a wave of linear algebra, back to you recommend a book, about linear algebra, back to linear algebra can obtain ha ~

Three, write their own calculations too troublesome, what good library for matrix operations and coordinate transformation?

C + + recommend

C++ version of course recommended small wisdom of their own computing library, please click the link:

Type base@grapper, grapper@camera, camera@marker and multiply to complete ~

I’m not going to brag about how awesome this library is, but see how smooth the code is

Int main() {/* base@grapper */ Matrix4d Tbg = TransForms::ComposeEuler(-0.544, -0.203,-0.037, 180, 0.00000, 140); /* grapper@camera*/ Matrix4d Tgc = TransForms::ComposeEuler(0.020,-0.040,0.300,0,0,-45); /* camera@marker */ Matrix4d Tcm = TransForms::ComposeEuler(-0.663,-0.193,-0.231,-180,0,140); TransFormsGroup Tbw = Tbg*Tgc*Tcm ; Cout << tw.tostring ()<<endl; }Copy the code

Recommend the Python library

The recommended library for Python is Transforms3D, which is easy to install and use. I’ll explain it in the next installment. Leave a small tail first

Interested partners, welcome to follow the public number: witty person