first steps to commission wedge mover: all motors + encoder ok.

Homing limit switch and coorTrf to be done.
This commit is contained in:
2018-01-15 11:28:14 +01:00
parent c2695e0ebf
commit 4d197eb204
12 changed files with 941 additions and 364 deletions

View File

@@ -30,7 +30,7 @@ verbose bits:
'''
import os, sys, json
import os, sys, json,re
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
@@ -275,7 +275,7 @@ class HelicalScan:
param=self.param
# param[i]=(z_i, y_i, x_i, r_i,phi_i)
ctr=param[:,0:3].mean(0)[::-1]
self.axSetCenter(ctr,10)
self.axSetCenter(ctr,param[0,3]+param[1,3])
axCx=plt.axes([0.1, 0.01, 0.8, 0.02])
axCz=plt.axes([0.1, 0.04, 0.8, 0.02])
@@ -348,7 +348,7 @@ class HelicalScan:
# param[i]=(z_i, y_i, x_i, r_i,phi_i)
ctr=(0,0,0)
self.axSetCenter(ctr,10)
self.axSetCenter(ctr,param[0,3]+param[1,3])
axDx=plt.axes([0.1, 0.01, 0.8, 0.02])
axDz=plt.axes([0.1, 0.04, 0.8, 0.02])
@@ -404,7 +404,7 @@ class HelicalScan:
# param[i]=(z_i, y_i, x_i, r_i,phi_i)
ctr=(0,0,0)
self.axSetCenter(ctr,10)
self.axSetCenter(ctr,param[0,3]+param[1,3])
axFrm=plt.axes([0.1, 0.01, 0.8, 0.02])
@@ -704,7 +704,7 @@ open forward
p0_z=z_0+r_0*cos(phi_0+qW)
p1_z=z_1+r_1*cos(phi_1+qW)
scale=(qFY-y_0)/(y_1-y_0)
scale=(qFY-(y_0))/(y_1-(y_0))
p0_x=p0_x+scale*(p1_x-p0_x)
p0_y=p0_y+scale*(p1_y-p0_y)
p0_z=p0_z+scale*(p1_z-p0_z)
@@ -727,10 +727,11 @@ open inverse
define( qCX='L4', qCZ='L5', qW='L3', qFY='L1')
define(vqCX='R4', vqCZ='R5', vqW='R3', vqFY='R1')
define(qCX='L4', qCZ='L5', qW='L3', qFY='L1')
define(p0_x='L10', p0_y='L11', p0_z='L12')
define(p1_x='L13', p1_y='L14', p1_z='L15')
define(scale='L16')
define(p_x='L16', p_y='L17', p_z='L18')
define(sclY='L19')
define(scl='L20')
if(D0>0)
send 1"inv_inp(%f) %f:%f %f:%f %f:%f %f:%f\\n",D0,DX,vDX,DZ,vDZ,W,vW,Y,vY
else
@@ -750,20 +751,26 @@ open inverse
p0_z=z_0+r_0*cos(phi_0+W)
p1_z=z_1+r_1*cos(phi_1+W)
scale=(Y-y_0)/(y_1-y_0)
p0_x=p0_x+scale*(p1_x-p0_x)
p0_y=p0_y+scale*(p1_y-p0_y)
p0_z=p0_z+scale*(p1_z-p0_z)
qCX=DX+p0_x
qCZ=DZ+p0_z
sclY=(Y-(y_0))/(y_1-(y_0))
p_x=p0_x+sclY*(p1_x-p0_x)
p_y=p0_y+sclY*(p1_y-p0_y)
p_z=p0_z+sclY*(p1_z-p0_z)
qCX=DX+p_x
qCZ=DZ+p_z
qFY=Y
if(D0>0)
{ // calculate velocities for PVT motion
vqCX=vDX
vqCZ=vDZ
vqW=vW
{ // calculate velocities for PVT motion''')
prg.append(" vW=vW*%g"%(d2r/1000.)) #scale from 1000*deg to rad
prg.append(''' p_x=sclY*(p1_x-p0_x)
p_z=sclY*(p1_z-p0_z)
vqFY=vY
send 1"inv_res %f:%f %f:%f %f:%f %f:%f\\n",qCX,vqCX,qCZ,vqCZ,qW,vqW,qFY,vqFY
vqCX=vDX + (p1_x-p0_x)/(p1_y-p0_y)*vY //+ vqW*p_z
vqCZ=vDZ + (p1_z-p0_z)/(p1_y-p0_y)*vY //+ vqW*p_x
//vqW=vqW+(vqCX+(p1_x-p0_x)/(p1_y-p0_y)*vY)*p_z+(vqCZ+(p1_z-p0_z)/(p1_y-p0_y)*vY)*p_x
vqW=vW//+((p1_x-p0_x)/(p1_y-p0_y)*vY)*p_z+((p1_z-p0_z)/(p1_y-p0_y)*vY*p_x
''')
prg.append(" vqW=vqW*%g"%(1000./d2r)) #scale from rad to 1000*deg
prg.append(''' send 1"inv_res %f:%f %f:%f %f:%f %f:%f\\n",qCX,vqCX,qCZ,vqCZ,qW,vqW,qFY,vqFY
}
else
send 1"inv_res %f %f %f %f\\n",qCX,qCZ,qW,qFY
@@ -771,6 +778,11 @@ open inverse
close
''')
# vqCX=vDX + (p1_x-p0_x)/(p1_y-p0_y)*vY + vqW*p_x
# vDX is in same direction, so add as it is
# (p1_x-p0_x)/(p1_y-p0_y)*vY velocity part in vqCX direction, when moving in vY
# vqW*p_x velocity part of the rotation (vqW is in rad)
self.download(prg,mode=0,file='/tmp/coordTrf.cfg')
@@ -845,7 +857,7 @@ close
cntHor = kwargs.get('cntHor', 4)
hRng = kwargs.get('hRng', (-.2,.2))
wRng = kwargs.get('wRng', (0,360000))
yRng = kwargs.get('yRng', (2.3,6.2))
yRng = kwargs.get('yRng', self.param[:,1])
numPt=cntVert*cntHor
pt=np.zeros((numPt,4))
@@ -881,7 +893,7 @@ close
cntHor = kwargs.get('cntHor', 4)
hRng = kwargs.get('hRng', (-.2,.2))
wRng = kwargs.get('wRng', (0,360000))
yRng = kwargs.get('yRng', (2.3,6.2))
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
@@ -1001,6 +1013,18 @@ close
stderr=sprc.PIPE)
res = p.wait()
self.rec = np.genfromtxt(fnLoc, delimiter=' ')
com=GpasciiCommunicator().connect(host,prompt='# ')
ack=GpasciiCommunicator.gpascii_ack
channels=["Motor[4].HomePos","Motor[5].HomePos","Motor[3].HomePos","Motor[1].HomePos"]
ofs=np.ndarray(len(channels))
for i,v in enumerate(channels):
com.write(v+'\n')
val=com.read_until(ack)
#print val
#regexp: https://docs.python.org/2/library/re.html -> %e, %E, %f, %g
ofs[i]=float(re.search('=([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)',val).group(1))
self.rec-=ofs
self.save_rec()
@@ -1062,19 +1086,45 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n '
hs=HelicalScan(args)
hs.args.verbose = 255
hs.args.host='MOTTEST-CPPM-CRM0485'
#hs.args.host='MOTTEST-CPPM-CRM0485'
hs.args.host='SAR-CPPM-EXPMX1'
#SAR-CPPM-EXPMX1 MOTTEST-CPPM-CRM0485
#hs.sequencer()
#hs.test_find_rot_ctr()
#hs.test_find_rot_ctr(n=5. ,per=1.,bias=2.31,ampl=4.12,phi=24.6)
hs.calcParam()
#hs.param[0]=(15,2,0,3,0)#(z_i, y_i, x_i, r_i,phi_i)
#hs.param[1]=(15,4,0,3,0)#(z_i, y_i, x_i, r_i,phi_i)
#hs.param[0]=(-100, 10,0,50,0)#(z_i, y_i, x_i, r_i,phi_i)
#hs.param[1]=(-100,-10,0,70,0)#(z_i, y_i, x_i, r_i,phi_i)
hs.test_coord_trf()
#hs.interactive_cx_cz_w_fy()
#hs.interactive_dx_dz_w_y()
hs.download(file='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg/sim_8_motors.cfg')
hs.gen_coord_trf_code()
#mode bits:
#0:1 config simulated motors
#1:2 config real motors
#2:4 config coord trf
mode=6#6#5#4#0
os.chdir(os.path.join(os.path.dirname(__file__),'../cfg'))
if mode&1:
hs.download(file='sim_8_motors.cfg')
if mode&2:
hs.download(['$$$***','!common()','!SAR-EXPMX1()','#1..7j/','enable plc 1','Motor[1].MaxSpeed=25','Motor[2].MaxSpeed=25'])
raw_input('press return when homed')
if mode&4:
hs.download(['disable plc 0',])
time.sleep(.5)
hs.gen_coord_trf_code()
print ('gen_coord_trf_code')
time.sleep(.5)
hs.download(['enable plc 0',])
time.sleep(.5)
hs.download(['#1..7j/',])
time.sleep(.5)
#hs.gen_prog(mode=-1)
#hs.gen_prog(mode=0,cntHor=1,cntVert=3,wRng=(120000,120000))
#hs.gen_prog(mode=0,cntHor=1)
@@ -1083,9 +1133,14 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n '
#hs.gen_prog(mode=1,cntHor=1,cntVert=5,wRng=(120000,120000),pt2pt_time=100)
#hs.gen_prog(mode=1,cntHor=1,cntVert=5,wRng=(120000,120000),pt2pt_time=100,smt=0)
#hs.gen_prog(mode=1,cntHor=1,cntVert=5,wRng=(0,360000))
#hs.gen_prog(mode=1,cntHor=1,cntVert=5,wRng=(0,360000),smt=0)
#hs.gen_prog(mode=1,cntHor=1,cntVert=5,hRng=(-.3,.3),wRng=(0,360000),smt=1)
#hs.gen_prog(mode=1,cntHor=7,cntVert=2,hRng=(-3,3),wRng=(120000,120000),smt=0)
hs.gen_prog(mode=1,cntHor=3,cntVert=6,hRng=(-5,5),wRng=(00,120000),smt=0,pt2pt_time=10)
#hs.gen_prog(mode=1, cntHor=1, cntVert=2, wRng=(0, 360000), smt=0)
#hs.gen_prog(mode=1)
hs.gen_prog(mode=1,pt2pt_time=100,cnt=1,cntVert=35,cntHor=7,hRng=(-.3,.3),wRng=(0,360000*3),yRng=(6.2,2.3))
#hs.gen_prog(mode=1,pt2pt_time=100,cnt=1,cntVert=35,cntHor=7,hRng=(-.3,.3),wRng=(0,360000*3),yRng=(6.2,2.3))
#hs.gen_prog(mode=1,pt2pt_time=100,cnt=1,cntVert=10,cntHor=3,hRng=(-30,30),wRng=(0,36000),yRng=(-50,-100))
#hs.gen_prog(mode=1,cntHor=7,cntVert=2,hRng=(-100,50),wRng=(000,10000),smt=0)
hs.load_rec()
hs.show_pos();hs.show_vel()
hs.interactive_anim()

