$3D$ coordinates translation

57 Views Asked by At

I have CNC router carrying reflector with it's $X,Y,Z$ coordinates in $mm$ and laser tracker measuring position of reflector with spherical coordinates. I was able to "crack" the math and convert spherical to Cartesian coordinates.

Now I need to translate Laser coordinates to CNC coordinates. The idea is to measure $3$ points on CNC table $(0,0,0)$, $(X_{max}, 0, 0)$ and $(0,Y_{max},0)$ and construct a matrix, that will translate all the other measurements made by laser (to see how exact machine is).

Both coordinate systems are isotropic (same scale in mm) even though is assumed laser measurement is perfect and there may be (ARE) precision errors on CNC machine (due to technology/materials used, gravity, length of axis, construction errors)

CNC axis and laser axis are parallel to each other, but only if laser stands in front of the machine. Ideally we want 3 points based transformation to work even when from practical reasons laser has to be to the left or right of machine (X and Y are then swapped). Axis are aligned, but from my experiments it seems there isaround 0,111deg rotation in Yaxis and -0.0117deg in X axis. This may be due imperfect alignment of laser and machine, or maybe machine error.

I found 2D translation (ignoring Z coordinates, just offsetting them by Z0_laser) which works quite fine, but is not as accurate (up to 1mm difference when compared to Laser manufacturer provided tool using 3 points)

code I found is here: https://gist.github.com/Clanrat/45cbcde78cb04fa12f9fb9caa03997cf

would it be possible to extend it for 3rd dimension, and do I need to start from scratch ? I have a feeling I just need to replace 0 and 1 in matrix with coordinates from 3rd point as well as all the Z dimensions, but I have no clue how to do it.

any help would be appreciated

1

There are 1 best solutions below

0
On

I assume that you have the 3D coordinates of the points corresponding to $(0,0,0),(X,0,0)$ and $(0,Y,0)$, let $P,Px,Py$.

If your system is correctly calibrated, the vectors $PPx$ and $PPy$ should be perfectly orthogonal, and have the same lengths. If not, you should either recalibrate, or adopt a more general transformation model. You will have to use at least 4 calibration points.

Otherwise, compute

$$PP_z=PP_x\times PP_y,$$

and the transformation will consist of the translation vector $P$ and the orthogonal transformation matrix with column vectors $\dfrac{PP_x}{X},\dfrac{PP_y}{Y}$ and $\dfrac{PP_z}{XY}$.