full stage tests
This commit is contained in:
@@ -54,7 +54,8 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a
|
||||
!encoder_sim(enc=2,tbl=10,mot=10,posSf=13000./2048)
|
||||
!encoder_inc(enc=2,tbl=2,mot=2,posSf=13000./650000)
|
||||
//!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=1000,Ki=0.07,Kvff=1000,Kaff=4000,MaxInt=1000)
|
||||
!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000)
|
||||
//!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000)
|
||||
!motor_servo(mot=2,ctrl='ServoCtrl',Kp=25,Kvfb=400,Ki=0.02,Kvff=350,Kaff=5000,MaxInt=1000)
|
||||
!motor(mot=2,dirCur=0,contCur=800,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=10.,numPhase=3,invDir=True,servo=None,PhasePosSf=1./81250,PhaseFindingDac=100,PhaseFindingTime=50,SlipGain=0,AdvGain=0,PwmSf=10000,FatalFeLimit=200,WarnFeLimit=100,InPosBand=2,homing='enc-index')
|
||||
|
||||
|
||||
|
||||
24
logbook.md
24
logbook.md
@@ -896,6 +896,12 @@ EPICS_CA_ADDR_LIST='sf-cagw SAR-CPPM-EXPMX1'
|
||||
EPICS_CA_ADDR_LIST=SAR-CPPM-EXPMX1
|
||||
$ caget SAR-ESB_MX:MOTOR_X1
|
||||
|
||||
root@:/ioc/SAR-CPPM-EXPMX1# service shellbox status
|
||||
pid port user dir command
|
||||
STOPPED 50001 ioc /ioc/SAR-CPPM-EXPMX1 iocsh startup.script
|
||||
root@:/ioc/SAR-CPPM-EXPMX1# service shellbox start
|
||||
Starting shellbox service:
|
||||
Starting: 50001 ioc /ioc/SAR-CPPM-EXPMX1 iocsh startup.script
|
||||
|
||||
dbl
|
||||
dbpf SAR-ESB_MX:MOTOR_Y1 10
|
||||
@@ -903,5 +909,21 @@ dbpf SAR-ESB_MX:MOTOR_X1 10
|
||||
|
||||
dbpf SAR-ESB_MX:ASYN.AOUT 'enable plc 1'
|
||||
|
||||
Boot time of SAR-CPPM-EXPMX1 ca.4min.
|
||||
telnet SAR-CPPM-EXPMX1 50001
|
||||
|
||||
ssh x06mx-cons-1
|
||||
cd /scratch/ESB_MX/ESB_MX/qt
|
||||
caqtdm -macro 'P=SAR-ESB_MX' ESB_MX_exp.ui
|
||||
caput SAR-ESB_MX:ASYN.AOUT 'enable plc 1'
|
||||
|
||||
|
||||
|
||||
tweak param 13.6.2017
|
||||
---------------------
|
||||
telnet SAR-CPPM-EXPMX1 50001
|
||||
ctrl-T
|
||||
ctrl-R
|
||||
|
||||
|
||||
|
||||
dbpf
|
||||
@@ -51,16 +51,42 @@ class MPLCanvasImg(FigureCanvas):
|
||||
fig=self.fig
|
||||
ax=self.ax
|
||||
|
||||
#res=rot.ActPos,x.ActPos,y.ActPos,rot.DesPos,x.DesPos,y.DesPos
|
||||
#idx 0 1 2 3 4 5
|
||||
#idx=np.ndarray(shape=len(pts),dtype=np.int32)
|
||||
#for i in range(len(pts)):
|
||||
# l=rec[:,4:6]-pts[i,:]
|
||||
# l2=l[:,0]**2+l[:,1]**2
|
||||
# idx[i]=np.argmin(l2)
|
||||
|
||||
idx=[]
|
||||
for i in range(len(pts)):
|
||||
l=rec[:,4:6]-pts[i,:]
|
||||
l2=l[:,0]**2+l[:,1]**2
|
||||
idx.extend(np.where(l2<1)[0].tolist())
|
||||
#print idx
|
||||
recPts=rec[idx,:]
|
||||
f2 = plt.figure()
|
||||
a2 = f2.add_axes([0.075,0.075,0.85,0.85])
|
||||
a2.plot(rec[:,1],'r-',label='ptsDot') #,picker=5 default value
|
||||
a2.plot(rec[:,2],'g-',label='ptsDot') #,picker=5 default value
|
||||
a2.plot(rec[:,4],'r--',label='ptsDot') #,picker=5 default value
|
||||
a2.plot(rec[:,5],'g--',label='ptsDot') #,picker=5 default value
|
||||
plt.show()
|
||||
|
||||
|
||||
hl=[]
|
||||
hl+=ax.plot(pts[:,0],pts[:,1],'r.',label='ptsDot') #,picker=5 default value
|
||||
hl+=ax.plot(pts[:,0],pts[:,1],'y--',label='ptsLine')
|
||||
|
||||
|
||||
ec = mpl.collections.EllipseCollection(1, 1, 0, units='xy', offsets=pts,transOffset=ax.transData,edgecolors='g',facecolors=(1,1,0,0.3))
|
||||
ax.add_collection(ec)
|
||||
|
||||
|
||||
hl+=ax.plot(rec[:, 4], rec[:, 5], 'b-',label='recDesPos')
|
||||
hl+=ax.plot(rec[:,1],rec[:,2],'g-',label='recActPos')
|
||||
hl+=ax.plot(recPts[:,1],recPts[:,2],'g.',label='recDot')
|
||||
ax.xaxis.set_label_text('x-pos um')
|
||||
ax.yaxis.set_label_text('y-pos um')
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class ShapePath:
|
||||
cfg=json.loads(s, object_hook=ConvUtf8)
|
||||
s=json.dumps(cfg, indent=2, separators=(',', ': '));print s
|
||||
else:
|
||||
fn='/tmp/shapepath'
|
||||
fn='/tmp/shapepath4'
|
||||
#fn='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/data/'+time.strftime('%y-%m-%d-%H_%M_%S')
|
||||
#cfg={"points": [[100,523],[635,632],[756,213]],"sequencer":['sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']}
|
||||
#cfg={"sequencer":['gen_rand_points(n=107, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']}
|
||||
@@ -85,9 +85,11 @@ class ShapePath:
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=1000)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,acq_per=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_rand_points(n=400, scale=1000)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
cfg = {"sequencer": ['gen_grid_points(w=15,h=15,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=2,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.4)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,cnt=1)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=20,acq_per=10)','plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_swissfel_points(scale=300)','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=100,acq_per=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
cfg = {"sequencer": ['opt_pts("'+fn+'.npz")','gen_prog(file="'+fn+'_corr.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,cnt=1)', 'plot_gather("'+fn+'_corr.npz")']}
|
||||
#cfg = {"sequencer": ['opt_pts("'+fn+'.npz")','gen_prog(file="'+fn+'.prg",mode=1,pt2pt_time=10,cnt=1)']}
|
||||
|
||||
self.cfg=dotdict(cfg)
|
||||
self.args=args
|
||||
@@ -144,6 +146,26 @@ class ShapePath:
|
||||
pts[:,0]+=500
|
||||
self.points=pts
|
||||
|
||||
def opt_pts(self,fn):
|
||||
fh=np.load(fn)
|
||||
#res=rot.ActPos,x.ActPos,y.ActPos,rot.DesPos,x.DesPos,y.DesPos
|
||||
#idx 0 1 2 3 4 5
|
||||
rec=fh['rec']
|
||||
pts=fh['pts']
|
||||
desPos=rec[:,4:6]
|
||||
|
||||
idx=np.ndarray(shape=len(pts),dtype=np.int32)
|
||||
for i in range(len(pts)):
|
||||
l=desPos-pts[i,:]
|
||||
l2=l[:,0]**2+l[:,1]**2
|
||||
idx[i]=np.argmin(l2)
|
||||
|
||||
recPts=rec[idx,:]
|
||||
ptsCorr=(pts-recPts[:,1:3]+recPts[:,4:6])
|
||||
self.points=pts
|
||||
self.ptsCorr=ptsCorr
|
||||
print ptsCorr
|
||||
|
||||
def gen_prog(self,prgId=2,file=None,host=None,mode=0,**kwargs):
|
||||
'''
|
||||
kwargs:
|
||||
@@ -201,8 +223,15 @@ class ShapePath:
|
||||
except KeyError:
|
||||
print 'missing pt2pt_time, use default=100ms'
|
||||
pt2pt_time=100.
|
||||
try:
|
||||
cnt=kwargs['cnt'] #move path multiple times
|
||||
except KeyError:
|
||||
cnt=1
|
||||
|
||||
pt=self.points
|
||||
try:
|
||||
pt=self.ptsCorr
|
||||
except AttributeError:
|
||||
pt=self.points
|
||||
vel=pt[2:,:]-pt[:-2,:]
|
||||
#pv is an array of posx posy velx vely
|
||||
pv=np.ndarray(shape=(pt.shape[0]+2,4),dtype=pt.dtype)
|
||||
@@ -220,11 +249,25 @@ class ShapePath:
|
||||
prg.append('X%g Y%g' % tuple(pv[0, (0,1)]))
|
||||
prg.append('dwell 10')
|
||||
prg.append('Gather.Enable=2')
|
||||
if cnt>1:
|
||||
prg.append('P100=%d'%cnt)
|
||||
prg.append('N100:')
|
||||
prg.append(' pvt%g abs'%pt2pt_time) #100ms to next position
|
||||
for idx in range(1,pv.shape[0]):
|
||||
prg.append('X%g:%g Y%g:%g'%tuple(pv[idx,(0,2,1,3)]))
|
||||
prg.append('X%g Y%g' % tuple(pv[-1, (0,1)]))
|
||||
prg.append('dwell 1000')
|
||||
if cnt>1:
|
||||
prg.append('dwell 10')
|
||||
prg.append('P100=P100-1')
|
||||
prg.append('if(P100>0)')
|
||||
prg.append('{')
|
||||
prg.append(' linear abs')
|
||||
prg.append('X%g Y%g' % tuple(pv[0, (0,1)]))
|
||||
prg.append('dwell 100')
|
||||
prg.append('goto 100')
|
||||
prg.append('}')
|
||||
else:
|
||||
prg.append('dwell 1000')
|
||||
prg.append('Gather.Enable=0')
|
||||
elif mode==2: #### spline motion
|
||||
try:
|
||||
|
||||
@@ -207,7 +207,7 @@ P=$(P),M=MOTOR_Y1</string>
|
||||
<string>Homing</string>
|
||||
</property>
|
||||
<property name="channel" stdset="0">
|
||||
<string notr="true">$(P).ASYN</string>
|
||||
<string notr="true">$(P):ASYN.AOUT</string>
|
||||
</property>
|
||||
<property name="pressMessage">
|
||||
<string notr="true">enable plc 1</string>
|
||||
|
||||
Reference in New Issue
Block a user