View File

@@ -18,6 +18,34 @@
sodipodi:docname="helicalscan1.svg">
<defs
id="defs4">
<inkscape:path-effect
effect="spiro"
id="path-effect4596"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect4592"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect4588"
is_visible="true" />
<inkscape:path-effect
is_visible="true"
id="path-effect4584"
effect="spiro" />
<inkscape:path-effect
effect="spiro"
id="path-effect4580"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect4540"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect3650"
is_visible="true" />
<inkscape:path-effect
effect="spiro"
id="path-effect3724"
@@ -133,9 +161,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.8926215"
inkscape:cx="369.55834"
inkscape:cy="749.80396"
inkscape:zoom="1.3840277"
inkscape:cx="613.76584"
inkscape:cy="136.85913"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@@ -281,9 +309,9 @@
sodipodi:cy="373.53488"
sodipodi:rx="20.900398"
sodipodi:ry="5.2250996"
sodipodi:start="0.47984631"
sodipodi:end="3.2616514"
d="m -404.18498,375.94701 a 20.900398,5.2250996 0 0 1 -24.71557,2.57967 20.900398,5.2250996 0 0 1 -14.5744,-5.61761"
sodipodi:start="1.1988058"
sodipodi:end="0.71174827"
d="m -415.12833,378.40261 a 20.900398,5.2250996 0 0 1 -26.00072,-2.39137 20.900398,5.2250996 0 0 1 6.33652,-6.74251 20.900398,5.2250996 0 0 1 27.54003,0.75342 20.900398,5.2250996 0 0 1 0.35372,6.92555"
transform="scale(-1,1)"
sodipodi:open="true" />
<path
@@ -294,23 +322,23 @@
sodipodi:cy="192.17082"
sodipodi:rx="18.581232"
sodipodi:ry="4.645308"
sodipodi:start="6.0151975"
sodipodi:end="1.0471386"
d="m 439.44423,190.94078 a 18.581232,4.645308 0 0 1 -8.62642,5.25286"
sodipodi:start="0.63234095"
sodipodi:end="2.0378307"
d="m 436.51472,194.91636 a 18.581232,4.645308 0 0 1 -23.35449,1.40229"
sodipodi:open="true" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="428.61023"
y="384.22964"
x="431.80341"
y="384.86829"
id="text5154"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5156"
x="428.61023"
y="384.22964">φ<tspan
x="431.80341"
y="384.86829">φ<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5158">s</tspan></tspan></text>
id="tspan5158">0</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;baseline-shift:baseline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -323,7 +351,7 @@
x="469.13644"
y="214.94801">p<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5192">e</tspan></tspan></text>
id="tspan5192">1</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -336,20 +364,20 @@
x="312.47342"
y="415.07755">p<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5198">s</tspan></tspan></text>
id="tspan5198">0</tspan></tspan></text>
<text
sodipodi:linespacing="125%"
id="text5200"
y="187.17661"
x="435.12906"
y="203.88509"
x="416.34329"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="187.17661"
x="435.12906"
y="203.88509"
x="416.34329"
id="tspan5202"
sodipodi:role="line">φ<tspan
id="tspan5204"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub">e</tspan></tspan></text>
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub">1</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -362,7 +390,7 @@
x="65.620399"
y="373.21445">y<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5210">s</tspan></tspan></text>
id="tspan5210">0</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -375,7 +403,7 @@
x="64.260834"
y="192.74004">y<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5216">e</tspan></tspan></text>
id="tspan5216">1</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -387,7 +415,7 @@
sodipodi:role="line"
id="tspan5220"
x="3.9073553"
y="484.16422">v crystal</tspan></text>
y="484.16422">crystal</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -400,7 +428,7 @@
x="357.74579"
y="395.25363">r<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5226">s</tspan></tspan></text>
id="tspan5226">0</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Caligraphic;-inkscape-font-specification:MathJax_Caligraphic;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -413,7 +441,7 @@
x="439.08008"
y="203.08162">r<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub"
id="tspan5232">e</tspan></tspan></text>
id="tspan5232">1</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
id="path4228"
@@ -451,7 +479,7 @@
id="tspan4238"
sodipodi:role="line">x<tspan
id="tspan4240"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub">e</tspan></tspan></text>
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub">1</tspan></tspan></text>
<text
sodipodi:linespacing="125%"
id="text4242"
@@ -464,7 +492,7 @@
id="tspan4244"
sodipodi:role="line">x<tspan
id="tspan4246"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub">s</tspan></tspan></text>
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;baseline-shift:sub">0</tspan></tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 313.43382,405.30526 7.00627,0 -3.10069,-2.33388"
@@ -475,11 +503,6 @@
id="path4262"
d="m 470.10885,206.24745 7.00627,0 -3.10069,-2.33388"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 361.04398,306.084 4.97745,-4.93079 -3.84533,0.52411"
id="path4264"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path4266"
@@ -508,73 +531,69 @@
id="flowPara4337" /></flowRoot> <text
sodipodi:linespacing="125%"
id="text4339"
y="541.96143"
x="101.44707"
y="516.4162"
x="94.294395"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
id="tspan3453"
y="541.96143"
x="101.44707"
y="516.4162"
x="94.294395"
sodipodi:role="line">coord transformation:</tspan><tspan
y="560.71143"
x="101.44707"
y="535.1662"
x="94.294395"
sodipodi:role="line"
id="tspan3553">input ω,y,d<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3557">x</tspan>,d<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3559">z</tspan></tspan><tspan
y="579.46143"
x="101.44707"
id="tspan3553">input ω,y,dx,dz</tspan><tspan
y="553.9162"
x="94.294395"
sodipodi:role="line"
id="tspan3555">output: ω,x,y,z,</tspan><tspan
y="598.21143"
x="101.44707"
id="tspan3555">output: qω,qcx,qfy,qcz,</tspan><tspan
y="572.6662"
x="94.294395"
sodipodi:role="line"
id="tspan3541" /><tspan
y="616.96143"
x="101.44707"
id="tspan3561"></tspan><tspan
y="591.4162"
x="94.294395"
sodipodi:role="line"
id="tspan3561">d<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3573">x</tspan>,d<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3575">z</tspan> are translation from the vector v after rotation</tspan><tspan
y="635.71143"
x="101.44707"
id="tspan3550">dx,dz are translation from the vector v after rotation</tspan><tspan
y="610.1662"
x="94.294395"
sodipodi:role="line"
id="tspan3546">q vaiables are 'real motor' variables</tspan><tspan
y="628.9162"
x="94.294395"
sodipodi:role="line"
id="tspan3563" /><tspan
y="654.46143"
x="101.44707"
y="647.6662"
x="94.294395"
sodipodi:role="line"
id="tspan3547" /></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="101.0957"
y="514.2149"
x="93.943031"
y="488.66965"
id="text3461"
sodipodi:linespacing="125%"><tspan
id="tspan3475"
sodipodi:role="line"
x="101.0957"
y="514.2149">known values after fft: y<tspan
x="93.943031"
y="488.66965">known values after fft: y<tspan
id="tspan3473"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>, r<tspan
style="font-size:64.99999762%;baseline-shift:sub">0</tspan>, r<tspan
id="tspan3471"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>, x<tspan
style="font-size:64.99999762%;baseline-shift:sub">0</tspan>, x<tspan
id="tspan3469"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>, φ<tspan
style="font-size:64.99999762%;baseline-shift:sub">0</tspan>, φ<tspan
id="tspan3467"
style="font-size:64.99999762%;baseline-shift:sub">s, </tspan>y<tspan
style="font-size:64.99999762%;baseline-shift:sub">0, </tspan>y<tspan
id="tspan3483"
style="font-size:64.99999762%;baseline-shift:sub">e</tspan>, r<tspan
style="font-size:64.99999762%;baseline-shift:sub">1</tspan>, r<tspan
id="tspan3481"
style="font-size:64.99999762%;baseline-shift:sub">e</tspan>, x<tspan
style="font-size:64.99999762%;baseline-shift:sub">1</tspan>, x<tspan
id="tspan3479"
style="font-size:64.99999762%;baseline-shift:sub">e</tspan>, φ<tspan
style="font-size:64.99999762%;baseline-shift:sub">1</tspan>, φ<tspan
id="tspan3477"
style="font-size:64.99999762%;baseline-shift:sub">e</tspan></tspan></text>
style="font-size:64.99999762%;baseline-shift:sub">1</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:MathJax_Size1;-inkscape-font-specification:MathJax_Size1;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -600,40 +619,6 @@
style="-inkscape-font-specification:sans-serif;font-family:sans-serif;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal">φ<tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:64.99999762%;font-family:sans-serif;-inkscape-font-specification:sans-serif;baseline-shift:sub"
id="tspan4321">e</tspan></tspan></text>
<g
id="g3643"
transform="translate(-15.455292,12.364234)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="110.69898"
y="732.79047"
id="text4359"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4361"
x="110.69898"
y="732.79047">v=p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan4365">e</tspan>-p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan4363">s</tspan></tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 111.88677,722.10095 7.00627,0 -3.10069,-2.33388"
id="path3533"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3535"
d="m 133.33099,721.71457 7.00627,0 -3.10069,-2.33388"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 153.61606,721.32819 7.00627,0 -3.10069,-2.33388"
id="path3537"
inkscape:connector-curvature="0" />
</g>
<flowRoot
xml:space="preserve"
id="flowRoot3565"
@@ -659,7 +644,7 @@
id="tspan4373"
sodipodi:role="line">p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3936">s</tspan>(ω)=</tspan></text>
id="tspan3936">n</tspan>(ω)=</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4377"
@@ -672,11 +657,11 @@
id="tspan4395"
sodipodi:role="line">x<tspan
id="tspan4403"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>+r<tspan
style="font-size:64.99999762%;baseline-shift:sub">n</tspan>+r<tspan
id="tspan4401"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>·cos<tspan
style="font-size:64.99999762%;baseline-shift:sub">n</tspan>·sin<tspan
id="tspan4399"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>+ω)</tspan></text>
style="font-size:64.99999762%;baseline-shift:sub">n</tspan>+ω)</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@@ -687,13 +672,13 @@
sodipodi:role="line"
id="tspan4407"
x="131.06863"
y="738.32257">y<tspan
y="738.32257">z<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3696">n</tspan>+r<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan4409">s</tspan>+r<tspan
id="tspan4411">n</tspan>·cos(φ<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan4411">s</tspan>·sin(φ<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan4413">s</tspan>+ω)</tspan></text>
id="tspan4413">n</tspan>+ω)</tspan></text>
<path
inkscape:connector-curvature="0"
id="path3539"
@@ -711,7 +696,7 @@
id="tspan3656"
sodipodi:role="line">y<tspan
id="tspan3658"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan></tspan></text>
style="font-size:64.99999762%;baseline-shift:sub">n</tspan></tspan></text>
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
@@ -728,115 +713,76 @@
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="84.446236"
y="857.24939"
x="347.44675"
y="650.60614"
id="text3732"
sodipodi:linespacing="125%"><tspan
id="tspan3742"
sodipodi:role="line"
x="84.446236"
y="857.24939">output:</tspan><tspan
x="347.44675"
y="650.60614">output:</tspan><tspan
sodipodi:role="line"
x="84.446236"
y="875.99939"
id="tspan3763">ω=ω</tspan><tspan
x="347.44675"
y="669.35614"
id="tspan3763">qω=ω</tspan><tspan
sodipodi:role="line"
x="84.446236"
y="894.74939"
id="tspan3765">x=p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3778">sx</tspan>+v<tspan
x="347.44675"
y="688.10614"
id="tspan3765">qcx=p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3780">x</tspan>(y)+d<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3782">x</tspan></tspan><tspan
sodipodi:role="line"
x="84.446236"
y="913.49939"
id="tspan3767">y=y</tspan><tspan
x="347.44675"
y="706.85614"
id="tspan3767">qfy=y</tspan><tspan
sodipodi:role="line"
x="84.446236"
y="932.24939"
id="tspan3769">z=p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3784">sy</tspan>+v<tspan
x="347.44675"
y="725.60614"
id="tspan3769">qcz=p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3786">z</tspan>(y)+d<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3788">z</tspan></tspan><tspan
id="tspan3752"
sodipodi:role="line"
x="84.446236"
y="950.99939" /><tspan
x="347.44675"
y="744.35614" /><tspan
id="tspan3754"
sodipodi:role="line"
x="84.446236"
y="969.74939" /></text>
x="347.44675"
y="763.10614" /></text>
<g
id="g3894"
transform="translate(10.818705,-53.32076)">
<g
transform="translate(-86.356448,64.943501)"
id="g3624">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="280.89734"
y="797.20612"
id="text4417"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4419"
x="280.89734"
y="797.20612">v ·(y<tspan
id="tspan3641"
style="font-size:64.99999762%;baseline-shift:sub">e</tspan>-y<tspan
id="tspan3639"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>)</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.07920456px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 355.31423,784.61292 -80.18818,0"
id="path3598"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="286.20889"
y="778.62811"
id="text3600"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3602"
x="286.20889"
y="778.62811">v·(y-y<tspan
id="tspan3637"
style="font-size:64.99999762%;baseline-shift:sub">s</tspan>)</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 286.23752,769.09771 7.00627,0 -3.10069,-2.33388"
id="path3608"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 278.81444,787.34506 0,11.74818"
id="path3620"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 291.79208,787.07185 0,12.56782"
id="path3622"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3938"
d="m 281.37064,787.95979 7.00627,0 -3.10069,-2.33388"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 161.83971,777.23616 7.00627,0 -3.10069,-2.33388"
id="path3940"
inkscape:connector-curvature="0" />
</g>
<text
sodipodi:linespacing="125%"
id="text4417"
y="862.1496"
x="194.54089"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="862.1496"
x="194.54089"
id="tspan4419"
sodipodi:role="line" /></text>
<text
sodipodi:linespacing="125%"
id="text3600"
y="843.57159"
x="199.85245"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="843.57159"
x="199.85245"
id="tspan3602"
sodipodi:role="line" /></text>
<path
inkscape:connector-curvature="0"
id="path3940"
d="m 75.483262,842.17966 7.00627,0 -3.10069,-2.33388"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93431133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<g
transform="translate(55.189138,4.917844)"
id="g3860">
@@ -850,9 +796,13 @@
y="827.30298"
x="70.195465"
id="tspan3792"
sodipodi:role="line">v<tspan
sodipodi:role="line">p<tspan
id="tspan3796"
style="font-size:64.99999762%;baseline-shift:sub">x</tspan>(y)</tspan></text>
style="font-size:64.99999762%;baseline-shift:sub">0x</tspan>+scl·(p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3672">1x</tspan>-p<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3674">0x</tspan>)</tspan></text>
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
@@ -861,7 +811,7 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 107.80288,812.25612 5.40935,0 0,63.3667 -5.21616,0 0,0"
d="m 190.56327,811.74521 5.40935,0 0,63.3667 -5.21616,0 0,0"
id="path3818"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
@@ -875,9 +825,13 @@
sodipodi:role="line"
id="tspan3822"
x="70.195465"
y="846.34308">v<tspan
style="font-size:64.99999762%;baseline-shift:sub"
id="tspan3824">y</tspan>(y)</tspan></text>
y="846.34308">p<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3680">0y</tspan>+scl·(p<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3678">1y</tspan>-p<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3676">0y</tspan>)</tspan></text>
<text
sodipodi:linespacing="125%"
id="text3826"
@@ -888,9 +842,13 @@
y="867.29114"
x="70.519196"
id="tspan3828"
sodipodi:role="line">v<tspan
id="tspan3830"
style="font-size:64.99999762%;baseline-shift:sub">z</tspan>(y)</tspan></text>
sodipodi:role="line">p<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3686">0z</tspan>+scl·(p<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3684">1z</tspan>-p<tspan
style="font-size:65%;baseline-shift:sub"
id="tspan3682">0z</tspan>)</tspan></text>
</g>
<text
sodipodi:linespacing="125%"
@@ -902,18 +860,7 @@
y="852.44177"
x="74.771553"
id="tspan3834"
sodipodi:role="line">v(y)=</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="170.94273"
y="853.00574"
id="text3848"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3850"
x="170.94273"
y="853.00574">=</tspan></text>
sodipodi:role="line">p(y)=</tspan></text>
</g>
<flowRoot
xml:space="preserve"
@@ -925,5 +872,105 @@
height="54.642712"
x="56.828419"
y="805.37714" /></flowRegion><flowPara
id="flowPara3858" /></flowRoot> </g>
id="flowPara3858" /></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3556"
style="fill:black;stroke:none;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:15px;line-height:125%;letter-spacing:0px;word-spacing:0px"><flowRegion
id="flowRegion3558"><rect
id="rect3560"
width="125.79026"
height="60.134426"
x="179.22008"
y="763.85321" /></flowRegion><flowPara
id="flowPara3562"></flowPara></flowRoot> <g
id="g3652"
transform="translate(-139.98799,-0.51090509)">
<text
sodipodi:linespacing="125%"
id="text3552"
y="740.19922"
x="221.22189"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="740.19922"
x="221.22189"
id="tspan3554"
sodipodi:role="line">scl=</tspan></text>
<text
sodipodi:linespacing="125%"
id="text3552-3"
y="728.49036"
x="259.22372"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
id="tspan3604"
y="728.49036"
x="259.22372"
sodipodi:role="line">y-y<tspan
id="tspan3564-7"
style="font-size:64.99999762%;baseline-shift:sub">0</tspan></tspan><tspan
id="tspan3609"
y="747.24036"
x="259.22372"
sodipodi:role="line">y<tspan
id="tspan3611"
style="font-size:64.99999762%;baseline-shift:sub">1</tspan>-y<tspan
id="tspan3613"
style="font-size:64.99999762%;baseline-shift:sub">0</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
inkscape:original-d="m 257.49616,734.57924 42.91603,0"
inkscape:path-effect="#path-effect3650"
id="path3648"
d="m 257.49616,734.57924 42.91603,0"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<circle
style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4534"
cx="503.2533"
cy="915.08173"
r="107.65681" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.67399621px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 389.01618,915.08171 123.25682,0"
id="path4578"
inkscape:path-effect="#path-effect4580"
inkscape:original-d="m 389.01618,915.08171 123.25682,0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
inkscape:connector-curvature="0"
inkscape:original-d="m 415.30888,988.54423 0,-92.76905"
inkscape:path-effect="#path-effect4584"
id="path4582"
d="m 415.30888,988.54423 0,-92.76905"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.53006274px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 514.25995,907.1339 401.54544,987.8765"
id="path4586"
inkscape:path-effect="#path-effect4588"
inkscape:original-d="M 514.25995,907.1339 401.54544,987.8765"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 503.2533,1022.7385 0,-215.31358"
id="path4594"
inkscape:path-effect="#path-effect4596"
inkscape:original-d="m 503.2533,1022.7385 0,-215.31358"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="437.85251"
y="905.32758"
id="text4598"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4600"
x="437.85251"
y="905.32758">p1x-p0x</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -11,33 +11,39 @@
zamofing_t@ganymede:~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg$ gpasciiCommander --host $PPMAC -i
$$$***
!common()
!mx-stage()
!SAR-EXPMX1()
enable plc 1
Motor[1].MaxSpeed=25
Motor[2].MaxSpeed=25
X -12000 ..12000
Y -12000 .. 12000
Gather.Enable=0
Gather.Items=6
Gather.MaxSamples=1000000
Gather.Period=10
Gather.Addr[0]=Motor[2].DesPos.a
Gather.Addr[1]=Motor[3].DesPos.a
Gather.Addr[2]=Motor[2].ActPos.a
Gather.Addr[3]=Motor[3].ActPos.a
Gather.Addr[4]=Motor[4].ActPos.a
Gather.Addr[5]=Motor[5].ActPos.a
Gather.Addr[0]=Motor[1].DesPos.a
Gather.Addr[1]=Motor[2].DesPos.a
Gather.Addr[2]=Motor[1].ActPos.a
Gather.Addr[3]=Motor[2].ActPos.a
Gather.Addr[4]=Motor[6].ActPos.a
Gather.Addr[5]=Motor[7].ActPos.a
open prog 2
linear abs
X1000 Y1000
X-12000 Y-12000
dwell 10
Gather.Enable=2
X28000 Y1000
X-12000 Y12000
dwell 100
X1000 Y1000
X-12000 Y-12000
dwell 100
X1000 Y28000
X12000 Y-12000
dwell 100
X1000 Y1000
X-12000 Y-12000
dwell 1000
Gather.Enable=0
close
#1..7j/
&1
b2r
@@ -57,43 +63,217 @@ b2r
'''
import os, sys, json
import os, sys, json, time
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import subprocess as sprc
import telnetlib
if __name__=='__main__':
def plot_gather(base):
#rec=Motor[1].ActPos,Motor[2].ActPos,Motor[3].ActPos,Motor[1].DesPos,Motor[2].DesPos,Motor[3].DesPos
#res=rot.ActPos,y.ActPos,x.ActPos,rot.DesPos,y.DesPos,x.DesPos
class Interferometer():
def __init__(self,**kwargs):
for k,v in kwargs.iteritems():
setattr(self,k,v)
def gen_prog(self,prgId=2,mode=0,**kwargs):
'''
kwargs:
acq_per : acquire period: acquire data all acq_per servo loops (default=1)
mode=0: test motion
xrng:
yrng:
spd:
'''
prg=[]
acq_per=kwargs.get('acq_per',10)
gather={"MaxSamples":1000000, "Period":acq_per}
#Sys.ServoPeriod is dependent of !common() macro
ServoPeriod= .2 #0.2ms
#ServoPeriod = .05
self.meta = {'timebase': ServoPeriod*gather['Period']}
channels=["Motor[1].DesPos","Motor[2].DesPos","Motor[1].ActPos","Motor[2].ActPos","Motor[6].ActPos","Motor[7].ActPos"]
prg.append('Gather.Enable=0')
prg.append('Gather.Items=%d'%len(channels))
for k,v in gather.iteritems():
prg.append('Gather.%s=%d'%(k,v))
for i,c in enumerate(channels):
prg.append('Gather.Addr[%d]=%s.a'%(i,c))
prg.append('open prog %d'%(prgId))
prg.append(' P1000=0')
# this uses Coord[1].Tm and limits with MaxSpeed
#******** mode -1 ********
if mode==0: #### jog all motors 10000um (or 10000 mdeg)
xRng = kwargs.get('xRng', (-12000,12000))
yRng = kwargs.get('yRng', (-12000,12000))
spd = kwargs.get('spd', 10)
prg.append('Motor[1].MaxSpeed=%f'%spd)
prg.append('Motor[2].MaxSpeed=%f'%spd)
prg.append('''
linear abs
X%g Y%g
dwell 10
Gather.Enable=2
X%g Y%g
dwell 100
X%g Y%g
dwell 100
X%g Y%g
dwell 100
X%g Y%g
dwell 100
Gather.Enable=0
'''%(xRng[0],yRng[0],xRng[0],yRng[1],xRng[0],yRng[0],xRng[1],yRng[0],xRng[0],yRng[0]))
prg.append(' P1000=1')
prg.append('close')
prg.append('&1\nb%dr\n'%prgId)
self.download(prg,mode=3,file='/tmp/prg.cfg')
def download(self,prg=None,mode=0,file='/tmp/interfero.cfg'):
'''
mode bits:
bit 0 (1): wait execution finished (P1000==1)
bit 1 (2): gather and save data
bit 2 (4): ...
'''
host=self.host
if prg is not None and self.verbose & 4:
for ln in prg:
print(ln)
if file is not None and prg is not None:
fh=open(file,'w')
fh.write('\n'.join(prg))
fh.close()
if host is not None:
# ***download and start the program***
cmd ='gpasciiCommander --host '+host+' '+ file
print(cmd)
p = sprc.Popen(cmd, shell=True)#, stdout=sprc.PIPE, stderr=sprc.STDOUT)
#res=p.stdout.readlines(); print res
retval = p.wait()
if mode &1:
# ***wait program finished P1000=1***
com=GpasciiCommunicator().connect(host,prompt='# ')
ack=GpasciiCommunicator.gpascii_ack
sys.stdout.write('wait execution...');sys.stdout.flush()
while(True):
#Gather.MaxLines calculates maximum numbewr of gathering into memory
com.write('P1000\n')
val=com.read_until(ack)
#print val
val=int(val[val.find('=')+1:].rstrip(ack))
if val==1:break
#com.write('Gather.Index\n')
#val=com.read_until(ack)
#print val
time.sleep(.2)
sys.stdout.write('.');sys.stdout.flush()
if mode &2:
fnRmt = '/var/ftp/gather/out.txt'
fnLoc = '/tmp/gather.txt'
print('\ngather data to %s...' % fnRmt)
p = sprc.Popen(('ssh', 'root@' + host, 'gather ', '-u', fnRmt), shell=False, stdin=sprc.PIPE, stdout=sprc.PIPE,
stderr=sprc.PIPE)
res = p.wait()
if res:
print('ssh failed. ssh root@%s to open a session' % host)
return
print('transfer data to %s...' % fnLoc)
p = sprc.Popen(('scp', 'root@' + host + ':' + fnRmt, fnLoc), shell=False, stdin=sprc.PIPE, stdout=sprc.PIPE,
stderr=sprc.PIPE)
res = p.wait()
self.rec = np.genfromtxt(fnLoc, delimiter=' ')
def show_pos(self):
rec=self.rec
#"M1.DesPos","M2.DesPos","M1.ActPos","M2.ActPos","M6.ActPos","M7.ActPos"]
#idx 0 1 2 3 4 5
f1=plt.figure()
#f2 = plt.figure()
ax1 = f1.add_subplot(1,1,1)
#ax2 = f2.add_subplot(1, 1, 1)
for fn in sorted(os.listdir(base)):
print fn
rec = np.genfromtxt(base+'/'+fn, delimiter=' ')
print rec.shape
x=range(len(rec[:,0]))
x=range(len(rec[:,0]))
#hl=ax[0].plot(x, y, color=col)
hl=ax1.plot(x,-(rec[:,0]-rec[0,0]),'k')
hl=ax1.plot(x,-(rec[:,2]-rec[0,2]),'r')
hl=ax1.plot(x,-(rec[:,4]-rec[0,4])/100,'m')
hl=ax1.plot(x,rec[:,1]-rec[0,1],'k')
hl=ax1.plot(x,rec[:,3]-rec[0,3],'b')
hl=ax1.plot(x,-(rec[:,5]-rec[0,5])/100,'c')
hl=ax1.plot(x,-(rec[:,0]-rec[0,0]),'k')
hl=ax1.plot(x,-(rec[:,2]-rec[0,2]),'r')
hl=ax1.plot(x,-(rec[:,4]-rec[0,4])/100,'m')
hl=ax1.plot(x,rec[:,1]-rec[0,1],'k')
hl=ax1.plot(x,rec[:,3]-rec[0,3],'b')
hl=ax1.plot(x,-(rec[:,5]-rec[0,5])/100,'c')
#hl=ax1.plot(x,-(rec[:,0]-rec[0,0]),'k')
#hl=ax1.plot(x,-(rec[:,2]-rec[0,2]),'r')
#hl=ax1.plot(x,-(rec[:,4]-rec[0,4])/100,'m')
#hl=ax1.plot(x,rec[:,1]-rec[0,1],'k')
#hl=ax1.plot(x,rec[:,3]-rec[0,3],'b')
#hl=ax1.plot(x,-(rec[:,5]-rec[0,5])/100,'c')
plt.show()
#plot_gather(base='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/gather5/')
#plot_gather(base='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/gather50/')
#plot_gather(base='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/tmp/')
#plot_gather(base='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/data_interfero_spd10')
#plot_gather(base='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/data_interfero_spd20')
plot_gather(base='data_interfero_spd10')
def show_poserr(self):
rec=self.rec
#"M1.DesPos","M2.DesPos","M1.ActPos","M2.ActPos","M6.ActPos","M7.ActPos"]
#idx 0 1 2 3 4 5
f1=plt.figure()
ax1 = f1.add_subplot(1,1,1)
t=range(len(rec[:,0]))
actYerr=(rec[:,2]-rec[:,0]);actYerr-=actYerr[0]
actXerr=(rec[:,3]-rec[:,1]);actXerr-=actXerr[0]
infYerr=(rec[:,4]-rec[:,0]);infYerr-=infYerr[0]
infXerr=(rec[:,5]-rec[:,1]);infXerr-=infXerr[0]
hl=ax1.plot(t,actYerr,'r',label='actYerr')
hl=ax1.plot(t,actXerr,'b',label='actXerr')
hl=ax1.plot(t,infYerr,'m',label='infYerr')
hl=ax1.plot(t,infXerr,'c',label='infXerr')
#plt.legend(handles=h)
ax1.legend()
plt.show()
class GpasciiCommunicator():
'''Communicates with the Delta Tau gpascii programm
'''
gpascii_ack="\x06\r\n"
gpascii_inp='Input\r\n'
def connect(self, host, username='root', password='deltatau',prompt='ppmac# ',verbose=0):
p=telnetlib.Telnet(host)
s=p.read_until('login: ')
if verbose: print(s)
p.write(username+'\n')
s =p.read_until('Password: ')
if verbose: print(s)
p.write(password+'\n')
s =p.read_until(prompt) # command prompt
if verbose: print(s)
p.write('gpascii -2\n') # execute gpascii command
s=p.read_until(self.gpascii_inp)
if verbose: print(s)
return p
if __name__=='__main__':
ifm=Interferometer(verbose = 255,host='SAR-CPPM-EXPMX1')
os.chdir(os.path.join(os.path.dirname(__file__), '../cfg'))
ifm.download(['$$$***','!common()','!SAR-EXPMX1()','#1..7j/','enable plc 1','Motor[1].MaxSpeed=25','Motor[2].MaxSpeed=25'])
raw_input('press return when homed')
#ifm.gen_prog(mode=0)
#ifm.show_poserr()
#ifm.gen_prog(mode=0,xRng=(-10000,10000),yRng=(-10000,10000),spd=10)
ifm.gen_prog(mode=0,xRng=(-5000,5000),yRng=(-5000,5000),spd=5)
ifm.show_poserr()
#ifm.gen_prog(mode=0,xRng=(-2000,2000),yRng=(4000,8000),spd=5)
#ifm.show_poserr()
#ifm.rec = np.genfromtxt('/scratch/gather.txt', delimiter=' ')
#ifm.show_pos()