wip
This commit is contained in:
@@ -354,7 +354,7 @@ class HelicalScanGui():
|
||||
|
||||
def update_anim(self,frm):
|
||||
rec=self.helScn.rec
|
||||
(cx, cz, w, fy)=rec[int(frm),:4];cx=-cx;cz=-cz
|
||||
(cx, cz, w, fy)=rec[int(frm),:4];cx=-cx;cz=-cz #change sign because axes have neg direction
|
||||
w*=d2r/1000 # scale from deg to rad
|
||||
if self.manip:
|
||||
param = self.helScn.param
|
||||
@@ -781,7 +781,6 @@ a
|
||||
#1->I
|
||||
'''
|
||||
pbParam=param.copy()
|
||||
pbParam[:,(0,2)]=-pbParam[:,(0,2)] #change sign of x_0,x_1,z_0,z_1, because axes have neg direction
|
||||
sh=pbParam.shape
|
||||
s = ('z', 'y', 'x', 'r', 'phi')
|
||||
a = np.ones(sh[1], dtype=np.uint8).reshape(1, -1)
|
||||
@@ -790,7 +789,7 @@ a
|
||||
subsParam=dict(map(lambda k, i, v: (k + '_' + str(i), v), s * sh[0], c, pbParam.reshape(-1)))
|
||||
subsParam['d2r']=d2r/1000.
|
||||
subsParam['r2d']=1000./d2r
|
||||
subsParam['cmt']='//'
|
||||
subsParam['cmt']='' #'//'
|
||||
|
||||
|
||||
subs={'qCX':'L4', 'qCZ':'L5', 'qW':'L3', 'qFY':'L1',
|
||||
@@ -1003,6 +1002,7 @@ close
|
||||
elif mode==1: #### pvt motion
|
||||
#y=2.3 6.2 dx=0, dz=0 w=0..3600000 # 10 rev
|
||||
cnt= kwargs.get('cnt', 1) #move path multiple times
|
||||
sync_frq=kwargs.get('sync_frq',10) # synchronization mark all n points
|
||||
cntVert = kwargs.get('cntVert', 12)
|
||||
cntHor = kwargs.get('cntHor', 4)
|
||||
hRng = kwargs.get('hRng', (-.2,.2))
|
||||
@@ -1010,6 +1010,7 @@ close
|
||||
yRng = kwargs.get('yRng', self.param[:,1])
|
||||
pt2pt_time = kwargs.get('pt2pt_time', 100)
|
||||
smt = kwargs.get('smt', 1) # SegMoveTime, default = 1ms -> velocity calc not yet 100% correct (smt=0 not 100% working)
|
||||
|
||||
numPt=cntVert*cntHor
|
||||
pt=np.zeros((numPt,4))
|
||||
if cntHor>1:
|
||||
@@ -1049,7 +1050,8 @@ close
|
||||
prg.append(' Coord[1].SegMoveTime=%d'%smt) #to calculate every 1 ms the inverse kinematics
|
||||
prg.append(' pvt%g abs'%pt2pt_time) #100ms to next position
|
||||
for idx in range(1,pv.shape[0]):
|
||||
#prg.append(' P2000=%d'%idx)
|
||||
if sync_frq is not None and idx%sync_frq==0:
|
||||
prg.append('Coord[1].Q[0]=%d'%(idx))
|
||||
prg.append(' X%g:%g Z%g:%g B%g:%g Y%g:%g' % tuple(pv[idx, (0,4,1,5,2,6,3,7)]))
|
||||
#prg.append('Y%g:%g' % tuple(pv[idx, (5, 7)]))
|
||||
#prg.append('B%g:%g' %(idx*1000,0))
|
||||
@@ -1065,9 +1067,9 @@ close
|
||||
prg.append(' }')
|
||||
else:
|
||||
prg.append(' dwell 1000')
|
||||
if sync_frq is not None:
|
||||
prg.append('Coord[1].Q[0]=-1')
|
||||
prg.append(' Gather.Enable=0')
|
||||
|
||||
prg.append(' P1000=1')
|
||||
prg.append('close')
|
||||
#prg.append('&1\nb%dr\n'%prgId)
|
||||
|
||||
@@ -1100,7 +1102,7 @@ close
|
||||
if __name__=='__main__':
|
||||
def run_test(args):
|
||||
test=args.test
|
||||
args.host=None
|
||||
#args.host=None
|
||||
|
||||
if args.host is None:
|
||||
comm=gather=None
|
||||
@@ -1123,10 +1125,19 @@ if __name__=='__main__':
|
||||
HelicalScanTests.calcParamSim(hs)
|
||||
hs.setup_motion(mode=1,cntHor=5,cntVert=15,hRng=(-50,50),wRng=(0,120000),smt=0,pt2pt_time=200)
|
||||
|
||||
hs.setup_coord_trf()
|
||||
hs.setup_sync(mode=0) # None: no sync at all mode=1: sync on timing UserFlag
|
||||
hs.setup_gather()
|
||||
hs.run()
|
||||
print('wait until gather finished:')
|
||||
fn = '/tmp/helicalscan'
|
||||
hs.gather_upload(fn + '.npz')
|
||||
hs.load_rec(fn + '.npz')
|
||||
|
||||
for manip in (False,True):
|
||||
hsg=HelicalScanGui(hs);hsg.interactive_cx_cz_w_fy(manip=manip)
|
||||
hsg=HelicalScanGui(hs);hsg.interactive_dx_dz_w_y(manip=manip)
|
||||
#hsg=HelicalScanGui(hs);hsg.interactive_anim(manip=manip)
|
||||
hsg=HelicalScanGui(hs);hsg.interactive_anim(manip=manip)
|
||||
return
|
||||
|
||||
elif test==3:
|
||||
@@ -1153,9 +1164,9 @@ if __name__=='__main__':
|
||||
#cpx X0 Z0 B0 Y258
|
||||
#cpx X0 Z0 B120000 Y258
|
||||
|
||||
#hs.calcParam(x = ((-1154.4, 216.3, -250.7), ( -1330.2, 340.9, -230.4)),
|
||||
# y = (1405.7,1019.2),
|
||||
# z = ((-1309.6, -1010.9, -2410.3),( -1219.4, -918.8, -2510.4)))
|
||||
hs.calcParam(x = ((-1154.4, 216.3, -250.7), ( -1330.2, 340.9, -230.4)),
|
||||
y = (1405.7,1019.2),
|
||||
z = ((-1309.6, -1010.9, -2410.3),( -1219.4, -918.8, -2510.4)))
|
||||
|
||||
|
||||
### use simulation motors ###
|
||||
@@ -1171,7 +1182,7 @@ if __name__=='__main__':
|
||||
eval(s)
|
||||
|
||||
hs.setup_coord_trf()
|
||||
hs.setup_sync(mode=2) # None: no sync at all mode=1: sync on timing UserFlag
|
||||
hs.setup_sync(mode=0) # None: no sync at all mode=1: sync on timing UserFlag
|
||||
hs.setup_gather()
|
||||
|
||||
#hs.gen_prog(mode=-1)
|
||||
|
||||
Reference in New Issue
Block a user