first running sync with rt-C-code

This commit is contained in:
2019-01-22 14:41:16 +00:00
parent 7c2a2c5fe6
commit 66e2d038ba
5 changed files with 217 additions and 136 deletions

View File

@@ -286,7 +286,7 @@ class ShapePath(MotionBase):
self.ptsCorr=ptsCorr
print(ptsCorr)
def setup_gather(self,acq_per=1):
def setup_gather(self,acq_per=1,sim=False):
'''
setup the channels to gather
kwargs:
@@ -295,9 +295,10 @@ class ShapePath(MotionBase):
comm=self.comm
gt=self.gather
gt.set_phasemode(False)
address=("Motor[1].ActPos","Motor[2].ActPos","Motor[1].DesPos","Motor[2].DesPos","Gate3[1].Chan[1].UserFlag")
address=("Motor[1].ActPos","Motor[2].ActPos","Motor[1].DesPos","Motor[2].DesPos","Sys.P[1]")
#address=("Motor[1].ActPos","Motor[2].ActPos","Motor[1].DesPos","Motor[2].DesPos","Coord[1].Q[1]")
if sim:
address=("Motor[1].ActPos","Motor[2].ActPos","Motor[1].DesPos","Motor[2].DesPos","Coord[1].Q[11]")
else:
address=("Motor[1].ActPos","Motor[2].ActPos","Motor[1].DesPos","Motor[2].DesPos","Gate3[1].Chan[1].UserFlag")
gt.set_address(*address)
gt.set_property(MaxSamples=1000000, Period=acq_per)
@@ -492,9 +493,6 @@ class ShapePath(MotionBase):
else:
print(syncShell.sync())
del self.syncShell
syncShell.close()
pts=self.points
ofsy=-rec[0,2]+pts[0,1]
@@ -832,17 +830,37 @@ if __name__=='__main__':
# [0., 1.]])
#sp.points*=100
#sp.gen_spiral_points(rStart=100,rInc=10,numSeg=4,numCir=60, ofs=(0, 0))
sp.gen_spiral_points(rStart=100,rInc=10,numSeg=8,numCir=12, ofs=(0, 0))
sp.gen_spiral_points(rStart=100,rInc=20,numSeg=8,numCir=32, ofs=(0, 0))
#sp.gen_closed_shifted()
#sp.gen_grid_points(w=10,h=10,pitch=100,rnd=0,ofs=(0,0));sp.sort_points(False);
#sp.gen_grid_points(w=1,h=10,pitch=100,rnd=0,ofs=(0,0))
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=0)
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=1)
#works: direct start
#sp.setup_gather(acq_per=1)
#sp.setup_sync(mode=0)
#works: simulated start and frame trigger no sync
#sp.setup_gather(acq_per=1,sim=True)
#sp.setup_sync(mode=1,flag=3,pt2pt_time=40)
#works: simulated start and frame trigger with sync
#sp.setup_gather(acq_per=1,sim=True)
#sp.setup_sync(mode=2,flag=3,pt2pt_time=40)
#works: simulated start real frame trigger no sync
#sp.setup_gather(acq_per=1)
#sp.setup_sync(mode=1,flag=1,pt2pt_time=40)
#works: simulated start real frame trigger with sync
sp.setup_gather(acq_per=1)
sp.setup_sync(mode=1) #sync with timing system and PLC to sync speed (PROG)
sp.setup_sync(mode=2,flag=1,pt2pt_time=40)
sp.setup_coord_trf() # reset to shape path system
sp.setup_motion(fnPrg=fn + '.prg', mode=3, pt2pt_time=40,scale=1,dwell=10)
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=0,dwell=10)
sp.run()
sp.gather_upload(fnRec=fn+'.npz')
sp.plot_gather(mode=11)