SFELPHOTON-1128: debug stup-and-go motion(2)
This commit is contained in:
@@ -45,7 +45,7 @@ class MotionBase:
|
||||
else:
|
||||
ServoPeriod=comm.gpascii.servo_period*1000
|
||||
|
||||
self.meta={'srv_per':ServoPeriod,'pt2pt_time':40,'sync_flag':0,'sync_mode':2}
|
||||
self.meta={'srv_per':ServoPeriod,'fel_per':10,'sync_flag':0,'sync_mode':2}
|
||||
self.meta.update(kwargs)
|
||||
|
||||
def setup_sync(self, crdId=1, prgId=2,verbose=False, timeOfs=0.,timeCor=0.):
|
||||
@@ -67,11 +67,11 @@ class MotionBase:
|
||||
1 : simulated start and real frame trigger
|
||||
2 : real start and simulated frame trigger
|
||||
3 : simulated start and frame trigger
|
||||
pt2pt_time : time point to point (needed sor sync code)
|
||||
fel_per : FEL-period: time FEL-pulse to FEL-pulse in ms (needed for sync code)
|
||||
'''
|
||||
sync_mode=self.meta['sync_mode']
|
||||
sync_flag=self.meta['sync_flag']
|
||||
pt2pt_time=self.meta['pt2pt_time']
|
||||
fel_per=self.meta['fel_per']
|
||||
|
||||
_log.info({0:'no sync at all',1:'sync at start only',2:'sync on each shot'}[sync_mode])
|
||||
if sync_mode!=0:
|
||||
@@ -129,7 +129,7 @@ Coord[1].Q[0]=-3 //motion program started and waits. Arm(-2) is done in triggerS
|
||||
sftp.chmod(dst, 0o755)
|
||||
cmd = 'LD_LIBRARY_PATH=/opt/ppmac/libppmac/ ' + dst
|
||||
#cmd+=' %d %g %g %g'%(mode,pt2pt_time,timeOfs,timeCor)
|
||||
cmd+=' %d %g %g'%(mode,pt2pt_time+timeCor,timeOfs)
|
||||
cmd+=' %d %g %g'%(mode,fel_per+timeCor,timeOfs)
|
||||
self.cmdSync = cmd
|
||||
print ('starting '+cmd)
|
||||
self.syncShell=comm.shell_channel(cmd)
|
||||
|
||||
@@ -727,7 +727,7 @@ class ShapePath(MotionBase):
|
||||
_log.warning('missing motion sync code!')
|
||||
# this uses Coord[1].Tm and limits with MaxSpeed
|
||||
if mode in (1,3,4,5): #### pvt motion
|
||||
pt2pt_time=self.meta['pt2pt_time']
|
||||
pt2pt_time=self.meta['fel_per']
|
||||
ts=self.meta['srv_per']
|
||||
scale=kwargs.get('scale', 1.)
|
||||
cnt=kwargs.get('cnt', 1) # move path multiple times
|
||||
@@ -1024,27 +1024,27 @@ if __name__=='__main__':
|
||||
#sp = ShapePath(comm, gather, args.verbose)
|
||||
|
||||
# direct start
|
||||
sp = ShapePath(comm, gather, args.verbose,sync_mode=0,pt2pt_time=10)
|
||||
sp = ShapePath(comm, gather, args.verbose,fel_per=10,sync_mode=0)
|
||||
|
||||
#simulated start and frame trigger no sync
|
||||
#sp = ShapePath(comm, gather, args.verbose,sync_mode=1,sync_flag=3)
|
||||
#sp = ShapePath(comm, gather, args.verbose,fel_per=10,sync_mode=1,sync_flag=3)
|
||||
|
||||
#simulated start and frame trigger with sync
|
||||
#sp = ShapePath(comm, gather, args.verbose,sync_mode=2,sync_flag=3)
|
||||
#sp = ShapePath(comm, gather, args.verbose,fel_per=10,sync_mode=2,sync_flag=3)
|
||||
|
||||
#simulated start real frame trigger no sync
|
||||
#sp = ShapePath(comm, gather, args.verbose,sync_mode=1,sync_flag=1)
|
||||
#sp = ShapePath(comm, gather, args.verbose,fel_per=10,sync_mode=1,sync_flag=1)
|
||||
|
||||
#simulated start real frame trigger with sync
|
||||
#sp = ShapePath(comm, gather, args.verbose,sync_mode=2,sync_flag=1)
|
||||
#sp = ShapePath(comm, gather, args.verbose,fel_per=10,sync_mode=2,sync_flag=1)
|
||||
|
||||
fn='/tmp/shapepath'
|
||||
#fn =unique_filename('ShapePathAnalyser/records/19_01_24/spiral')
|
||||
|
||||
# Gather.MaxLines=116508
|
||||
# ts=0.2ms
|
||||
# max_num_points=(MaxLines*ts-1000ms)/(+acq_per*pt2pt_time*ts)
|
||||
# pt2pt_time acq_per maxpts
|
||||
# max_num_points=(MaxLines*ts-1000ms)/(+acq_per*fel_per*ts)
|
||||
# fel_per acq_per maxpts
|
||||
# 40ms 1 555
|
||||
# 40ms 2 1135
|
||||
# 40ms 3 1715
|
||||
@@ -1081,12 +1081,24 @@ if __name__=='__main__':
|
||||
#gp.spiral(rStart=100,rInc=10,numSeg=4,numCir=32, ofs=(0, 0))
|
||||
#gp.closed_shifted()
|
||||
#gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(mode=0,grp_sz=10)
|
||||
#gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(grp_sz=15)
|
||||
gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(grp_sz=15)
|
||||
|
||||
# for motion mode 4,5
|
||||
grid={'pos':(-1000, -1200), 'pitch':(120, 120), 'count':(10, 11)}
|
||||
grid={'pos':(-1000, -1200), 'pitch':(120, 120), 'count':(10, 15)}
|
||||
|
||||
sp.meta['pt2pt_time']=10
|
||||
# mode:0 unused
|
||||
# mode:1 pvt motion
|
||||
# mode:2 unused
|
||||
# mode:3 pvt motion using inverse fft velocity
|
||||
# mode:4 pvt motion short code using grid parameters
|
||||
# mode:5 pvt motion short code using grid parameters. Instead of continous motion it moves and waits as give in the parameter time
|
||||
mode=3
|
||||
if mode==5:
|
||||
tmove=20; twait=100
|
||||
pt2pt_time=tmove+twait
|
||||
else:
|
||||
pt2pt_time=sp.meta['fel_per']
|
||||
sp.meta['pt2pt_time']=pt2pt_time
|
||||
try:
|
||||
num_pts=gp.points.shape[0]
|
||||
except AttributeError as e:
|
||||
@@ -1099,7 +1111,7 @@ if __name__=='__main__':
|
||||
gtMaxLn=int(sp.comm.gpascii.get_variable('Gather.MaxLines')) # 116508
|
||||
|
||||
ovhdTime=100
|
||||
acq_per=int(np.ceil((sp.meta['pt2pt_time']*num_pts+ovhdTime)/(gtMaxLn*sp.meta['srv_per'])))
|
||||
acq_per=int(np.ceil((pt2pt_time*num_pts+ovhdTime)/(gtMaxLn*sp.meta['srv_per'])))
|
||||
if args.verbose&0x01:
|
||||
_log.info(f'''\
|
||||
Gather.MaxLines:{gtMaxLn}
|
||||
@@ -1111,21 +1123,14 @@ if __name__=='__main__':
|
||||
sp.setup_sync(verbose=args.verbose&0x40,timeOfs=0.03,timeCor=0.0005)
|
||||
sp.setup_coord_trf() # reset to shape path system
|
||||
|
||||
# mode:0 unused
|
||||
# mode:1 pvt motion
|
||||
# mode:2 unused
|
||||
# mode:3 pvt motion using inverse fft velocity
|
||||
# mode:4 pvt motion short code using grid parameters
|
||||
# mode:5 pvt motion short code using grid parameters. Instead of continous motion it moves and waits as give in the parameter time
|
||||
mode=4
|
||||
if mode==1:
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=mode,points=sp.mot_pts)
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=mode,points=gp.points)
|
||||
elif mode==3:
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=mode,points=sp.mot_pts)
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=mode,points=gp.points)
|
||||
elif mode==4:
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=4,grid=grid)
|
||||
elif mode==5:
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=5,tmove=20 ,twait=30, grid=grid)
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=5,tmove=tmove ,twait=twait, grid=grid)
|
||||
|
||||
sp.homing() #homing if needed
|
||||
sp.run() #start motion program
|
||||
|
||||
Reference in New Issue
Block a user