Reference coordinate system: hardware
Deck and plates should share scaling
Where store?
Scale-Translate table:
$\begin{array}{r|rrr} \textbf{coord} & \bf{(A,S,T)_x} & \bf{(A,S,T)_y} & \bf{(A,S,T)_z} \\ \hline \text{hardware} & x,1,0 & y,1,0 & z,1,0 \\ \hline \text{deck} & x,-1,0 & y,1,0 & z,-1,-90 \\ \text{plate1} & x,-1,ref_x & y,1,ref_y & z,-1,ref_z \\ \end{array}$
In [9]:
import numpy as np
In [71]:
plate = np.array([0,0,0,1])
In [507]:
W = np.array([[0,1,0],
[1,0,0],
[0,0,1],
[0,0,0],
])
# Wi=np.linalg.inv(W)
In [75]:
hardware = np.matmul(plate,W)
hardware
Out[75]:
In [31]:
np.matmul(y,Wi)
Out[31]:
In [485]:
# I:
# num_rc: (ct, ct) 2-tuple of
# space_rc: (mm, mm)
# O:
def generate_platemap(num_rc, space_rc, z):
temp = list()
headers = ['n','s','r','c','name','x','y','z']
for r in range(num_rc[0]):
for c in range(num_rc[1]):
n = c + (r)*num_rc[1]
s = ((r+1)%2)*(c + r*num_rc[1]) + (r%2)*((r+1)*num_rc[1] - (c+1))
name = chr(64+r+1) + '{:02d}'.format(c+1)
x = c*space_rc[1]
y = r*space_rc[0]
z = z
temp.append([n, s, r, c, name, x, y, z])
df = pd.DataFrame(temp, columns=headers)
# df.to_clipboard()
return df
num_rc = 16,24
space_rc = 5,5
z=10
generate_platemap(num_rc, space_rc, z)
Out[485]:
In [499]:
def spacing(num_rc,p1,p2):
r,c =map(float,num_rc)
return tuple(abs(np.nan_to_num(np.divide(np.subtract(p2, p1), (c-1,r-1)))))
In [504]:
num_rc = 1,4
p1 = 0.0,0.0
p2 = 115,0.0
spacing(num_rc,p1,p2)
Out[504]:
In [ ]:
# 1a determine XY limits
# only use if hall effect sensors are in place
XY = ASI_Controller()
overload = 999.9
XY.move_xy(-overload, -overload)
xmin, ymin = XY.where_xy()
XY.move_xy(overload, overload)
xmax, ymax = XY.where_xy()
ranges_xy = (xmax - xmin, ymax - ymin)
# ranges_xy = (104.35, 100.4)
In [ ]:
# 1b determine Z limits
# be careful not to exceed limit
ranges_z = 100.0
autosipper.ranges_xyz = ranges_xy + ranges_z
In [ ]:
# 2 Affix *deck* to *stage*
In [439]:
# 3 Determine axes mapping between deck and stage
autosipper.hardware.transform = np.array([[1,0,0],
[0,1,0],
[0,0,1],
])
autosipper.deck.transform = np.array([[1,0,0],
[0,1,0],
[0,0,1],
])
assert(np.linalg.norm(autosipper.W['deck'], ord='nuc') == 3) # check for a valid transformation matrix (includes rotations)
In [ ]:
# 4 Align (physically) deck to stage using deck reference
x,y = deck
autosipper.XY.zero
autosipper.XY.move_xy(x,y) # move to reference