wip(3)
This commit is contained in:
@@ -852,15 +852,15 @@ class ShapePath(MotionBase):
|
||||
self.mot_pts=(np.hstack((pt, np.ones((pt.shape[0], 1))))*np.asmatrix(trf)).A # pt*trf
|
||||
sx,sy=kwargs['ssz'] #section size (in wells)
|
||||
try:
|
||||
tmx,tmy=kwargs['smv'] #time(in num of shots) to move to next section (horiz/vert)
|
||||
tsx,tsy=kwargs['smv'] #time(in num of shots) to move to next section (horiz/vert)
|
||||
except KeyError as e:
|
||||
tmx=sx-1
|
||||
tmy=sy+1
|
||||
tsx=sx-1
|
||||
tsy=sy
|
||||
try:
|
||||
sdl=kwargs['sdelay']
|
||||
tsd=kwargs['sdelay']
|
||||
except KeyError as e:
|
||||
sdl=sx*sy
|
||||
sdl+=1-sx*sy # sdl are shots to wait at position #(6)
|
||||
tsd=sx*sy
|
||||
tsd+=1-sx*sy # sdl are shots to wait at position #(6)
|
||||
prg+=f' linear abs\n X{ox-px:g} Y{oy-py:g}\n' # start one position out of grid
|
||||
prg+=' dwell 10\n'
|
||||
try: prg+=self.sync_prg
|
||||
@@ -1030,17 +1030,18 @@ enable plc 2
|
||||
vsx=px/(pt2pt_time)*scale*CoordFeedTime # scaling for Deltatau
|
||||
vsy=py/(pt2pt_time)*scale*CoordFeedTime # scaling for Deltatau
|
||||
|
||||
g=kwargs['grid']
|
||||
ox,oy=g['pos'] #origin position in um (or counts if scaled)
|
||||
px,py=g['pitch'] #pitch to next position in um (or 1 if scaled)
|
||||
nx,ny=g['count'] #total count of wells
|
||||
sx,sy=kwargs['ssz'] #section size (in wells)
|
||||
#g=kwargs['grid']
|
||||
#ox,oy=g['pos'] #origin position in um (or counts if scaled)
|
||||
#px,py=g['pitch'] #pitch to next position in um (or 1 if scaled)
|
||||
#nx,ny=g['count'] #total count of wells
|
||||
#sx,sy=kwargs['ssz'] #section size (in wells)
|
||||
#tsx, tsy, tsd #time scale to pvt move to (next horiz|next vert| after position #6)
|
||||
tx,ty=nx//sx,ny//sy #total sections
|
||||
|
||||
#variables
|
||||
cx,cy,dx,dy,n,k,sx,sy,tx,ty,vsx,vsy,vx,vy,x,x0,y,y0=map(lambda x: f'L{x}',range(16))
|
||||
cx,cy,dx,dy,n,k,t,vx,vy,x,x0,y,y0=map(lambda x: f'L{x}',range(13))
|
||||
# replace in python code of hit_and_return.py setup_motion:
|
||||
# (cx|cy|dx|dy|n|k|sx|sy|tx|ty|vsx|vsy|vx|vy|x|x0|y|y0) -> {\1}
|
||||
# (cx|cy|dx|dy|n|k|sx|sy|tsd|tsx|tsy|tx|ty|vsx|vsy|vx|vy|x|x0|y|y0) -> {\1}
|
||||
# if ([^:]*): -> if \(\1\){{
|
||||
# else: -> }}else{{
|
||||
# elif ([^:]*): -> }}else if \(\1\){{
|
||||
@@ -1048,80 +1049,94 @@ enable plc 2
|
||||
prg+=f'''\
|
||||
//mode 6: hit-and-return pvt motion
|
||||
|
||||
{k}=-1 # key position
|
||||
{cx},{cy}=0,0 # section counter
|
||||
{x0},{y0},{n}=0,0,0 # counter well in region
|
||||
{dx},{dy}=0,1 # motion pitch
|
||||
{vsx}={vsy}=1 # scaled velocity
|
||||
{vx},{vy}=0,{vsy} # scaled velocity
|
||||
{t}=1 // motion pvt tome scaling
|
||||
{k}=-1 // key position
|
||||
{cx}=0;{cy}=0 // section counter
|
||||
{x0}=0;{y0}=0;{n}=0 // counter well in region
|
||||
{dx}=0;{dy}=1 // motion pitch
|
||||
{vx}=0;{vy}={vsy} // scaled velocity
|
||||
pvt{pt2pt_time} abs
|
||||
while(1){{:
|
||||
if ({cy}%2==0){{ # even rows
|
||||
while(1){{
|
||||
if ({cy}%2==0){{ // even rows
|
||||
{x}={sx}*{cx}+{x0};{y}={sy}*{cy}+{y0}
|
||||
}}else{{ # odd rows
|
||||
}}else{{ // odd rows
|
||||
{x}=({tx}-{cx})*{sx}-{x0}-1;{y}={sy}*{cy}+{y0}
|
||||
{vx}=-{vx}
|
||||
}}
|
||||
{x0}+={dx};{y0}+={dy}
|
||||
//send 1"A:move(%d) X%g:%g Y%g:%g",{k},{x},{vx},{y},{vy}
|
||||
X({x}):({vx}) Y({y}):({vy})
|
||||
if ({k}>=0){{ #if keypoint not directly followed by an other keypoint, define future velocity
|
||||
//send 1"A:move(%d) X%g:%g Y%g:%g",{k},{ox}+{x}*{px},{vx},{oy}+{y}*{py},{vy}
|
||||
X({ox}+{x}*{px}):({vx}) Y({oy}+{y}*{py}):({vy})
|
||||
if ({t}!=1){{
|
||||
pvt{pt2pt_time} abs;{t}=1
|
||||
}}
|
||||
if ({k}>=0){{ //if keypoint not directly followed by an other keypoint, define future velocity
|
||||
if ({k}==0 || {k}==4){{
|
||||
{vx},{vy}=0,{vsy}
|
||||
{vx}=0;{vy}={vsy}
|
||||
}}else if ({k}==2){{
|
||||
{vx},{vy}=0,-{vsy}
|
||||
{vx}=0;{vy}=-{vsy}
|
||||
}}else if ({k}==5){{
|
||||
{vx},{vy}=-{vsx},0
|
||||
{vx}=-{vsx};{vy}=0
|
||||
}}else if ({k}==6){{
|
||||
{n}+=1
|
||||
if ({tsd}!=1) {{
|
||||
pvt{pt2pt_time*tsd} abs;{t}={tsd}
|
||||
}}
|
||||
}}else if ({k}==7){{
|
||||
//send 1"next h section"
|
||||
{cx}+=1
|
||||
{x0},{y0},{n},{dx},{dy}=0,0,0,0,0
|
||||
{x0}=0;{y0}=0;{n}=0;{dx}=0;{dy}=0
|
||||
if ({tsx}!=1) {{
|
||||
pvt{pt2pt_time*tsx} abs;{t}={tsx}
|
||||
}}
|
||||
}}else if ({k}==8){{
|
||||
//send 1"next v section"
|
||||
{cx}=0;{cy}+=1
|
||||
{x0},{y0},{n},{dx},{dy}=0,0,0,0,0
|
||||
{x0}=0;{y0}=0;{n}=0;{dx}=0;{dy}=0
|
||||
if ({cy}>={ty}){{
|
||||
//send 1"finished whole grid"
|
||||
break
|
||||
}}
|
||||
if ({tsy}!=1) {{
|
||||
pvt{pt2pt_time*tsy} abs;{t}={tsy}
|
||||
}}
|
||||
}}
|
||||
//send 1"after keypoint %d: %g|%g",{k},{vx},{vy}
|
||||
{k}=-1
|
||||
}}
|
||||
if ({y0}=={sy}-1){{
|
||||
if ({dy}==1){{ #(1)
|
||||
{dx},{dy}=1,0
|
||||
{vx},{vy}={vsx}/2,{vsy}/2
|
||||
if ({dy}==1){{ //(1)
|
||||
{dx}=1;{dy}=0
|
||||
{vx}={vsx}/2;{vy}={vsy}/2
|
||||
}}else{{
|
||||
{k},{dx},{dy}=2,0,-1#(2)
|
||||
{vx},{vy}={vsx}/2,-{vsy}/2
|
||||
{k}=2;{dx}=0;{dy}=-1 //(2)
|
||||
{vx}={vsx}/2;{vy}=-{vsy}/2
|
||||
}}
|
||||
}}else if ({y0}==1 && {x0}>0 && {x0}<{sx}-1){{
|
||||
if ({dy}==-1){{ #(3)
|
||||
{dx},{dy}=1,0
|
||||
{vx},{vy}={vsx}/2,-{vsy}/2
|
||||
if ({dy}==-1){{ //(3)
|
||||
{dx}=1;{dy}=0
|
||||
{vx}={vsx}/2;{vy}=-{vsy}/2
|
||||
}}else{{
|
||||
{k},{dx},{dy}=4,0,1 #(4)
|
||||
{vx},{vy}={vsx}/2,{vsy}/2
|
||||
{k}=4;{dx}=0;{dy}=1 //(4)
|
||||
{vx}={vsx}/2;{vy}={vsy}/2
|
||||
}}
|
||||
}}else if ({y0}==0){{
|
||||
if ({n}==1 && {x0}==1){{ #(7 or 8)
|
||||
if ({n}==1 && {x0}==1){{ //(7 or 8)
|
||||
if ({cx}<{tx}-1){{
|
||||
{k},{dx},{dy}=7,-1,0
|
||||
{vx},{vy}=0,0
|
||||
}}else{{ #(8)
|
||||
{k},{dx},{dy}=8,{sx}-1,{sy}
|
||||
{vx},{vy}=0,0
|
||||
{k}=7;{dx}=-1;{dy}=0
|
||||
{vx}=0;{vy}=0
|
||||
}}else{{ //(8)
|
||||
{k}=8;{dx}={sx}-1;{dy}={sy}
|
||||
{vx}=0;{vy}=0
|
||||
}}
|
||||
}}else if ({x0}==1){{ #(6)
|
||||
{k},{dx},{dy}=6,-1,0
|
||||
{vx},{vy}=-{vsx},0
|
||||
}}else if ({x0}==0){{ #(0)
|
||||
{k},{dx},{dy}=0,0,1
|
||||
{vx},{vy}=0,{vsy}
|
||||
}}else if ({x0}=={sx}-1){{ #(5)
|
||||
{k},{dx},{dy}=5,-1,0
|
||||
{vx},{vy}=-{vsx}/2,-{vsy}/2
|
||||
}}else if ({x0}==1){{ //(6)
|
||||
{k}=6;{dx}=-1;{dy}=0
|
||||
{vx}=-{vsx};{vy}=0
|
||||
}}else if ({x0}==0){{ //(0)
|
||||
{k}=0;{dx}=0;{dy}=1
|
||||
{vx}=0;{vy}={vsy}
|
||||
}}else if ({x0}=={sx}-1){{ //(5)
|
||||
{k}=5;{dx}=-1;{dy}=0
|
||||
{vx}=-{vsx}/2;{vy}=-{vsy}/2
|
||||
}}
|
||||
}}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user