enhance triggering

This commit is contained in:
2019-03-20 14:34:12 +01:00
parent eda8caf985
commit 399282cba9
9 changed files with 36 additions and 23 deletions

View File

@@ -44,7 +44,7 @@ class MotionBase:
self.meta={'srv_per':ServoPeriod,'pt2pt_time':40,'sync_flag':0,'sync_mode':2}
self.meta.update(kwargs)
def setup_sync(self, crdId=1, prgId=2,verbose=False):
def setup_sync(self, crdId=1, prgId=2,verbose=False, timeOfs=0.):
'''setup the timing synchronization for the motion program
kwargs:
sync_mode : default=2
@@ -122,7 +122,7 @@ class MotionBase:
sftp.put(src, dst)
sftp.chmod(dst, 0o755)
cmd = 'LD_LIBRARY_PATH=/opt/ppmac/libppmac/ ' + dst
cmd+=' %g %d'%(pt2pt_time,arg)
cmd+=' %g %g %d'%(pt2pt_time,timeOfs,arg)
self.cmdSync = cmd
print ('starting '+cmd)
self.syncShell=comm.shell_channel(cmd)

View File

@@ -56,7 +56,8 @@ class MPLCanvasErr(FigureCanvas):
hl += ax.plot(erry, 'g-',label='y-error')
hl += ax.plot(err, 'r-',label='error')
ax.xaxis.set_label_text('datapoint (timebase: %g ms per data point)'%meta['timebase'])
tb=meta['srv_per']*meta['acq_per']
ax.xaxis.set_label_text('datapoint (timebase: %g ms per data point)'%tb)
ax.yaxis.set_label_text('pos-error um')
legend = ax.legend(loc='upper right', shadow=True)
ax.plot([.5,.5],[0.01, 0.99],'k',transform=ax.transAxes)

View File

@@ -59,7 +59,8 @@ class MPLCanvasVelo(FigureCanvas):
hl += ax.plot(velAct, 'r-',label='vel act')
hl += ax.plot(velDes, 'r--',label='vel des')
ax.xaxis.set_label_text('datapoint (timebase: %g ms per data point)'%meta['timebase'])
tb=meta['srv_per']*meta['acq_per']
ax.xaxis.set_label_text('datapoint (timebase: %g ms per data point)'%tb)
ax.yaxis.set_label_text('um/ms')
legend = ax.legend(loc='upper right', shadow=True)
#axvline(linewidth=4, color='r')
@@ -143,9 +144,9 @@ class MAVelocityFrame(wx.Frame):
try:
vel=doc.vel
except AttributeError:
tb=meta['timebase']
tb=meta['srv_per']*meta['acq_per']
#data points are um
#datapoint timebase: 2 ms () per data point
#datapoint tb= timebase of datapoint sampling
#velocity: um/ms (deltatau desVel= motor units per serco cycle)
rec=doc.fh['rec']
velyAct = np.diff(rec[:, 0])/tb

View File

@@ -289,7 +289,7 @@ class DebugPlot:
idxTrigger = np.where(np.diff(idxTrigger) == 1)[0] + 1
if idxTrigger.shape[0] > 0:
hl += ax.plot(rec[idxTrigger, 1], rec[idxTrigger, 0], 'xr', label='trig') # actual path
hl2 += ax2.plot(rec[:, 4], 'b-', label='trigger')
hl2 += ax2.plot(rec[:, 4]*10, 'b-', label='trigger')
ax.xaxis.set_label_text('x-pos um')
ax.yaxis.set_label_text('y-pos um')
@@ -854,7 +854,8 @@ if __name__=='__main__':
#sp.gen_closed_shifted()
#sp.gen_swissmx_points(width=1000,ofs=(-500,0))
#sp.gen_swissfel_points(width=1000,ofs=(-500,0))
sp.gen_rand_points(n=2000, scale=1000);sp.sort_points(xy=False)
#sp.gen_rand_points(n=20, scale=100,ofs=(-950,+2780));sp.sort_points(xy=False)
sp.gen_rand_points(n=200, scale=100,ofs=(0,+2000));sp.sort_points(xy=False)
#sp.gen_swissmx_points(width=1000, ofs=(-500, 0));
#sp.gen_spiral_points(rStart=100,rInc=10,numSeg=4,numCir=60, ofs=(0, 0))
#sp.gen_spiral_points(rStart=100,rInc=130,numSeg=4,numCir=2, ofs=(0, 0))
@@ -868,7 +869,7 @@ if __name__=='__main__':
gtMaxLn=116508;ovhdTime=100
acq_per=int(np.ceil((sp.meta['pt2pt_time']*sp.points.shape[0]+ovhdTime)/(gtMaxLn*sp.meta['srv_per'])))
sp.setup_gather(acq_per=acq_per)
sp.setup_sync(verbose=args.verbose&32)
sp.setup_sync(verbose=args.verbose&32,timeOfs=0.55)
sp.setup_coord_trf() # reset to shape path system
#sp.meta['pt2pt_time']=10 #put between setup_sync and setup_motion to have more motion points than FEL syncs
sp.setup_motion(fnPrg=fn+'.prg', mode=3, scale=1.,dwell=10)

1
python/triggerSync Symbolic link
View File

@@ -0,0 +1 @@
../src/triggerSync/triggerSync