wip
This commit is contained in:
@@ -36,7 +36,10 @@ class MotionBase:
|
||||
self.gather=gather
|
||||
self.verbose=verbose
|
||||
#ServoPeriod=0.2 #ms, Sys.ServoPeriod is dependent of !common() macro
|
||||
ServoPeriod=comm.gpascii.servo_period*1000
|
||||
if comm is None:
|
||||
ServoPeriod=.2
|
||||
else:
|
||||
ServoPeriod=comm.gpascii.servo_period*1000
|
||||
|
||||
self.meta={'srv_per':ServoPeriod,'pt2pt_time':40,'sync_flag':0,'sync_mode':2}
|
||||
self.meta.update(kwargs)
|
||||
@@ -106,6 +109,7 @@ class MotionBase:
|
||||
self.sync_prg = prg
|
||||
#download and start triggerSync code
|
||||
comm=self.comm
|
||||
if comm is None: return
|
||||
|
||||
arg=0 #argument to pass to triggerSync program
|
||||
if sync_mode==2:arg+=1 #synchronize
|
||||
@@ -144,6 +148,7 @@ class MotionBase:
|
||||
def run(self, crdId=1):
|
||||
'runs the code sync_run which has been generated with setup_sync()'
|
||||
comm = self.comm
|
||||
if comm is None: return
|
||||
gpascii = comm.gpascii
|
||||
try:
|
||||
cmd=self.sync_run
|
||||
@@ -157,6 +162,7 @@ class MotionBase:
|
||||
return
|
||||
else:
|
||||
comm = self.comm
|
||||
if comm is None: return
|
||||
gpascii = comm.gpascii
|
||||
while (True):
|
||||
val = gpascii.get_variable('Coord[{crdId}].Q[0]'.format(crdId=crdId), type_=int)
|
||||
@@ -172,7 +178,7 @@ class MotionBase:
|
||||
if ge == 0: return -1
|
||||
cnt = gpascii.get_variable('Gather.Samples', type_=int)
|
||||
try:
|
||||
cnt*=self.meta['srv_per']/(self.meta['acq_per']*self.meta['pt2pt_time'])
|
||||
cnt*=self.meta['srv_per']*self.meta['acq_per']/self.meta['pt2pt_time']
|
||||
except KeyError:
|
||||
pass
|
||||
return cnt
|
||||
@@ -184,6 +190,7 @@ class MotionBase:
|
||||
time.sleep(wait)
|
||||
if self.meta['sync_flag']&1:
|
||||
comm = self.comm
|
||||
if comm is None: return
|
||||
gpascii = comm.gpascii
|
||||
gpascii.send_block('Coord[1].Q[10]=1')
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user