wip
This commit is contained in:
@@ -233,7 +233,10 @@ class ShapePath(MotionBase):
|
||||
mode=-1 jog a 10mm square
|
||||
mode=0 linear motion
|
||||
mode=1 pvt motion
|
||||
kwargs: scale: scaling velocity (default=1. value=0 would stop at the point
|
||||
mode=2 spline motion
|
||||
mode=3 pvt motion using inverse fft velocity
|
||||
kwargs: scale: scaling velocity (default=1. value=0 would stop at the point
|
||||
kwargs:
|
||||
pt2pt_time : time to move from one point to the next point
|
||||
sync_frq : synchronization mark all n points
|
||||
@@ -268,8 +271,9 @@ class ShapePath(MotionBase):
|
||||
prg.append('X%g Y%g'%tuple(pos[idx,:]))
|
||||
prg.append('dwell 100')
|
||||
prg.append('Gather.Enable=0')
|
||||
elif mode==1: #### pvt motion
|
||||
elif mode in (1,3): #### pvt motion
|
||||
pt2pt_time=kwargs.get('pt2pt_time', 100)
|
||||
scale=kwargs.get('scale', 1.)
|
||||
self.meta['pt2pt_time']=pt2pt_time
|
||||
cnt=kwargs.get('cnt', 1) # move path multiple times
|
||||
sync_frq=kwargs.get('sync_frq', 10) # synchronization mark all n points
|
||||
@@ -277,19 +281,25 @@ class ShapePath(MotionBase):
|
||||
pt=self.ptsCorr
|
||||
except AttributeError:
|
||||
pt=self.points
|
||||
vel=pt[2:,:]-pt[:-2,:]
|
||||
|
||||
#pv is an array of posx posy velx vely
|
||||
pv=np.ndarray(shape=(pt.shape[0]+2,4),dtype=pt.dtype)
|
||||
pv[:]=np.NaN
|
||||
#pv[ 0,(0,1)]=2*pt[0,:]-pt[1,:]
|
||||
pv[ 0,(0,1)]=pt[0,:]
|
||||
pv[ 1:-1,(0,1)]=pt
|
||||
#pv[ -1,(0,1)]=2*pt[-1,:]-pt[-2,:]
|
||||
pv[ -1,(0,1)]=pt[-1,:]
|
||||
pv[(0,0,-1,-1),(2,3,2,3)]=0
|
||||
dist=pv[2:,(0,1)] - pv[:-2,(0,1)]
|
||||
pv[ 1:-1,(2,3)] = 1000.*dist/(2.*pt2pt_time)
|
||||
|
||||
if mode==1: # set velocity to average from prev to next point
|
||||
dist=pv[2:,(0,1)] - pv[:-2,(0,1)]
|
||||
pv[ 1:-1,(2,3)] = 1000.*dist/(2.*pt2pt_time)*scale
|
||||
else: #mode=3: set velocity to the reconstructed inverse fourier transformation
|
||||
k=pt.shape[0]
|
||||
f=np.fft.fftfreq(k, d=1./k)
|
||||
pf=np.fft.fft(pt.T)
|
||||
pfd=pf*f*1j # differentiate in fourier
|
||||
pd=np.fft.ifft(pfd)
|
||||
v=pd.real/(k*2*np.pi)
|
||||
pv[ 1:-1,(2,3)] = 1000.*v.T/(pt2pt_time)*scale # FACTORS HAS TO BEEN CHECKED
|
||||
prg.append(' linear abs')
|
||||
prg.append('X%g Y%g' % tuple(pv[0, (0,1)]))
|
||||
prg.append('dwell 10')
|
||||
|
||||
Reference in New Issue
Block a user