Jump to content

Math behind alignments (vector and matrix)


---
 Share

Recommended Posts

Does anyone know the math behind (base) alignments? They use a matrix and a vector value, but how are these connected? What I need is the X/Y offset of the alignment origin in reference to machine zero.

I can read the matrix and vector data and at first I thought vector alone would do. But there are some alignments rotated by 90 degrees in relation to the CMM system, then the vector seems to be wrong (e.g. X is negative). So I guess I need to rotate it according to the matrix, right? How would I do that?
Link to comment
Share on other sites

This requires extensive knowledge of linear algebra, which, it sounds like you have. The normal vectors of the base alignment can be hard coded into a 3x3 matrix, where the first column is the <a,b,c> normal unit vector of the X axis, the second column of the Y axis, and third column of the Z axis.

To figure out the offset from the mach coordinate system, I imagine you could make a secondary alignment, and in the drop down choose (CMM system) which I believe is the machine coordinate system. Then make a theoretical point at (0,0,0) on that alignment. You can then toggle to the Base Alignment to see what the (x,y,z) coordinates change to.

There's probably a better way, but that's what I came up with off the top of my head.
Link to comment
Share on other sites

Please sign in to view this quote.

Maybe I should have put this in the PCM board.
To claim I have this knowledge would be a lie. But at least I have a vague imagination of what happens here. 😕
When I output the matrix values the system returns a 3x3 array of numbers. But I I'm not even sure what is row and what is column. Maybe there's a function somewhere that will calculate it for me?

I assume the vector is in the order X/Y/Z: 127_4fde491fa54f3d9282414d9c894c7361.jpg
What is row and what is column here? If I multiply it as shown, I don't get reasonable results. 127_18e7aefeb4bf7bfd8bcc9710840cf70f.jpg

Please sign in to view this quote.

Interesting idea! I already made a program to shift all alignments in the CMM system. Maybe I could modify it so it just spits out the offsets.
But first I'd rather try and understand how to do this matrix transformation myself. Because with roughly 1000 alignments to analyze, I think that'd be a bit faster...
Link to comment
Share on other sites

I use the "writeDiffCoordSysToFile" function in PCM quite a bit. This will output a file that contains values for your 3x3 rotation matrix as well as translation for x, y, and z.
In the measurement plan I will create two alignment characteristics. One recalling the machine coordinate system and the other the alignment of choice. For example, using two alignment characteristics named "BASE" and "MCS":
writeDiffCoordSysToFile("BASE", "MCS", "coord_diff.txt")

Now if I want to change my reference frame of any coordinate from BASE to MCS, I use python as follows:

import numpy as np

def get_transformation(filename):
diff = np.genfromtxt(filename)
r = diff[:9].reshape((3,3))
t = diff[9:].reshape((3,1))
return r, t

r, t = get_transformation('coord_diff.txt')
# example point with respect to BASE
point = np.array([28.05, -4.76, 2.36]).reshape((3,1))

# change reference frame to MCS
point_mcs = r@point + t

# change from MCS to BASE
point_base = np.linalg.inv(r)@(point_mcs - t)

# print point value examples
print(f'original point: {point}')
print(f'MCS point: {point_mcs}')
print(f'BASE point: {point_base}')
Link to comment
Share on other sites

 Share

×
×
  • Create New...