diff --git a/.gitignore b/.gitignore index 2f836aa..5dd1a68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,10 @@ +.tmp_versions/ +.idea/ *~ *.pyc +usralgo.ko +usralgo.mod.c +*.o +*o.cmd +Module.symvers +modules.order diff --git a/PBinspect.pbi b/PBinspect.pbi new file mode 100644 index 0000000..b8dcdcc --- /dev/null +++ b/PBinspect.pbi @@ -0,0 +1,95 @@ +[ + [ + "MotorListCtrl", + [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "name=p;caption=motor pos;state=67377148;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=200;besth=350;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1;notebookid=-1;transparent=255" + ], + [ + "WatchListCtrl", + [ + ["EncTable[1].PrevEnc",null], + ["Motor[1].Pos","lambda v: '%.8g'%float(v)"], + ["Motor[1].DesPos","lambda v: '%.8g'%float(v)"], + ["Motor[1].PosError","lambda v: '%.8g'%float(v)"], + ["Motor[1].Servo.Integrator","lambda v: '%.8g'%float(v)"], + ["Motor[1].ServoOut","lambda v: '%.8g'%float(v)"], + ["Motor[1].idCmd","lambda v: '%.8g'%float(v)"], + ["Motor[1].iqCmd","lambda v: '%.8g'%float(v)"], + ["Motor[1].idMeas","lambda v: '%.8g'%float(v)"], + ["Motor[1].iqMeas","lambda v: '%.8g'%float(v)"], + ["Motor[1].iaMeas","lambda v: '%.8g'%float(v)"], + ["Motor[1].ibMeas","lambda v: '%.8g'%float(v)"], + ["Motor[1].I2tSum","lambda v: '%.8g'%float(v)"], + ["EncTable[2].PrevEnc",null], + ["Motor[2].Pos","lambda v: '%.8g'%float(v)"], + ["Motor[2].DesPos","lambda v: '%.8g'%float(v)"], + ["Motor[2].PosError","lambda v: '%.8g'%float(v)"], + ["Motor[2].Servo.Integrator","lambda v: '%.8g'%float(v)"], + ["Motor[2].ServoOut","lambda v: '%.8g'%float(v)"], + ["Motor[2].idCmd","lambda v: '%.8g'%float(v)"], + ["Motor[2].iqCmd","lambda v: '%.8g'%float(v)"], + ["Motor[2].idMeas","lambda v: '%.8g'%float(v)"], + ["Motor[2].iqMeas","lambda v: '%.8g'%float(v)"], + ["Motor[2].iaMeas","lambda v: '%.8g'%float(v)"], + ["Motor[2].ibMeas","lambda v: '%.8g'%float(v)"], + ["Motor[2].I2tSum","lambda v: '%.8g'%float(v)"], + ["EncTable[3].PrevEnc",null], + ["Motor[3].Pos","lambda v: '%.8g'%float(v)"], + ["Motor[3].DesPos","lambda v: '%.8g'%float(v)"], + ["Motor[3].PosError","lambda v: '%.8g'%float(v)"], + ["Motor[3].Servo.Integrator","lambda v: '%.8g'%float(v)"], + ["Motor[3].ServoOut","lambda v: '%.8g'%float(v)"], + ["Motor[3].idCmd","lambda v: '%.8g'%float(v)"], + ["Motor[3].iqCmd","lambda v: '%.8g'%float(v)"], + ["Motor[3].idMeas","lambda v: '%.8g'%float(v)"], + ["Motor[3].iqMeas","lambda v: '%.8g'%float(v)"], + ["Motor[3].iaMeas","lambda v: '%.8g'%float(v)"], + ["Motor[3].ibMeas","lambda v: '%.8g'%float(v)"], + ["Motor[3].I2tSum","lambda v: '%.8g'%float(v)"] + ], + "name=w;caption=watch;state=67377148;dir=4;layer=0;row=1;pos=0;prop=100000;bestw=200;besth=369;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=221;floaty=858;floatw=208;floath=377;notebookid=-1;transparent=255" + ], + [ + "StatusMotorListCtrl", + [ + 1 + ], + "name=m1;caption=motor1;state=67377148;dir=4;layer=0;row=2;pos=0;prop=100000;bestw=200;besth=669;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=485;floaty=810;floatw=208;floath=677;notebookid=-1;transparent=255" + ], + [ + "StatusMotorListCtrl", + [ + 3 + ], + "name=m3;caption=motor3;state=67377148;dir=4;layer=0;row=5;pos=0;prop=100000;bestw=200;besth=669;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=694;floaty=941;floatw=208;floath=677;notebookid=-1;transparent=255" + ], + [ + "StatusGblListCtrl", + [], + "name=g;caption=global;state=67377148;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=369;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=2058;floaty=457;floatw=208;floath=377;notebookid=-1;transparent=255" + ], + [ + "StatusMotorListCtrl", + [ + 2 + ], + "name=m2;caption=motor2;state=67377148;dir=4;layer=0;row=4;pos=0;prop=100000;bestw=200;besth=669;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=2588;floaty=946;floatw=208;floath=677;notebookid=-1;transparent=255" + ] +] \ No newline at end of file diff --git a/Readme.md b/Readme.md index 54740de..8df6415 100644 --- a/Readme.md +++ b/Readme.md @@ -79,4 +79,67 @@ Tested with shapepath.py: THE BEST TRAJECTORY RESULT IST WITH PVT MOTION +Optimize/Test Parameters with Parker Stage +------------------------------------------ + +cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg +gpasciiCommander --host SAROP11-CPPM-MOT6871 -i +!mx-stage() +#1..3$ +&1 +#1..3j/ + +load program prg/testPerfGrid.prg +b2r + +cd ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/src/usrServo +make #will install the user servo loop +watch P3000 (average following error) +tweak servo parameters ->!motor_servo(mot=3,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000) + +Same for motor 2 -> watcp P2000 +Increase load will need an increase of gains to compensate following error + +Motor[2].Servo.Kp=20 +Motor[2].Servo.Kvfb=1000 +Motor[2].Servo.Ki=0.07 +Motor[2].Servo.Kvff=1000 +Motor[2].Servo.Kaff=4000 + + +Motor[3].Servo.Kp=20 +Motor[3].Servo.Kvfb=220 +Motor[3].Servo.Ki=0.02 +Motor[3].Servo.Kvff=240 +Motor[3].Servo.Kaff=1500 + + ./shapepath.py --yx +average error x 0.313575 um, y 0.461707 um, 0.629583 um + +./shapepath.py +average error x 0.371877 um, y 0.317152 um, 0.542073 um + + + +Start motion on external signal +------------------------------- + +open plc 1 +Coord[1].DesTimeBase=0 // freezes timebase at boot +while(1) +{ + if(PowerBrick[0].GpioData[0].0.1==1) + { + PowerBrick[0].GpioData[0].16.8=255 + Coord[1].DesTimeBase=Sys.ServoPeriod + } + else + { + PowerBrick[0].GpioData[0].16.8=7 + Coord[1].DesTimeBase=0 + } +} +close +enable plc 1 +-> run motion program. press gpio 0 to run at 100% diff --git a/cfg/torqueCtrl.cfg b/cfg/torqueCtrl.cfg index 836b346..7d1b017 100644 --- a/cfg/torqueCtrl.cfg +++ b/cfg/torqueCtrl.cfg @@ -63,7 +63,7 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a //use um as motor unit !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=16,Kvfb=800,Ki=0.001,Kvff=1000,Kaff=0,MaxInt=1000) +!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=1000,Ki=0.07,Kvff=1000,Kaff=4000,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) @@ -76,9 +76,8 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a !encoder_sim(enc=3,tbl=11,mot=11,posSf=13000./2048) !encoder_inc(enc=3,tbl=3,mot=3,posSf=13000./650000) -!motor_servo(mot=3,ctrl='ServoCtrl',Kp=10,Kvfb=220,Ki=0.001,Kvff=240,Kaff=0,MaxInt=1000) -//PhaseFreq=20000,PhasePerServo=1 -//!motor_servo(mot=3,ctrl='ServoCtrl',Kp=10,Kvfb=220*4,Ki=0.001/4,Kvff=240*4,Kaff=0*4*4,MaxInt=1000) +!motor_servo(mot=3,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000) +//PhaseFreq=20000,PhasePerServo=1 -> Kvfb=220*4 Ki/=4,Kvff*=4,Kaff*=4*4 !motor(mot=3,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=2000,WarnFeLimit=100,InPosBand=2) diff --git a/logbook.md b/logbook.md index 793e7f1..1fb5bfe 100644 --- a/logbook.md +++ b/logbook.md @@ -487,3 +487,115 @@ fn='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/data fh=np.load(fn) scipy.io.savemat(fn[:-3]+'mat',mdict=dict(fh.iteritems())) + +compensate position depenmdent friction 1.2.2017 +------------------------------------------------ + +Git tag: 3fafe53 +gpasciiCommander --host SAROP11-CPPM-MOT6871 -i +!mx-stage() +&1 #1->0 +&1 #2->0 +#3$ +an anschlag (kabel) bewegen +#3hmz +Motor[3].PhasePos=1200 +#3j/ + +./move_record.py +abs average pos Error 2.1890901307 + +Motor[3].Servo.Kp=10 +Motor[3].Servo.Kvfb=100 +Motor[3].Servo.Kvff=100 +abs average pos Error 1.89392140871 + +/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/src/usrServo/usrcode.c +line 100: c=0.f; //no friction compensation at all +abs average pos Error 1.82212631688 + +line 85: c=0.f; //do not use friction lut +abs average pos Error 1.47794399154 + +using friction lut: +abs average pos Error 0.893315213359 + +But if it is put vertically, the value becomes bad again. +check friction on vertical stage + +average PosError to P3000 2.2.2017 +---------------------------------- + +modify programm generated by ./move_record.py: + +open prog 2 +N0: +linearabs +X505.488Y7.15189 +dwell10 +pvt10abs +X505.488:2526.97Y7.15189:-85.15309999999999 +X556.028:4937.42Y5.44883:-34.6476 +... +X508.588:0Y954.585:0 +X508.588Y954.585 +dwell10 +goto 0 +close + + + + +modify user servo to average PosError to P3000 2.2.2017 +tweak parameters: +Motor[3].Servo.Kp +Motor[3].Servo.Kvfb +Motor[3].Servo.Ki +Motor[3].Servo.Kvff +Motor[3].Servo.Kaff + +Kp = 10 10 10 10 10 10 20 +Kvfb = 220 220 220 220 220 220 220 +Ki = 0.001 0.01 0.02 0.01 0 0 0.02 +Kvff = 240 240 240 240 240 240 240 +Kaff = 0 0 0 20 1500 1500 1500 + 1.3 .53 .43 0.52 1.88 0.7 0.1 + A + +A: Higher Ki than 0.02 do not help + +Set Ki to 0 and seek optimal Kvff +Kvff =240 local minimum +Kvfb =220 local minimum +Kaff =1500 Kaff does not change the error amount, but makes the error smoother at 1500 +Kp =20 average error becomes smaller + + +Motor[3].Servo.Kvff + +commit after: 3fafe53 +./move_record.py +>>>>>>>> abs average pos Error 0.353193239442 <<<<<<< + +./shapepath.py gen_rand_points(n=400, scale=1000) +Random path at speed: +%100 average error x 1.32075 um, y 0.940694 um, 1.84578 um +%50 average error x 0.336186 um, y 0.259554 um, 0.478149 um +%25 average error x 0.177138 um, y 0.077619 um, 0.209937 um + + +./shapepath.py gen_grid_points(w=20,h=20,pitch=50,rnd=0.2) +Grid path at speed: +%100 average error x 0.363065 um, y 0.314149 um, 0.536246 um +%50 average error x 0.246374 um, y 0.0985771 um, 0.283925 um +%25 average error x 0.150303 um, y 0.0429124 um, 0.163468 um + + + +> + + + + + + diff --git a/prg/testPerfGridXY.prg b/prg/testPerfGridXY.prg new file mode 100644 index 0000000..5f05b31 --- /dev/null +++ b/prg/testPerfGridXY.prg @@ -0,0 +1,432 @@ +//this program is generated with ./shapepath.py +//cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg") +//then modifiing start and end to not use gathering and to make a loop + +open plc 1 +Coord[1].DesTimeBase=0 // freezes timebase at boot +while(1) +{ + if(PowerBrick[0].GpioData[0].0.1==1) + { + PowerBrick[0].GpioData[0].16.8=255 + Coord[1].DesTimeBase=Sys.ServoPeriod + } + else + { + PowerBrick[0].GpioData[0].16.8=7 + Coord[1].DesTimeBase=0 + } +} +close + +open prog 2 +N0: +linearabs +X505.488Y7.15189 +dwell10 +pvt10abs +X505.488:2526.97Y7.15189:-85.15309999999999 +X556.028:4937.42Y5.44883:-34.6476 +X604.237:4917.41Y6.45894:173.445 +X654.376:5270Y8.917730000000001:-131.226 +X709.6369999999999:5177.07Y3.83442:-181.439 +X757.917:4802.19Y5.28895:271.078 +X805.6799999999999:4639.66Y9.25597:-220.883 +X850.71:4726.09Y0.871293:-46.4884 +X900.202:5353.56Y8.3262:391.441 +X957.782:5479.2Y8.70012:-16.7306 +X1009.79:4841.66Y7.99159:-44.7415 +X1054.61:4569.83Y7.80529:-79.61879999999999 +X1101.18:4840.94Y6.39921:82.0699 +X1151.43:5201.79Y9.44669:-112.63 +X1205.22:5060.6Y4.14662:-85.2176 +X1252.65:4967.15Y7.74234:76.886 +X1304.56:4877.12Y5.68434:-78.2991 +X1350.19:5077.97Y6.17635:24.25 +X1406.12:5462.48Y6.16934:32.0924 +X1459.44:2342.02Y6.8182:2250.9 +X1452.96:-2830.47Y51.1873:2219.19 +X1402.83:-4778.44Y51.202:-39.77 +X1357.39:-4653.02Y50.3919:242.324 +X1309.77:-4881.4Y56.0485:214.732 +X1259.76:-5069.41Y54.6865:-254.374 +X1208.38:-5077.73Y50.961:-185.775 +X1158.21:-5320.68Y50.971:136.313 +X1101.97:-5082.33Y53.6873:20.5408 +X1056.56:-5018.81Y51.3818:-129.175 +X1001.59:-5095.01Y51.1038:53.1213 +X954.663:-4752.93Y52.4443:71.45820000000001 +X906.5309999999999:-5128.72Y52.5329:-41.558 +X852.0890000000001:-4832.37Y51.6131:-75.6234 +X809.884:-4819.34Y51.0204:138.646 +X755.702:-5336.47Y54.386:130.833 +X703.154:-5179.91Y53.6371:-154.838 +X652.104:-4824.33Y51.2893:153.464 +X606.668:-4756.38Y56.7064:-34.3504 +X556.976:-5153.63Y50.6023:-116.803 +X503.595:-2689.82Y54.3703:2677.02 +X503.18:2352.32Y104.143:2627.72 +X550.641:5124.31Y106.925:-74.43680000000001 +X605.6660000000001:5229.55Y102.654:-299.266 +X655.232:5004.67Y100.939:331.953 +X705.759:4897.66Y109.293:286.735 +X753.186:4777.93Y106.674:-106.484 +X801.318:4985.42Y107.163:-242.11 +X852.894:5227.36Y101.832:-348.11 +X905.865:5269.77Y100.201:-89.2479 +X958.289:5045.65Y100.047:124.95 +X1006.78:4953.13Y102.7:478.747 +X1057.35:4785.47Y109.622:153.075 +X1102.49:4928.42Y105.762:-194.968 +X1155.92:4987.16Y105.723:188.296 +X1202.23:4927.54Y109.527:137.078 +X1254.47:5238.2Y108.464:-327.656 +X1306.99:5183.34Y102.974:-224.951 +X1358.14:5090.81Y103.965:141.918 +X1408.81:5033.97Y105.813:148.013 +X1458.82:2263.04Y106.925:2243.95 +X1454.07:-2537.21Y150.692:2438.28 +X1408.07:-5141.68Y155.691:389.421 +X1351.24:-5322.41Y158.48:23.2294 +X1301.62:-4987.19Y156.156:10.0589 +X1251.49:-4724.13Y158.681:191.644 +X1207.14:-5024.61Y159.988:25.6783 +X1151:-4954.02Y159.195:-147.479 +X1108.06:-4832.18Y157.039:-13.7796 +X1054.36:-4954.82Y158.919:-168.163 +X1008.97:-4891.88Y153.676:-230.252 +X956.521:-5161.11Y154.314:142.819 +X905.7430000000001:-5041.07Y156.532:79.7272 +X855.7:-5219.43Y155.909:-177.459 +X801.355:-4975.97Y152.983:-81.05200000000001 +X756.1799999999999:-4737.65Y154.288:-4.10236 +X706.602:-5299.41Y152.901:-63.5969 +X650.192:-5118.16Y153.016:158.158 +X604.239:-4531.55Y156.064:171.208 +X559.561:-4849.3Y156.44:-52.5344 +X507.253:-2629.33Y155.013:2404.78 +X506.974:2498.4Y204.535:2682.53 +X557.221:5139.05Y208.664:201.13 +X609.755:4644.83Y208.558:-253.202 +X650.117:4877.23Y203.6:-342.087 +X707.3:5254.66Y201.716:-152.82 +X755.21:4735Y200.543:-76.5539 +X802:5136.33Y200.185:84.7933 +X857.937:5072.68Y202.239:454.78 +X903.454:4955.36Y209.281:-96.0429 +X957.044:4909.67Y200.318:-153.301 +X1001.65:4936.41Y206.215:103.027 +X1055.77:5384.76Y202.379:-3.75622 +X1109.34:4979.2Y206.14:176.009 +X1155.36:4897.95Y205.899:-151.01 +X1207.3:4931.29Y203.119:-190.033 +X1253.98:4728.04Y202.098:316.214 +X1301.86:5170.66Y209.444:140.308 +X1357.4:5020.61Y204.905:-345.008 +X1402.27:4659.24Y202.544:-28.0211 +X1450.58:2525.11Y204.344:2666.21 +X1452.78:-2341.93Y255.868:2514.58 +X1403.74:-5035.08Y254.636:-81.04940000000001 +X1352.07:-4927.98Y254.247:-218.956 +X1305.18:-4976.76Y250.257:-105.687 +X1252.54:-4785.42Y252.133:352.597 +X1209.47:-4783.23Y257.309:1.09785 +X1156.87:-5380.87Y252.155:110.968 +X1101.86:-5206.97Y259.528:291.27 +X1052.74:-4778.33Y257.98:-40.0705 +X1006.29:-4842.61Y258.727:16.5008 +X955.883:-5154.48Y258.31:-244.593 +X903.2:-5283.83Y253.835:-36.3349 +X850.207:-4828.47Y257.584:-60.0708 +X806.631:-4515.16Y252.633:-270.741 +X759.903:-5063.25Y252.169:316.674 +X705.366:-5155.47Y258.967:118.4 +X656.794:-5255.95Y254.537:-414.711 +X600.247:-5150.82Y250.672:-137.047 +X553.778:-4856.44Y251.796:314.547 +X503.118:-2256.95Y256.963:2468.96 +X508.639:2602.79Y301.175:2217.86 +X555.174:4926.5Y301.321:139.264 +X607.169:5024.02Y303.961:25.6059 +X655.654:4713.99Y301.833:45.9983 +X701.448:4895.1Y304.881:378.576 +X753.556:5310.24Y309.404:130.304 +X807.653:5274.05Y307.487:-428.505 +X859.037:4893.43Y300.834:-82.0938 +X905.522:5029.11Y305.845:104.363 +X959.619:4844.32Y302.921:-242.091 +X1002.41:4527.25Y301.003:318.691 +X1050.16:5214.54Y309.295:342.429 +X1106.7:5132.65Y307.852:-171.56 +X1152.82:4697.02Y305.864:-149.763 +X1200.64:5347.88Y304.856:145.048 +X1259.77:5137.1Y308.765:237.971 +X1303.38:4627.1Y309.616:36.4068 +X1352.32:5301.61Y309.493:-81.18380000000001 +X1409.41:5199.37Y307.992:-37.5154 +X1456.3:2459.59Y308.743:2463.92 +X1458.61:-2604.95Y357.27:2341.54 +X1404.21:-5094.25Y355.574:-240.839 +X1356.72:-5170.51Y352.454:-233.883 +X1300.8:-4950.73Y350.896:-49.2103 +X1257.71:-4676.96Y351.469:-39.0878 +X1207.26:-5319.05Y350.114:-46.7597 +X1151.32:-5159.18Y350.534:110.403 +X1104.07:-4899.67Y352.322:13.8371 +X1053.33:-4750.34Y350.811:270.907 +X1009.07:-4680.11Y357.74:439.867 +X959.729:-5404.36Y359.608:44.0721 +X900.978:-5230.8Y358.622:-368.259 +X855.1130000000001:-4637.86Y352.243:-336.172 +X808.221:-5071.37Y351.898:-43.7084 +X753.686:-5162.36Y351.369:224.812 +X704.974:-4693.38Y356.395:170.735 +X659.818:-5075.08Y354.784:-245.666 +X603.472:-5181.98Y351.481:-232.567 +X556.179:-5027.11Y350.132:350.401 +X502.93:-2673.77Y358.489:2559.12 +X502.703:2381.18Y401.315:2226.33 +X550.554:4995.9Y403.016:162.329 +X602.621:5313.95Y404.561:197.013 +X656.833:5010.7Y406.956:-38.1068 +X702.835:4748.93Y403.799:46.46 +X751.812:4886.66Y407.885:158.535 +X800.568:5298.77Y406.97:-5.56898 +X857.787:5101.29Y407.774:-161.592 +X902.5940000000001:4904.45Y403.738:-252.293 +X955.876:5055.72Y402.728:-88.3794 +X1003.71:4936.13Y401.971:-114.105 +X1054.6:5214.47Y400.446:-60.0489 +X1108:5029.49Y400.77:131.099 +X1155.19:4888.87Y403.068:441.238 +X1205.78:5063.37Y409.594:-135.724 +X1256.46:4926.43Y400.354:-224.708 +X1304.3:4945.3Y405.1:323.015 +X1355.36:4923.6Y406.814:-190.578 +X1402.78:4928.25Y401.289:137.507 +X1453.93:2369.37Y409.564:2528.19 +X1450.16:-2518.65Y451.852:2200.15 +X1403.55:-4991.51Y453.567:386.875 +X1350.33:-5048.34Y459.59:246.166 +X1302.59:-4985.3Y458.49:-267.475 +X1250.63:-4814.89Y454.24:-225.302 +X1206.29:-4623.59Y453.984:-132.309 +X1158.16:-4904.07Y451.594:255.205 +X1108.21:-4931.82Y459.088:208.168 +X1059.52:-4981.52Y455.758:-225.81 +X1008.58:-5246.87Y454.572:7.6165 +X954.581:-5030.67Y455.91:250.972 +X907.9640000000001:-5109.06Y459.592:-215.223 +X852.4:-5019.81Y451.605:-161.553 +X807.568:-4770.2Y456.361:83.5908 +X756.996:-4926.37Y453.277:26.982 +X709.04:-4987.73Y456.9:35.6525 +X657.242:-5011Y453.99:-115.711 +X608.8200000000001:-5090.18Y454.586:28.943 +X555.438:-5347.46Y454.569:222.69 +X501.871:-2571.27Y459.04:2736.19 +X504.013:2456.24Y509.293:2520.66 +X550.996:5234.11Y509.453:-237.565 +X608.6950000000001:5113.54Y504.542:-356.279 +X653.2670000000001:4872.49Y502.327:-210.544 +X706.145:4844.45Y500.331:98.0258 +X750.1559999999999:4726.8Y504.288:109.433 +X800.681:5102.78Y502.519:-87.8023 +X852.212:5031.49Y502.532:-119.952 +X901.311:4947.16Y500.12:182.645 +X951.155:5421.6Y506.185:489.154 +X1009.74:5146.78Y509.903:-227.763 +X1054.09:4832.25Y501.63:-250.02 +X1106.39:5290.18Y504.903:-48.8251 +X1159.89:5072.24Y500.653:-100.953 +X1207.83:4626Y502.884:298.6 +X1252.41:4731.41Y506.625:188.73 +X1302.46:5137.94Y506.659:-119.208 +X1355.17:5154.31Y504.241:-189.404 +X1405.55:5094.63Y502.871:-4.61606 +X1457.07:2719.86Y504.149:2582.39 +X1459.94:-2503.5Y554.518:2776.55 +X1407:-5027.1Y559.6799999999999:149.472 +X1359.4:-5032.79Y557.508:-50.3381 +X1306.34:-5218.91Y558.673:95.90940000000001 +X1255.02:-4897.4Y559.426:-314.774 +X1208.39:-5026.55Y552.377:-319.058 +X1154.49:-5300.69Y553.045:-32.9444 +X1102.38:-5037.5Y551.7190000000001:222.16 +X1053.74:-4982.69Y557.4880000000001:103.602 +X1002.72:-4821.79Y553.7910000000001:66.46599999999999 +X957.307:-4791.33Y558.817:-160.35 +X906.898:-4889.88Y550.5839999999999:-324.15 +X859.51:-5220.17Y552.3339999999999:23.7749 +X802.494:-5327.2Y551.059:379.295 +X752.966:-4640.22Y559.92:399.521 +X709.6900000000001:-4740.79Y559.049:-3.25991 +X658.15:-5368.17Y559.855:-278.214 +X602.326:-4945Y553.485:-469.742 +X559.25:-4936.04Y550.46:240.069 +X503.605:-2927.05Y558.287:2623.39 +X500.709:2395.9Y602.928:2294.41 +X551.524:5030.21Y604.175:155.662 +X601.313:5115.23Y606.0410000000001:238.95 +X653.828:5418.25Y608.954:-28.6165 +X709.678:4946.01Y605.4690000000001:-151.578 +X752.748:4964.48Y605.922:-70.0758 +X808.968:5138.63Y604.067:-160.289 +X855.521:4779.34Y602.717:-2.50991 +X904.554:4848.17Y604.0170000000001:117.107 +X952.484:4927.47Y605.059:-14.3393 +X1003.1:5138.28Y603.73:122.364 +X1055.25:5011.56Y607.506:275.562 +X1103.34:5168.67Y609.242:-350.952 +X1158.62:4960.07Y600.487:-239.012 +X1202.54:4621.15Y604.461:149.893 +X1251.05:5243.23Y603.485:117.189 +X1307.4:5258.88Y606.8049999999999:181.026 +X1356.22:4732.41Y607.105:-169.408 +X1402.05:5026.93Y603.417:84.3532 +X1456.76:2709.19Y608.792:2772.63 +X1456.23:-2724.24Y658.87:2265.53 +X1402.28:-4964.67Y654.103:-398.038 +X1356.94:-4892.86Y650.909:54.8254 +X1304.42:-4951.56Y655.2:3.1786 +X1257.91:-4966.11Y650.972:-92.99379999999999 +X1205.1:-5047.18Y653.34:358.218 +X1156.96:-4773.52Y658.1369999999999:-158.547 +X1109.63:-5048.05Y650.169:-112.47 +X1056:-5480.03Y655.8869999999999:315.162 +X1000.03:-4964.22Y656.472:180.061 +X956.72:-4712.78Y659.489:24.0367 +X905.771:-5231.1Y656.953:-416.579 +X852.097:-4977.45Y651.157:-208.101 +X806.222:-5092.72Y652.7910000000001:113.454 +X750.2430000000001:-5266.37Y653.426:63.4372 +X700.895:-4746.89Y654.059:289.75 +X655.3049999999999:-5040.81Y659.221:-16.6316 +X600.079:-5250.15Y653.727:-105.887 +X550.302:-4732.1Y657.103:-44.9897 +X505.437:-2205.7Y652.827:2211.56 +X506.188:2718.45Y701.335:2794.54 +X559.806:4941.95Y708.718:394.443 +X605.027:4780.4Y709.223:25.7602 +X655.414:5163.59Y709.2329999999999:22.9692 +X708.299:5189.2Y709.683:-443.636 +X759.198:4672.44Y700.36:-289.576 +X801.748:5016.18Y703.891:131.998 +X859.521:4992.85Y703:248.585 +X901.605:4747.13Y708.8630000000001:303.923 +X954.4640000000001:4999.88Y709.079:-112.594 +X1001.6:4996.93Y706.611:-415.694 +X1054.4:5268.12Y700.765:-206.859 +X1106.96:4799.68Y702.474:-8.271240000000001 +X1150.4:4682.31Y700.599:330.167 +X1200.61:5350.13Y709.077:419.059 +X1257.4:5305.75Y708.981:-189.397 +X1306.73:4782.28Y705.289:49.9499 +X1353.04:4844.8Y709.98:-29.1455 +X1403.62:5036.9Y704.706:-9.21766 +X1453.78:2613.75Y709.795:2637.37 +X1455.9:-2630.46Y757.454:2063.74 +X1401.17:-4908.31Y751.0700000000001:106.671 +X1357.73:-4842.52Y759.587:207.496 +X1304.32:-5355.22Y755.22:-358.42 +X1250.63:-5048.39Y752.419:-187.155 +X1203.35:-4649.04Y751.477:228.173 +X1157.65:-4679.64Y756.982:371.054 +X1109.76:-5063.49Y758.898:57.4027 +X1056.38:-5312.17Y758.131:-84.1935 +X1003.52:-5120.16Y757.2140000000001:93.1121 +X953.973:-4880.43Y759.9930000000001:-31.1151 +X905.91:-5150.23Y756.592:-327.943 +X850.968:-4810.27Y753.434:-262.869 +X809.705:-4820.14Y751.3339999999999:-2.95717 +X754.5650000000001:-5227.99Y753.375:117.244 +X705.145:-5086.26Y753.679:-49.5321 +X652.84:-4953.63Y752.384:54.8595 +X606.072:-4801.83Y754.776:-87.6028 +X556.803:-5216.3Y750.6319999999999:-74.8293 +X501.747:-2416.1Y753.28:2936.31 +X508.482:2904.38Y809.3579999999999:2535.91 +X559.8339999999999:4766.09Y803.998:-394.012 +X603.803:4850.75Y801.478:128.48 +X656.849:5240.86Y806.568:-25.2753 +X708.621:4906.42Y800.973:-37.84 +X754.978:4689.75Y805.811:35.8837 +X802.4160000000001:5180.9Y801.6900000000001:-261.274 +X858.596:5114.53Y800.585:-26.5957 +X904.706:4798.74Y801.158:460.714 +X954.571:4976.54Y809.8:370.645 +X1004.24:4830.13Y808.571:-354.355 +X1051.17:4990.04Y802.713:-228.656 +X1104.04:5277.03Y803.998:36.733 +X1156.71:5154.99Y803.447:119.687 +X1207.14:4863.89Y806.3920000000001:43.521 +X1253.99:4950.38Y804.318:-284.572 +X1306.15:5211.62Y800.7:110.831 +X1358.22:5055.91Y806.534:233.44 +X1407.26:4644.04Y805.369:-124.193 +X1451.1:2311.55Y804.05:2622.28 +X1453.49:-2338.75Y857.8150000000001:2561.6 +X1404.33:-5098.04Y855.282:-290.942 +X1351.53:-4829.76Y851.996:-35.9123 +X1307.73:-4995.62Y854.564:180.043 +X1251.62:-5353.93Y855.597:199.933 +X1200.66:-4948.54Y858.563:-246.766 +X1152.65:-4922.1Y850.6609999999999:-378.131 +X1102.21:-5092.25Y851:9.580730000000001 +X1050.81:-4924.09Y850.853:61.4249 +X1003.73:-4781.19Y852.229:378.733 +X955.181:-5091.32Y858.428:-101.87 +X901.9059999999999:-4996.98Y850.191:-238.838 +X855.242:-4827.83Y853.651:192.56 +X805.349:-4828.51Y854.042:-167.955 +X758.672:-4787.89Y850.292:-150.473 +X709.591:-5081.97Y851.033:302.798 +X657.032:-5424.68Y856.348:251.505 +X601.098:-5336.63Y856.063:51.234 +X550.3:-4852.21Y857.373:-142.633 +X504.054:-2139.46Y853.21:2594.98 +X507.51:2311.79Y909.272:2787.32 +X550.29:4820.77Y908.957:-24.4197 +X603.926:5330.92Y908.784:45.8287 +X656.908:5183.36Y909.873:-256.914 +X707.593:4905.14Y903.645:-305.48 +X755.011:4802.81Y903.764:-51.8201 +X803.649:4997.45Y902.609:152.675 +X854.96:4956.21Y906.817:131.738 +X902.773:4810.7Y905.244:-260.947 +X951.174:4884.73Y901.598:223.176 +X1000.47:4943.24Y909.707:9.36734 +X1050.04:5283.03Y901.7859999999999:-444.681 +X1106.13:5439.02Y900.814:270.52 +X1158.82:5176.76Y907.196:213.133 +X1209.66:4709.25Y905.076:-85.0598 +X1253:4982.21Y905.495:6.56295 +X1309.31:4983.4Y905.208:163.949 +X1352.67:4720.55Y908.774:-259.689 +X1403.72:4990.24Y900.014:-279.583 +X1452.48:2439.24Y903.182:2741.01 +X1452.5:-2427.94Y954.8339999999999:2461.97 +X1403.92:-4637.26Y952.422:224.584 +X1359.76:-4897.68Y959.326:-62.3265 +X1305.96:-5203.83Y951.175:-343.002 +X1255.68:-5085.89Y952.466:-4.95397 +X1204.25:-5132.01Y951.076:-85.5989 +X1153.04:-5161.12Y950.754:24.3828 +X1101.02:-4730.67Y951.564:371.337 +X1058.43:-4981.67Y958.1799999999999:135.261 +X1001.39:-5032.34Y954.269:13.1008 +X957.782:-4842.99Y958.442:33.5267 +X904.5309999999999:-4927.71Y954.9400000000001:-275.079 +X859.228:-5118.32Y952.941:-163.955 +X802.165:-5123.53Y951.66:-24.5936 +X756.7569999999999:-4625.15Y952.449:312.916 +X709.6609999999999:-4841.9Y957.919:65.9259 +X659.919:-5042.73Y953.7670000000001:76.5736 +X608.807:-5273.65Y959.45:-20.3195 +X554.446:-5010.95Y953.361:-243.262 +X508.588:-2292.9Y954.585:61.2005 +X508.588:0Y954.585:0 +X508.588Y954.585 +dwell10 +goto 0 +close diff --git a/prg/testPerfGridYX.prg b/prg/testPerfGridYX.prg new file mode 100644 index 0000000..650da91 --- /dev/null +++ b/prg/testPerfGridYX.prg @@ -0,0 +1,415 @@ +//this program is generated with ./shapepath.py +//cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg") +//then modifiing start and end to not use gathering and to make a loop + +open prog 2 +N0: +linearabs +X505.488 Y7.15189 +dwell 10 + pvt10 abs +X505.488:-94.6528 Y7.15189:2360.92 +X503.595:-115.415 Y54.3703:4849.54 +X503.18:182.873 Y104.143:5032.15 +X507.253:189.723 Y155.013:5019.64 +X506.974:-206.729 Y204.535:5097.51 +X503.118:83.2134 Y256.963:4831.99 +X508.639:-9.3878 Y301.175:5076.3 +X502.93:-296.764 Y358.489:5006.98 +X502.703:-52.9447 Y401.315:5027.52 +X501.871:65.4658 Y459.04:5398.9 +X504.013:86.7073 Y509.293:4962.34 +X503.605:-165.195 Y558.287:4681.75 +X500.709:91.5662 Y602.928:4727.02 +X505.437:273.978 Y652.827:4920.33 +X506.188:-184.51 Y701.335:5022.64 +X501.747:114.662 Y753.28:5401.19 +X508.482:115.358 Y809.358:4996.53 +X504.054:-48.5644 Y853.21:4995.69 +X507.51:226.702 Y909.272:5068.73 +X508.588:2346.78 Y954.585:2204.45 +X554.446:2085.09 Y953.361:-2281.41 +X550.29:-207.318 Y908.957:-4799.42 +X550.3:477.237 Y857.373:-5247.94 +X559.834:325.199 Y803.998:-5337.02 +X556.803:-1.42305 Y750.632:-4764.01 +X559.806:-325.057 Y708.718:-4676.44 +X550.302:-414.113 Y657.103:-5227.15 +X551.524:447.366 Y604.175:-5332.16 +X559.25:-26.3699 Y550.46:-4736.09 +X550.996:-190.58 Y509.453:-4794.55 +X555.438:-22.1203 Y454.569:-5321.85 +X550.554:37.0354 Y403.016:-5221.84 +X556.179:231.002 Y350.132:-5084.77 +X555.174:-120.062 Y301.321:-4916.82 +X553.778:102.338 Y251.796:-4632.84 +X557.221:289.166 Y208.664:-4767.81 +X559.561:-328.954 Y156.44:-5086.96 +X550.641:-129.226 Y106.925:-5291.88 +X556.976:269.308 Y50.6023:-5073.79 +X556.028:2363.01 Y5.44883:-2207.17 +X604.237:2532 Y6.45894:2562.88 +X606.668:71.4733 Y56.7064:4809.75 +X605.666:-121.456 Y102.654:4967.88 +X604.239:204.46 Y156.064:5295.21 +X609.755:-199.588 Y208.558:4730.43 +X600.247:-129.331 Y250.672:4770.13 +X607.169:161.277 Y303.961:5040.45 +X603.472:-227.371 Y351.481:5030.04 +X602.621:267.404 Y404.561:5155.23 +X608.82:303.685 Y454.586:4999.01 +X608.695:-324.707 Y504.542:4944.96 +X602.326:-369.1 Y553.485:5074.98 +X601.313:-112.371 Y606.041:5012.08 +X600.079:185.716 Y653.727:5159.12 +X605.027:299.683 Y709.223:5052.48 +X606.072:-61.1928 Y754.776:4612.73 +X603.803:-248.732 Y801.478:5064.33 +X601.098:6.1168 Y856.063:5365.28 +X603.926:385.447 Y908.784:5169.36 +X608.807:2799.66 Y959.45:2249.18 +X659.919:2405.05 Y953.767:-2478.84 +X656.908:-144.336 Y909.873:-4870.98 +X657.032:-2.92517 Y856.348:-5165.29 +X656.849:-209.609 Y806.568:-5198.19 +X652.84:-71.7768 Y752.384:-4866.73 +X655.414:123.269 Y709.233:-4658.15 +X655.305:-79.2864 Y659.221:-5013.96 +X653.828:142.215 Y608.954:-4968.31 +X658.15:-28.0536 Y559.855:-5331.32 +X653.267:-45.3994 Y502.327:-5293.23 +X657.242:178.29 Y453.99:-4768.56 +X656.833:128.831 Y406.956:-4960.33 +X659.818:-58.93 Y354.784:-5256.17 +X655.654:-151.218 Y301.833:-5012.34 +X656.794:-276.854 Y254.537:-4911.65 +X650.117:-330.1 Y203.6:-5076.06 +X650.192:255.767 Y153.016:-5133.02 +X655.232:95.5947 Y100.939:-5086.32 +X652.104:-42.8304 Y51.2893:-4601.08 +X654.376:2876.64 Y8.91773:-2372.74 +X709.637:2438.92 Y3.83442:2235.97 +X703.154:-193.858 Y53.6371:5272.93 +X705.759:172.373 Y109.293:4963.18 +X706.602:77.022 Y152.901:4621.17 +X707.3:-61.7972 Y201.716:5303.3 +X705.366:-292.571 Y258.967:5158.21 +X701.448:-19.5939 Y304.881:4871.4 +X704.974:69.3355 Y356.395:4945.94 +X702.835:203.327 Y403.799:5025.28 +X709.04:165.473 Y456.9:4826.57 +X706.145:32.4637 Y500.331:5107.46 +X709.69:176.665 Y559.049:5256.91 +X709.678:-439.739 Y605.469:4750.5 +X700.895:-68.9487 Y654.059:5210.7 +X708.299:212.509 Y709.683:4980.99 +X705.145:16.0826 Y753.679:4564.49 +X708.621:222.315 Y800.973:4867.69 +X709.591:-51.3901 Y851.033:5133.64 +X707.593:3.5026 Y903.645:5344.29 +X709.661:2458.2 Y957.919:2440.17 +X756.757:2267.46 Y952.449:-2707.75 +X755.011:95.739 Y903.764:-5107.85 +X758.672:-1.64313 Y850.292:-4897.65 +X754.978:-205.324 Y805.811:-4845.86 +X754.565:211.003 Y753.375:-5272.52 +X759.198:-216.103 Y700.36:-4997.43 +X750.243:-322.48 Y653.426:-4721.9 +X752.748:136.122 Y605.922:-4675.3 +X752.966:-129.609 Y559.92:-5081.72 +X750.156:201.533 Y504.288:-5332.15 +X756.996:82.7724 Y453.277:-4820.13 +X751.812:-165.519 Y407.885:-5095.41 +X753.686:87.2309 Y351.369:-4924.06 +X753.556:310.877 Y309.404:-4960 +X759.903:82.7119 Y252.169:-5443.05 +X755.21:-186.162 Y200.543:-4894.06 +X756.18:-101.234 Y154.288:-4693.46 +X753.186:-23.9093 Y106.674:-4995.08 +X755.702:236.578 Y54.386:-5069.26 +X757.917:2498.92 Y5.28895:-2256.5 +X805.68:2598.32 Y9.25597:2286.57 +X809.884:-218.123 Y51.0204:4895.37 +X801.318:-426.45 Y107.163:5098.12 +X801.355:34.0993 Y152.983:4651.1 +X802:263.802 Y200.185:4982.52 +X806.631:282.664 Y252.633:5365.07 +X807.653:79.5198 Y307.487:4963.26 +X808.221:-354.239 Y351.898:4974.17 +X800.568:-32.6695 Y406.97:5223.11 +X807.568:5.613 Y456.361:4777.47 +X800.681:-253.679 Y502.519:4734.92 +X802.494:414.344 Y551.059:5077.4 +X808.968:186.406 Y604.067:5086.58 +X806.222:-360.995 Y652.791:4991.2 +X801.748:174.131 Y703.891:4927.19 +X809.705:33.3925 Y751.334:4889.95 +X802.416:-217.788 Y801.69:5135.4 +X805.349:61.6774 Y854.042:5045.94 +X803.649:-159.23 Y902.609:4880.9 +X802.165:2778.92 Y951.66:2516.59 +X859.228:2639.76 Y952.941:-2242.15 +X854.96:-199.286 Y906.817:-4964.49 +X855.242:181.805 Y853.651:-5311.6 +X858.596:-213.69 Y800.585:-5010.85 +X850.968:46.2809 Y753.434:-4879.25 +X859.521:56.473 Y703:-5113.84 +X852.097:-200.032 Y651.157:-5014.19 +X855.521:370.601 Y602.717:-4941.14 +X859.51:-165.459 Y552.334:-5009.23 +X852.212:-355.466 Y502.532:-5036.44 +X852.4:278.767 Y451.605:-4737.89 +X857.787:135.649 Y407.774:-4968.11 +X855.113:62.5122 Y352.243:-5346.99 +X859.037:-245.334 Y300.834:-4732.97 +X850.207:-55.011 Y257.584:-4929.75 +X857.937:274.657 Y202.239:-5083.75 +X855.7:-252.146 Y155.909:-5020.37 +X852.894:-180.544 Y101.832:-5214.78 +X852.089:-109.185 Y51.6131:-5048.03 +X850.71:2405.67 Y0.871293:-2164.34 +X900.202:2791.04 Y8.3262:2583.08 +X906.531:283.147 Y52.5329:4593.74 +X905.865:-39.3915 Y100.201:5199.95 +X905.743:-120.581 Y156.532:5453.99 +X903.454:-127.154 Y209.281:4865.13 +X903.2:103.42 Y253.835:4828.2 +X905.522:-111.086 Y305.845:5239.36 +X900.978:-146.385 Y358.622:4894.67 +X902.594:349.273 Y403.738:5048.49 +X907.964:-64.1837 Y459.592:4819.11 +X901.311:-53.3116 Y500.12:4549.59 +X906.898:162.194 Y550.584:5194.84 +X904.554:-56.314 Y604.017:5318.46 +X905.771:-147.488 Y656.953:5242.3 +X901.605:6.94333 Y708.863:4981.95 +X905.91:155.077 Y756.592:4614.76 +X904.706:-200.23 Y801.158:4679.97 +X901.906:-96.6403 Y850.191:5204.27 +X902.773:131.264 Y905.244:5237.42 +X904.531:2750.42 Y954.94:2659.93 +X957.782:2332.14 Y958.442:-2667.06 +X951.174:-130.011 Y901.598:-5000.73 +X955.181:169.839 Y858.428:-4589.94 +X954.571:-60.4465 Y809.8:-4921.75 +X953.973:-5.33217 Y759.993:-5036.04 +X954.464:137.35 Y709.079:-5025.21 +X956.72:-98.9905 Y659.489:-5201 +X952.484:29.376 Y605.059:-5033.57 +X957.307:-66.4646 Y558.817:-4943.69 +X951.155:-136.285 Y506.185:-5145.37 +X954.581:236.058 Y455.91:-5172.83 +X955.876:257.39 Y402.728:-4815.07 +X959.729:187.168 Y359.608:-4990.34 +X959.619:-192.301 Y302.921:-5064.89 +X955.883:-128.761 Y258.31:-5130.15 +X957.044:31.8931 Y200.318:-5199.82 +X956.521:62.2628 Y154.314:-5013.57 +X958.289:-92.8962 Y100.047:-5093.5 +X954.663:-25.3916 Y52.4443:-4567.34 +X957.782:2756.15 Y8.70012:-2222.63 +X1009.79:2190.41 Y7.99159:2120.18 +X1001.59:-150.401 Y51.1038:4735.42 +X1006.78:368.789 Y102.7:5128.59 +X1008.97:-256.561 Y153.676:5175.74 +X1001.65:-133.782 Y206.215:5252.54 +X1006.29:38.0673 Y258.727:4739.41 +X1002.41:138.787 Y301.003:4950.7 +X1009.07:65.012 Y357.74:5048.38 +X1003.71:-24.4164 Y401.971:4841.59 +X1008.58:301.702 Y454.572:5396.65 +X1009.74:-292.643 Y509.903:4960.92 +X1002.72:-331.938 Y553.791:4691.34 +X1003.1:-134.867 Y603.73:5134.07 +X1000.03:-75.0752 Y656.472:5144.04 +X1001.6:174.595 Y706.611:5037.11 +X1003.52:131.738 Y757.214:5098 +X1004.24:10.6615 Y808.571:4750.73 +X1003.73:-188.45 Y852.229:5056.8 +X1000.47:-117.072 Y909.707:5102.02 +X1001.39:2898.02 Y954.269:2423.65 +X1058.43:2432.39 Y958.18:-2624.16 +X1050.04:-381.161 Y901.786:-5366.36 +X1050.81:56.7276 Y850.853:-4953.66 +X1051.17:278.525 Y802.713:-4636.13 +X1056.38:161.474 Y758.131:-5097.38 +X1054.4:-18.5952 Y700.765:-5112.16 +X1056:42.3533 Y655.887:-4662.95 +X1055.25:-113.048 Y607.506:-4919.98 +X1053.74:-57.9582 Y557.488:-5293.82 +X1054.09:288.789 Y501.63:-5086.52 +X1059.52:25.4009 Y455.758:-5059.17 +X1054.6:-309.365 Y400.446:-5247.32 +X1053.33:-221.713 Y350.811:-4557.54 +X1050.16:-29.8016 Y309.295:-4641.53 +X1052.74:280.399 Y257.98:-5345.82 +X1055.77:81.1614 Y202.379:-4953.06 +X1054.36:78.9827 Y158.919:-4637.85 +X1057.35:110.232 Y109.622:-5376.87 +X1056.56:-136.857 Y51.3818:-5090.83 +X1054.61:2230.97 Y7.80529:-2249.13 +X1101.18:2367.55 Y6.39921:2294.1 +X1101.97:65.2394 Y53.6873:4968.12 +X1102.49:304.806 Y105.762:5167.58 +X1108.06:342.73 Y157.039:5018.9 +X1109.34:-310.279 Y206.14:5124.45 +X1101.86:-132.149 Y259.528:5085.59 +X1106.7:110.803 Y307.852:4639.72 +X1104.07:64.9397 Y352.322:4645.9 +X1108:206.763 Y400.77:5338.3 +X1108.21:-80.5171 Y459.088:5206.67 +X1106.39:-291.48 Y504.903:4631.5 +X1102.38:-152.627 Y551.719:5216.93 +X1103.34:362.482 Y609.242:4922.51 +X1109.63:181.478 Y650.169:4661.62 +X1106.96:6.72767 Y702.474:5436.46 +X1109.76:-146.335 Y758.898:5076.21 +X1104.04:-377.415 Y803.998:4605.11 +X1102.21:104.537 Y851:4840.78 +X1106.13:-59.4913 Y900.814:5028.18 +X1101.02:2345.67 Y951.564:2496.99 +X1153.04:2889.74 Y950.754:-2218.38 +X1158.82:-19.5795 Y907.196:-5004.6 +X1152.65:-105.257 Y850.661:-5187.45 +X1156.71:249.761 Y803.447:-4683.95 +X1157.65:-315.884 Y756.982:-5142.39 +X1150.4:-34.0398 Y700.599:-4942.28 +X1156.96:411.352 Y658.137:-5005.63 +X1158.62:-123.595 Y600.487:-5254.61 +X1154.49:63.5456 Y553.045:-4991.69 +X1159.89:183.116 Y500.653:-5072.53 +X1158.16:-235.287 Y451.594:-4879.25 +X1155.19:-341.518 Y403.068:-5052.99 +X1151.32:-118.553 Y350.534:-4860.2 +X1152.82:277.5 Y305.864:-4918.96 +X1156.87:126.951 Y252.155:-4998.25 +X1155.36:-293.631 Y205.899:-4648.01 +X1151:28.2046 Y159.195:-5008.83 +X1155.92:360.383 Y105.723:-5411.19 +X1158.21:-224.344 Y50.971:-4813.79 +X1151.43:2350.43 Y9.44669:-2341.22 +X1205.22:2847.3 Y4.14662:2075.71 +X1208.38:-149.383 Y50.961:5269.04 +X1202.23:-61.8518 Y109.527:5451.37 +X1207.14:253.52 Y159.988:4679.6 +X1207.3:116.565 Y203.119:4866 +X1209.47:-333.083 Y257.309:5086.84 +X1200.64:-110.888 Y304.856:4640.29 +X1207.26:256.794 Y350.114:5236.9 +X1205.78:-48.348 Y409.594:5193.5 +X1206.29:102.846 Y453.984:4664.48 +X1207.83:105.145 Y502.884:4919.65 +X1208.39:-264.796 Y552.377:5078.87 +X1202.54:-164.691 Y604.461:5048.11 +X1205.1:-96.282 Y653.34:5230.8 +X1200.61:-87.1545 Y709.077:4906.86 +X1203.35:326.344 Y751.477:4865.73 +X1207.14:-134.947 Y806.392:5354.3 +X1200.66:126.312 Y858.563:4934.22 +X1209.66:179.529 Y905.076:4625.67 +X1204.25:2300.91 Y951.076:2369.46 +X1255.68:2437.87 Y952.466:-2279.06 +X1253:-203.049 Y905.495:-4843.44 +X1251.62:49.3787 Y855.597:-5058.87 +X1253.99:-49.7421 Y804.318:-5158.89 +X1250.63:170.361 Y752.419:-4766.85 +X1257.4:364.102 Y708.981:-5072.33 +X1257.91:-317.628 Y650.972:-5274.79 +X1251.05:-144.225 Y603.485:-4577.33 +X1255.02:68.3954 Y559.426:-4842.99 +X1252.41:-219.838 Y506.625:-5259.28 +X1250.63:202.076 Y454.24:-5313.57 +X1256.46:353.934 Y400.354:-5138.54 +X1257.71:165.962 Y351.469:-4579.43 +X1259.77:-258.32 Y308.765:-4966.82 +X1252.54:-289.637 Y252.133:-5333.33 +X1253.98:-52.2467 Y202.098:-4672.59 +X1251.49:24.4522 Y158.681:-4681.72 +X1254.47:413.506 Y108.464:-5199.74 +X1259.76:-91.2849 Y54.6865:-5036.09 +X1252.65:2239.85 Y7.74234:-2450.11 +X1304.56:2856.1 Y5.68434:2415.31 +X1309.77:121.664 Y56.0485:4864.5 +X1306.99:-407.134 Y102.974:5005.36 +X1301.62:-256.643 Y156.156:5323.47 +X1301.86:177.854 Y209.444:4705.05 +X1305.18:75.983 Y250.257:5008.6 +X1303.38:-219.339 Y309.616:5031.97 +X1300.8:46.1217 Y350.896:4774.22 +X1304.3:89.581 Y405.1:5379.72 +X1302.59:-92.1696 Y458.49:5077.92 +X1302.46:187.657 Y506.659:5009.13 +X1306.34:247.017 Y558.673:5007.33 +X1307.4:-95.981 Y606.805:4826.33 +X1304.42:-33.7576 Y655.2:4924.21 +X1306.73:-4.87708 Y705.289:5001.02 +X1304.32:-29.0273 Y755.22:4770.55 +X1306.15:170.587 Y800.7:4967.21 +X1307.73:158.146 Y854.564:5225.36 +X1309.31:-88.5112 Y905.208:4830.56 +X1305.96:2522.53 Y951.175:2705.9 +X1359.76:2335.39 Y959.326:-2120.06 +X1352.67:-411.257 Y908.774:-5366.48 +X1351.53:277.6 Y851.996:-5111.99 +X1358.22:309.857 Y806.534:-4620.43 +X1357.73:-258.98 Y759.587:-4827.73 +X1353.04:-39.5636 Y709.98:-5433.93 +X1356.94:158.969 Y650.909:-5143.72 +X1356.22:123.127 Y607.105:-4670.06 +X1359.4:-52.538 Y557.508:-5143.22 +X1355.17:-453.453 Y504.241:-4895.89 +X1350.33:9.43449 Y459.59:-4871.35 +X1355.36:319.372 Y406.814:-5356.81 +X1356.72:-152.238 Y352.454:-4866.04 +X1352.32:-232.289 Y309.493:-4910.34 +X1352.07:253.925 Y254.247:-5229.43 +X1357.4:-41.825 Y204.905:-4788.34 +X1351.24:37.1235 Y158.48:-5046.98 +X1358.14:307.722 Y103.965:-5404.41 +X1357.39:-397.504 Y50.3919:-4889.44 +X1350.19:2436.42 Y6.17635:-2211.13 +X1406.12:2632.01 Y6.16934:2251.28 +X1402.83:134.504 Y51.202:4982.17 +X1408.81:262.256 Y105.813:5224.45 +X1408.07:-326.844 Y155.691:4836.54 +X1402.27:-216.574 Y202.544:4947.24 +X1403.74:356.982 Y254.636:5272.42 +X1409.41:23.1847 Y307.992:5046.9 +X1404.21:-331.891 Y355.574:4664.83 +X1402.78:-32.5853 Y401.289:4899.67 +X1403.55:138.546 Y453.567:5079.1 +X1405.55:172.103 Y502.871:5305.63 +X1407:-174.882 Y559.68:5027.32 +X1402.05:-235.908 Y603.417:4721.17 +X1402.28:78.6327 Y654.103:5064.48 +X1403.62:-55.2195 Y704.706:4848.35 +X1401.17:182.077 Y751.07:5033.14 +X1407.26:157.832 Y805.369:5210.61 +X1404.33:-177.212 Y855.282:4732.23 +X1403.72:-20.5936 Y900.014:4856.97 +X1403.92:2439.24 Y952.422:2741.01 +X1452.5:2427.94 Y954.834:-2461.97 +X1452.48:49.521 Y903.182:-4850.96 +X1453.49:-68.604 Y857.815:-4956.6 +X1451.1:120.127 Y804.05:-5018.04 +X1455.9:133.884 Y757.454:-4712.75 +X1453.78:16.8 Y709.795:-4929.22 +X1456.23:148.999 Y658.87:-5050.15 +X1456.76:185.553 Y608.792:-5217.57 +X1459.94:15.1661 Y554.518:-5232.19 +X1457.07:-489.036 Y504.149:-5133.29 +X1450.16:-156.95 Y451.852:-4729.23 +X1453.93:422.111 Y409.564:-4729.09 +X1458.61:118.886 Y357.27:-5041.06 +X1456.3:-291.461 Y308.743:-5070.13 +X1452.78:-286.209 Y255.868:-5219.94 +X1450.58:64.7773 Y204.344:-5258.81 +X1454.07:411.853 Y150.692:-4870.94 +X1458.82:-55.5215 Y106.925:-4975.22 +X1452.96:31.0064 Y51.1873:-5005.36 +X1459.44:323.804 Y6.8182:-2218.45 +X1459.44:0 Y6.8182:0 +X1459.44 Y6.8182 +dwell10 +goto 0 +close \ No newline at end of file diff --git a/python/data/prog_2.npz b/python/data/prog_2.npz new file mode 100644 index 0000000..5117e06 Binary files /dev/null and b/python/data/prog_2.npz differ diff --git a/python/move_record.py b/python/move_record.py index ff23e60..fb74cbe 100755 --- a/python/move_record.py +++ b/python/move_record.py @@ -26,7 +26,7 @@ import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import subprocess as sprc -import telnetlib +import telnetlib, re from utilities import * os.environ['PATH']='/home/zamofing_t/scripts/:'+os.environ['PATH'] @@ -38,8 +38,9 @@ class MoveRecord: self.fnNpz=fn+'.npz' #cfg = {"sequencer": ['prog_1(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_1()']} #cfg = {"sequencer": ['plot_1()']} - cfg = {"sequencer": ['prog_2(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_2()']} + #cfg = {"sequencer": ['prog_2(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_2()']} #cfg = {"sequencer": ['plot_2()']} + cfg = {"sequencer": ['prog_3(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_2()']} self.cfg=dotdict(cfg) self.args=args @@ -98,7 +99,7 @@ class MoveRecord: meta = self.meta channels = self.channels fnLoc='/tmp/gather.txt' - rec = np.genfromtxt(fnLoc, delimiter=' ') + self.rec=rec=np.genfromtxt(fnLoc, delimiter=' ') # 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 # idx 0 1 2 3 4 5 @@ -119,7 +120,7 @@ class MoveRecord: self.file=file self.host=host self.gather={"MaxSamples":1000000, "Period":acq_per} - self.channels=["Motor[3].ActPos","Motor[3].DesPos","Motor[3].PhasePos","Motor[3].idMeas","Motor[3].iqMeas"] + self.channels=channels=["Motor[3].ActPos","Motor[3].DesPos","Motor[3].PhasePos","Motor[3].idMeas","Motor[3].iqMeas"] self.meta=meta = {'timebase': ServoPeriod*self.gather['Period']} self.prg=prg=[] @@ -130,21 +131,27 @@ class MoveRecord: prg=self.prg prg.append(' linear abs') - prg.append('jog3=100') + prg.append('jog3=300') prg.append('dwell 100') prg.append('Gather.Enable=2') #for spd in (5,10,20,30,40): + #for spd in (10,20): for spd in (10,10,10,10,20,20,20,20,20,20): prg.append('Motor[3].JogSpeed=%d'%spd) #prg.append('jog3=27000') prg.append('jog3=28500') prg.append('dwell 100') - prg.append('jog3=100') + prg.append('jog3=300') prg.append('dwell 100') prg.append('Gather.Enable=0') - meta['HomePos']=-4885.72 #set the value of Motor[3].HomePos self.prg_epilog() + rec=self.rec + meta['HomePos']=rec[0,1]-300 #rec[0,1]= first DesPos, 300 um is the start position of the motion + print meta + if self.fnNpz: + np.savez_compressed(self.fnNpz, rec=rec, prg=prg, channels=channels, meta=meta) + #!mx-stage() # &1 #1->0 # &1 #2->0 @@ -170,6 +177,7 @@ class MoveRecord: channels=self.channels meta=self.meta except AttributeError: + print 'load file %s'%self.fnNpz fh=np.load(self.fnNpz) rec=fh['rec'] prg=list(fh['prg']) @@ -385,6 +393,60 @@ class MoveRecord: plt.show() + def prog_3(self,prgId=2,host=None,acq_per=1): + ''' + kwargs: + acq_per : acquire period: acquire data all acq_per servo loops (default=1) + prgId : used program number + file : used filename to save if None, not saved + host : host to send and execute program, if None, nothing is executed + ''' + ServoPeriod= .2 #0.2ms Sys.ServoPeriod is dependent of !common() macro + + self.prgId=prgId + self.file=file + self.host=host + self.gather={"MaxSamples":1000000, "Period":acq_per} + self.channels=channels=["Motor[3].ActPos","Motor[3].DesPos","Motor[3].PhasePos","Motor[3].idMeas","Motor[3].iqMeas"] + self.meta=meta = {'timebase': ServoPeriod*self.gather['Period']} + + self.prg=prg=[] + #prg.append('#1..3$') + #prg.append('#1..3j/') + + self.prg_prolog() + prg=self.prg + + fh=open('/tmp/shapepath.prg','r') + lines=fh.read().splitlines() + fh.close() + prg.extend(lines[11:-3]) + self.prg_epilog() + #print '\n'.join(prg) + rec=self.rec + lines[12] + x0=float(re.match('X(\S+)\sY\S+',lines[12]).group(1)) + meta['HomePos']=rec[0,1]-x0 #rec[0,1]= first DesPos is x0, the start position of the motion + print meta + if self.fnNpz: + np.savez_compressed(self.fnNpz, rec=rec, prg=prg, channels=channels, meta=meta) + + + # &1 #1->0 + # &1 #2->0 + # #3$ + # an anschlag (kabel) bewegen + # #3hmz + # Motor[3].PhasePos=1200 # or for motor 2: Motor[2].PhasePos=300 + # #3j/ + # &1p + + + #folgende parameter setzen: Motor[3].HomePos + meta['HomePos']=-223.8 #Motor[3].HomePos + meta['PhasePos']=1200 #Motor[3].PhasePos + + if __name__=='__main__': from optparse import OptionParser, IndentedHelpFormatter class MyFormatter(IndentedHelpFormatter): diff --git a/python/shapepath.py b/python/shapepath.py index bbc448c..370a7de 100755 --- a/python/shapepath.py +++ b/python/shapepath.py @@ -121,6 +121,7 @@ class ShapePath: pts=np.array([xx.reshape(-1),yy.reshape(-1)],dtype=np.float).transpose()*pitch if rnd != 0: pts+=(np.random.rand(pts.shape[0],2)*(rnd*pitch)) + pts[:,0]+=500 self.points=pts def gen_prog(self,prgId=2,file=None,host=None,mode=0,**kwargs): @@ -307,6 +308,10 @@ class ShapePath: #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 #idx 0 1 2 3 4 5 + ofsy=-rec[0,4]+pts[0,1] + ofsx=-rec[0,5]+pts[0,0] + rec[:,(1,4)]+=ofsy + rec[:,(2,5)]+=ofsx if fnOut: # time base: # Gather.Period=10 diff --git a/src/usrServo/pp_proj.ini b/src/usrServo/pp_proj.ini index ec74360..3a84565 100755 --- a/src/usrServo/pp_proj.ini +++ b/src/usrServo/pp_proj.ini @@ -2,7 +2,7 @@ [RTUSRCCODE] usrrtmodule=/tmp/usralgo.ko -#ServoCtrlName2=usr_servo_ctrl_2 +ServoCtrlName2=usr_servo_ctrl_2 ServoCtrlName3=usr_servo_ctrl_3 #ServoCtrlName4=user_pid_ctrl diff --git a/src/usrServo/usrcode.c b/src/usrServo/usrcode.c index e5a743d..21ead68 100644 --- a/src/usrServo/usrcode.c +++ b/src/usrServo/usrcode.c @@ -55,6 +55,7 @@ void user_phase( struct MotorData *Mptr) double usr_servo_ctrl_2(MotorData *Mptr) { + pshm->P[2000]=pshm->P[2000]*.9999+abs(Mptr->PosError)*0.0001; //lowpass of Position error return pshm->ServoCtrl(Mptr); } @@ -66,6 +67,8 @@ float lutFric[275]={ double usr_servo_ctrl_3(MotorData *Mptr) { + //Structure of shared memory file is at: /opt/eldk-4.2/PPMAC_rootfs-7-wheezy/opt/ppmac/rtpmac/RtGpShm.h + //compensate_friction_servo_ctrl for motor 3 static int cnt=0; float p,c; @@ -82,15 +85,25 @@ double usr_servo_ctrl_3(MotorData *Mptr) else c=lutFric[idx]+(lutFric[idx+1]-lutFric[idx])*(p-idx); - c=0.f; + c=0.f; //do not use friction lut if(Mptr->DesVel>0) + { c+=28.2405057332f; - //c+=45.f; + //c+=100.f; + } else if (Mptr->DesVel<0) + { c-=61.2462872333f; - //c+=45.f; + //c-=100.f; + } else + { c+=(28.2f-61.2f)/2.f; + } + //c-=550.f;//compensate if stage is vertically + c/=11.f; //no friction compensation at all + c=0.f; //no friction compensation at all + pshm->P[3000]=pshm->P[3000]*.9999+abs(Mptr->PosError)*0.0001; //lowpass of Position error // The default servo algo. ctrl_out=pshm->ServoCtrl(Mptr);