Hi Erik-
Here is a sequence of commands in the pdl2 shell that
show how you can read the data from your coordinates files
and generate the A matrix as in your URL link:
# read in these columns into piddles
pdl> ($circle,$xp,$xi,$yp,$yi,) = rcols('cmm.txt',0,1,2,4,5);
# generate the A matrix from colum data, the sequence shows
# how the data ordering and dimensions are rearranged.
pdl> p cat(-$yi,$xi,pdl(1),pdl(0),$xi,$yi,pdl(0),pdl(1));
pdl> p cat(-$yi,$xi,pdl(1),pdl(0),$xi,$yi,pdl(0),pdl(1))->mv(0,1);
pdl> p
cat(-$yi,$xi,pdl(1),pdl(0),$xi,$yi,pdl(0),pdl(1))->mv(0,1)->splitdim(0,4);
pdl> p
cat(-$yi,$xi,pdl(1),pdl(0),$xi,$yi,pdl(0),pdl(1))->mv(0,1)->splitdim(0,4)->clump(1,2);
pdl> $A =
cat(-$yi,$xi,pdl(1),pdl(0),$xi,$yi,pdl(0),pdl(1))->mv(0,1)->splitdim(0,4)->clump(1,2);
pdl> p $A
[
[ -56.986366 -0.00536711 1 0]
[-0.00536711 56.986366 0 1]
[ -58.030087 0.01315322 1 0]
[ 0.01315322 58.030087 0 1]
[ -59.001671 0.00179112 1 0]
[ 0.00179112 59.001671 0 1]
[ -59.998104 0.02253121 1 0]
[ 0.02253121 59.998104 0 1]
[ -61.004448 0.00609248 1 0]
[ 0.00609248 61.004448 0 1]
[ -61.990383 0.01154447 1 0]
[ 0.01154447 61.990383 0 1]
[ -62.993629 0.00199315 1 0]
[ 0.00199315 62.993629 0 1]
[ -63.989956 0.02241261 1 0]
[ 0.02241261 63.989956 0 1]
[ -65.007301 0.00174078 1 0]
[ 0.00174078 65.007301 0 1]
[ -65.987686 0.01188208 1 0]
[ 0.01188208 65.987686 0 1]
[ -67.993156 -0.00039018 1 0]
[-0.00039018 67.993156 0 1]
[ -69.007614 0.0049898 1 0]
[ 0.0049898 69.007614 0 1]
]
I hope that gets you started. You should take a look at the PDL Book
which goes into more details about using and working with PDL:
http://pdl.perl.org/?page=FirstSteps
Looking at the problem, I would consider combining the measurements
for each circle to estimate the coordinates of the hole centers and
using those reduced set of positions for your alignment calculation.
Also, you may wish to verify that the least squares estimates for the
sin and cos of the rotation have sin*sin + cos*cos = 1.
Cheers,
Chris
On 4/9/2017 15:03, butchert erik wrote:
Sorry for using too large attachments with the previous copy of my
message.
Erik Butchert
---------- Original Message ----------
From: butchert erik <[email protected]>
To: [email protected]
Date: 09 April 2017 at 17:51
Subject: RE: [Pdl-general] 2d rigid transformation
Hi
Perhaps I can explain my issue better if I send you a copy of part
of one of the text files I get from the co-ordinate measuring
instrument (attached). The rows are the data for each hole in a test
piece for assessing XY accuracy of a drilling machine.
Column 1 is the hole number
2 is the X program position
3 is the X measured position
4 is the X error
5, 6 and 7 are the same but for the Y axis
You can ignore the rest for the purposes of this exercise.
The problem is that when the test piece is aligned to the measuring
machine it uses 2 drilled holes that have the same programmed X (or
Y) position to establish a line parallel to the instrument axis, but
of course there’s nothing magical about these “datum” holes they are
as inaccurate as any other hole, this skews the panel against the CMM
axes so the measured positions become more inaccurate as the distance
from the constructed origin increases. What I am trying to get to is
to calculate the best fit of the measured values to the programmed
ones, and therefor the X,Y positions with the alignment error
removed. If you examine the Xerror v Yerror plot in the pdf you will
see instead of being round it is elongated in the Y axis,as typically
the test piece is longer in the Y than in the X so I wonder how much
of this is rotational error.
I can see references to the problem such as
https://elonen.iki.fi/code/misc-notes/2d-rigid-fit/
but haven’t found anything similar within Perl/PDL
BTW I use PDL’s extracted from the measurement files and GnuPlot to
show very useful interactive plots so to be able to build the
alignment correction within the existing Perl script would be a good
step forward.
Erik
0 0.0 -0.00536711 -0.00536711 56.99943542 56.98636627
-0.01306915 0.24359523 -0.00640477 25.09.2012 11:15 0.25
Kreis
1 0.0 0.01315322 0.01315322 57.99942398 58.03008652
0.03066254 0.24359523 -0.00640477 25.09.2012 11:15 0.25
Kreis
2 0.0 0.00179112 0.00179112 58.99941635 59.00167084
0.00225449 0.242 -0.008 25.09.2012 11:15 0.25 Kreis
3 0.0 0.02253121 0.02253121 59.99940491 59.9981041
-0.00130081 0.23300414 -0.01699586 25.09.2012 11:15 0.25
Kreis
4 0.0 0.00609248 0.00609248 60.99939728 61.00444794
0.00505066 0.24359523 -0.00640477 25.09.2012 11:15 0.25
Kreis
5 0.0 0.01154447 0.01154447 61.99938583 61.99038315
-0.00900269 0.23300414 -0.01699586 25.09.2012 11:15 0.25
Kreis
6 0.0 0.00199315 0.00199315 62.9993782 62.99362946
-0.00574875 0.24359523 -0.00640477 25.09.2012 11:15 0.25
Kreis
7 0.0 0.02241261 0.02241261 63.99936676 63.9899559
-0.00941086 0.23300414 -0.01699586 25.09.2012 11:15 0.25
Kreis
8 0.0 0.00174078 0.00174078 64.99935913 65.00730133
0.0079422 0.242 -0.008 25.09.2012 11:15 0.25 Kreis
9 0.0 0.01188208 0.01188208 65.99934387 65.98768616
-0.01165771 0.242 -0.008 25.09.2012 11:15 0.25 Kreis
10 0.0 -0.00039018 -0.00039018 67.99932861 67.99315643
-0.00617218 0.24359523 -0.00640477 25.09.2012 11:15 0.25
Kreis
11 0.0 0.0049898 0.0049898 68.99931335 69.00761414
0.00830078 0.24359523 -0.00640477 25.09.2012 11:15 0.25
Kreis
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general