wip 5cam mover

This commit is contained in:
2018-03-29 16:53:23 +02:00
parent c7a3ac8f36
commit 69ffc089bf
11 changed files with 739 additions and 62 deletions

230
Readme.md
View File

@@ -363,3 +363,233 @@ $$$***
!SAR-EXPMX3()
```
5 CAM mover commissioning EH60 27.3.18
--------------------------------------
```
PPMAC=SAROP11-CPPM-MOT6765
PPMAC=MOTTEST-CPPM-CRM0515
PBInspect --host $PPMAC
gpasciiCommander --host $PPMAC -i
$$$***
!common()
PowerBrick[0].GpioData[0].17=1
16 fail
17 ok
18 fail
19 ok
20 fail
21 fail on box
22 fail on box
23 fail on box
21 fail on box
Testing on motor 2
$$$***
!common()
!encoder_sim(enc=2,tbl=2,mot=2)
!motor(mot=2,dirCur=1000,JogSpeed=1024)
!encoder_ssi(enc=2,tbl=10,mot=10,numBits=18)
PowerBrick[0].GpioData[0].17=1
#2j:102400
PowerBrick[0].GpioData[0].17=0
#2k
#2j:10240000 == 360 deg = 262037.6288 inc = 360000mdeg
//the motor has 512*200*100 usteps per revolution (512 uystep/step, 200 steps/rev 1:100 gear)
//the ssi-encoder has 2**18=262144 steps per revolution
//motor_u_steps/inc_enc_step=39.0625
//the ssi-encoder has 2**18=262144 steps per revolution
//10240000 ustep == 262144 encCnt == 360deg=360000mdeg
//posSf = userUnits/encoder_steps=360000/262144=5625./4096.
//servoSf=motor_u_steps/userUnits 10240000/360000=256./9.
$$$***
!common()
!encoder_ssi(enc=2,numBits=18,posSf=5625./4096.)
!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,HomeOffset=0)
PowerBrick[0].GpioData[0].17=1
#2j:360000
PowerBrick[0].GpioData[0].17=0
#2k
!cm_brake(mot=2,curOn=1000,cs=1,delay=200,gpio=17)
cpx r0=180000;call 20 //motor 2 180deg
cpx r0=0 ;call 20 //motor 2 0 deg
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg/
gpasciiCommander --host $PPMAC -i
$$$***
!common()
!SAR-EXPMX3()
cpx call 15 //current on, open breaks
#1..5j=180000
#1..5j=0
cpx call 16 //close breaks, current off
&1
cpx r0=180000;call 20 //motor 2 180deg
open prog 10
call15
abslinear
X(10) Y(0) U(0) V(0) W(0)
call16
close
b10r
open prog 11
call15
abslinear
jog1=0
jog2=0
jog3=0
jog4=0
jog5=0
call16
close
b11r
open prog 12
call15
abslinear
jog1=180000
jog2=180000
jog3=180000
jog4=180000
jog5=180000
call16
close
b12r
&1p
```
5 CAM coord trf EH60 27.3.18
----------------------------
```
PPMAC=MOTTEST-CPPM-CRM0515
ssh root@$PPMAC
sendgetsends -1
open prog 12
call15
abslinear
jog1=180000
jog2=180000
jog3=180000
jog4=180000
jog5=180000
call16
close
b12r
&1p
```
5 CAM coord trf EH60 27.3.18
----------------------------
```
PPMAC=MOTTEST-CPPM-CRM0515
ssh root@$PPMAC
sendgetsends -1
$$$***
!common()
!SAR-EXPMX3()
&1p -> execute forward kinematics
cpx call 15
#1..5j=0
cpx abslinear X(0)Y(0)U(0)V(0)W(0) ->executes inverse kinematic
cpx call 16
L6=2000/3000
L7=1000/1.41421356237
L11=L7*sin(L1*1.74532925199e-05)
L12=L7*sin(L2*1.74532925199e-05)
L13=L7*sin(L3*1.74532925199e-05)
L14=L7*sin(L4*1.74532925199e-05)
L15=L7*sin(L5*1.74532925199e-05)
$$$***
!common()
!SAR-EXPMX3()
&1
#1..5j/
#1..5hmz
open prog 1
//homez1..5
call 15
jog1..5=0
call 16
L0 = Sys.Time + 2
while (L0 > Sys.Time){}
call 15
jog1..5=180000
call 16
call 15
abslinear X(1000)Y(0)U(0)V(0)W(0)
dwell 100
abslinear X(0)Y(1000)U(0)V(0)W(0)
dwell 100
abslinear X(0)Y(0)U(0)V(0)W(0)
dwell 100
jog1..5=0
call 16
close
b1r
cpx call15;abslinear X(1000)Y(0)U(0)V(0)W(0);call16;
cpx call15;jog1..5=0;call16;
```
towards IOC 29.3.18
-------------------
```
PPMAC=MOTTEST-CPPM-CRM0515
ssh root@$PPMAC
cd /ioc/SAR-CPPM-EXPMX3
iocsh startup.script
dbl
export EPICS_CA_ADDR_LIST="129.129.126.255"
export EPICS_CA_ADDR_LIST=$PPMAC
caQtDM -macro 'P=SAR-EXPMX' ESB_MX_exp
caQtDM -macro 'P=SAR-EXPMX' ESB_MX_5cam
PPMAC=SAR-CPPM-EXPMX2
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX
PBInspect --host $PPMAC --cfg PBInspect2.pbi
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg
gpasciiCommander --host $PPMAC -i
$$$***
!common()
!SAR-EXPMX2()
```

View File

@@ -16,10 +16,16 @@
file asyn.template {{P="$(P_M)3", PORT=$(PORT_M)}}
file PPMACMotor.template {
pattern{ DESC , P , M , PORT , ADDR, DIR, VELO, HVEL, ACCL, JAR, MRES , PREC, EGU , DHLM, DLLM}
{ "Girder 1", "$(P_M)", "MOT_GIRDER1", "$(PORT_M)", 1 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 2", "$(P_M)", "MOT_GIRDER2", "$(PORT_M)", 2 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 3", "$(P_M)", "MOT_GIRDER3", "$(PORT_M)", 3 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 4", "$(P_M)", "MOT_GIRDER4", "$(PORT_M)", 4 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 5", "$(P_M)", "MOT_GIRDER5", "$(PORT_M)", 5 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
pattern
{ DESC , P , M , PORT , ADDR, DIR, VELO, HVEL, ACCL, JAR, MRES , PREC, EGU , DHLM, DLLM}
{ "Girder 1", "$(P_M)", "MOT_GIR_1", "$(PORT_M)", 1 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 2", "$(P_M)", "MOT_GIR_2", "$(PORT_M)", 2 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 3", "$(P_M)", "MOT_GIR_3", "$(PORT_M)", 3 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 4", "$(P_M)", "MOT_GIR_4", "$(PORT_M)", 4 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder 5", "$(P_M)", "MOT_GIR_5", "$(PORT_M)", 5 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder X", "$(P_M)", "MOT_GIR_X", "$(PORT_M)", 9 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder Y", "$(P_M)", "MOT_GIR_Y", "$(PORT_M)", 10 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder U", "$(P_M)", "MOT_GIR_U", "$(PORT_M)", 11 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder V", "$(P_M)", "MOT_GIR_V", "$(PORT_M)", 12 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
{ "Girder W", "$(P_M)", "MOT_GIR_W", "$(PORT_M)", 13 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 }
}

View File

@@ -12,7 +12,7 @@ powerPmacCreateAxis($(PORT), 2)
powerPmacCreateAxis($(PORT), 3)
powerPmacCreateAxis($(PORT), 4)
powerPmacCreateAxis($(PORT), 5)
#powerPmacCreateAxis($(PORT), 6)
powerPmacCreateAxis($(PORT), 6)
#powerPmacCreateAxis($(PORT), 7)
#powerPmacCreateAxis($(PORT), 8)

View File

@@ -18,25 +18,35 @@ powerPmacCreateAxis($(PORT), 5)
#powerPmacCreateVirtualAxis(<port_name>, <axis_index>, <coord_sys_index>, <axis_name>,<commaSeparatedMotorIndices)
# !!! COMMENTS AFTER 'powerPmacCreateVirtualAxis("$(PORT)", 9, 1, "X",1)' IS NOT ALLOWED !!!
#powerPmacCreateVirtualAxis("$(PORT)", 9 , 1, "X",1,2,3,4)
#powerPmacCreateVirtualAxis("$(PORT)", 10, 1, "Y",1,2,3,4)
#powerPmacCreateVirtualAxis("$(PORT)", 11, 1, "A",1,2,3,4)
#powerPmacCreateVirtualAxis("$(PORT)", 12, 1, "B",1,2,3,4)
#powerPmacCreateVirtualAxis("$(PORT)", 13, 1, "C",1,2,3,4)
powerPmacCreateVirtualAxis("$(PORT)", 9 , 1, "X",1,2,3,4)
powerPmacCreateVirtualAxis("$(PORT)", 10, 1, "Y",1,2,3,4)
powerPmacCreateVirtualAxis("$(PORT)", 11, 1, "U",1,2,3,4)
powerPmacCreateVirtualAxis("$(PORT)", 12, 1, "V",1,2,3,4)
powerPmacCreateVirtualAxis("$(PORT)", 13, 1, "W",1,2,3,4)
OX=1
OY=1
OP=1
OYW=1
OR=1
powerPmacSetCustomMotion $(PORT) 1 1
powerPmacSetCustomMotion $(PORT) 2 1
powerPmacSetCustomMotion $(PORT) 3 1
powerPmacSetCustomMotion $(PORT) 4 1
powerPmacSetCustomMotion $(PORT) 5 1
powerPmacSetCustomMotion $(PORT) 9 1
powerPmacSetCustomMotion $(PORT) 10 1
powerPmacSetCustomMotion $(PORT) 11 1
powerPmacSetCustomMotion $(PORT) 12 1
powerPmacSetCustomMotion $(PORT) 13 1
# Load databse
dbLoadTemplate("$(ESB_MX_TEMPLATES)/$(P)3.subs", "PORT_M=$(PORT),P_M=$(P)")
require "HEXGIR" alarcon_a
#OX=1
#OY=1
#OP=1
#OYW=1
#OR=1
#require "HEXGIR" alarcon_a
# Load databse
dbLoadTemplate("$(HEXGIR_TEMPLATES)/HEXGIR_motor.subs", "PORT_M=$(PORT),P_M=$(P),M1=1,M2=2,M3=3,M4=4,M5=5,E1=1,E2=2,E3=3,E4=4,E5=5")
#dbLoadTemplate("$(HEXGIR_TEMPLATES)/HEXGIR_motor.subs", "PORT_M=$(PORT),P_M=$(P),M1=1,M2=2,M3=3,M4=4,M5=5,E1=1,E2=2,E3=3,E4=4,E5=5")
#dbLoadTemplate("$(HEXGIR_TEMPLATES)/HEXGIR_girder.subs", "P_M=$(P)")
dbLoadTemplate("$(HEXGIR_TEMPLATES)/HEXGIR_girder.subs", "P_M=$(P), X_OFFSET=$(OX),Y_OFFSET=$(OY),PITCH_OFFSET=$(OP),YAW_OFFSET=$(OYW),ROLL_OFFSET=$(OR)")
#dbLoadTemplate("$(HEXGIR_TEMPLATES)/HEXGIR_girder.subs", "P_M=$(P), X_OFFSET=$(OX),Y_OFFSET=$(OY),PITCH_OFFSET=$(OP),YAW_OFFSET=$(OYW),ROLL_OFFSET=$(OR)")

View File

@@ -1,50 +1,96 @@
//5 simulated cam movers
//the motor has 512*200*100 usteps per revolution (512 uystep/step, 200 steps/rev 1:100 gear)
//the ssi-encoder has 2**18=262144 steps per revolution
//calibration values such that 0 mdeg is the highest point (+5mm) and 180000mdeg = lowest point (-5mm)
//#1: homeoffset: -20907.5928142
//#2: homeoffset: 102320.329068
//#3: homeoffset: 168946.772022
//#4: homeoffset: -87830.7554146
//#5: homeoffset: -47956.2759182
!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-20907.)
!encoder_ssi(enc=2,numBits=18,posSf=5625./4096.)
!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=102320.)
!encoder_ssi(enc=3,numBits=18,posSf=5625./4096.)
!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=168946.)
!encoder_ssi(enc=4,numBits=18,posSf=5625./4096.)
!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-87830.)
!encoder_ssi(enc=5,numBits=18,posSf=5625./4096.)
!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-47956.)
!encoder_sim(enc=1,tbl=1,mot=1)
!motor(mot=1,dirCur=0,contCur=100,peakCur=100,timeAtPeak=1,JogSpeed=8.,numPhase=3,invDir=True)
Motor[1].pLimits=0;Motor[1].AmpFaultLevel=0;Motor[1].pAmpEnable=0;Motor[1].pAmpFault=0
define(SP_RelBrk='15',SP_LockBrk='16')
!encoder_sim(enc=2,tbl=2,mot=2)
!motor(mot=2,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=8.,numPhase=3,invDir=True)
Motor[2].pLimits=0;Motor[2].AmpFaultLevel=0;Motor[2].pAmpEnable=0;Motor[2].pAmpFault=0
// ---------- Custom Motion Programs ----------
!encoder_sim(enc=3,tbl=3,mot=3)
!motor(mot=3,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=8.,numPhase=3,invDir=True)
Motor[3].pLimits=0;Motor[3].AmpFaultLevel=0;Motor[3].pAmpEnable=0;Motor[3].pAmpFault=0
!cm_prem_post(ax=1,prem=15,post=16) //generates subprog 10,11,12,13
!cm_prem_post(ax=2,prem=15,post=16) //generates subprog 20,21,22,23
!cm_prem_post(ax=3,prem=15,post=16) //generates subprog 30,31,32,33
!cm_prem_post(ax=4,prem=15,post=16) //generates subprog 40,41,42,43
!cm_prem_post(ax=5,prem=15,post=16) //generates subprog 40,41,42,43
!encoder_sim(enc=4,tbl=4,mot=4)
!motor(mot=4,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=8.,numPhase=3,invDir=True)
Motor[4].pLimits=0;Motor[4].AmpFaultLevel=0;Motor[4].pAmpEnable=0;Motor[4].pAmpFault=0
!cm_prem_post(ax='X',axid=9,prem=15,post=16) //generates subprog 90,91,92,93
!cm_prem_post(ax='Y',axid=10,prem=15,post=16) //generates subprog 100,101,102,103
!cm_prem_post(ax='U',axid=11,prem=15,post=16) //generates subprog 110,111,112,113
!cm_prem_post(ax='V',axid=12,prem=15,post=16) //generates subprog 120,121,122,123
!cm_prem_post(ax='W',axid=13,prem=15,post=16) //generates subprog 120,121,122,123
!encoder_sim(enc=5,tbl=5,mot=5)
!motor(mot=5,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=8.,numPhase=3,invDir=True)
Motor[5].pLimits=0;Motor[5].AmpFaultLevel=0;Motor[5].pAmpEnable=0;Motor[5].pAmpFault=0
// ---------- PREM POST Programs ----------
//prem
open subprog SP_RelBrk
define(EndTime='L1'); // Local variable
Motor[1].IdCmd=1000;Motor[1].InPosBand=2
Motor[2].IdCmd=1000;Motor[2].InPosBand=2
Motor[3].IdCmd=1000;Motor[3].InPosBand=2
Motor[4].IdCmd=1000;Motor[4].InPosBand=2
Motor[5].IdCmd=1000;Motor[5].InPosBand=2
PowerBrick[1].GpioData[0].16.5=$1f
//send 1"wait\n"
//EndTime = Sys.Time + .1; // time + 10 sec.
//while (EndTime > Sys.Time){}
//send 1"wait done\n"
close
//post
open subprog SP_LockBrk
define(EndTime='L1'); // Local variable
//wait until all motors are in pos
EndTime = Sys.Time + 10; // time + 10 sec.
//send 1"wait."
while (EndTime > Sys.Time)
{
if(Coord[1].InPos)
{
send 1"inPos\n"
break
}
//if(Motor[1].InPos && Motor[2].InPos&& Motor[3].InPos&& Motor[4].InPos&& Motor[5].InPos)
// break
//send 1"."
}
//send 1"done\n"
Motor[1].IdCmd=0;Motor[1].InPosBand=10
Motor[2].IdCmd=0;Motor[2].InPosBand=10
Motor[3].IdCmd=0;Motor[3].InPosBand=10
Motor[4].IdCmd=0;Motor[4].InPosBand=10
Motor[5].IdCmd=0;Motor[5].InPosBand=10
PowerBrick[1].GpioData[0].16.5=$0
close
// //NEW:
// //the motor has 512*200*100 usteps per revolution (512 uystep/step, 200 steps/rev 1:100 gear)
// //the ssi-encoder has 2**18=262144 steps per revolution
// //motor_u_steps/inc_enc_step=39.0625
// //JogSpeed=102.4 ustep/ms=102400ustep/s = 512*200= 1 rev/sec
// posSf : position scale factor: encoder position to motor u-steps, 1 motor step is 512 motor u-steps
// motor_u_steps=posSf*encoder_steps -> posSf = motor_u_steps/encoder_steps
// default is 1.0 (1 motor_u_steps = 1 encoder_steps)
//for motor #2
//PowerBrick[0].GpioData[0].17=1
//#2j:360000
//PowerBrick[0].GpioData[0].17=0
//#2k
//!cm_brake(mot=2,curOn=1000,cs=1,delay=200,gpio=17)
// !encoder_ssi(enc=1,numBits=18,posSf=39.0625)
// !encoder_ssi(enc=2,numBits=18,posSf=39.0625)
// !encoder_ssi(enc=3,numBits=18,posSf=39.0625)
// !encoder_ssi(enc=4,numBits=18,posSf=39.0625)
// !encoder_ssi(enc=5,numBits=18,posSf=39.0625)
// !motor(mot=1,dirCur=600,JogSpeed=102.4)
// !motor(mot=2,dirCur=600,JogSpeed=102.4)
// !motor(mot=3,dirCur=600,JogSpeed=102.4)
// !motor(mot=4,dirCur=600,JogSpeed=102.4)
// !motor(mot=5,dirCur=600,JogSpeed=102.4)
// !cm_brake(mot=1,curOn=600,cs=1,delay=200,gpio=16)
// !cm_brake(mot=2,curOn=600,cs=1,delay=200,gpio=17)
// !cm_brake(mot=3,curOn=600,cs=1,delay=200,gpio=18)
// !cm_brake(mot=4,curOn=600,cs=1,delay=200,gpio=19)
// !cm_brake(mot=5,curOn=600,cs=1,delay=200,gpio=20)

19
cfg/MX3_setup_sim.cfg Normal file
View File

@@ -0,0 +1,19 @@
!encoder_sim(enc=1,tbl=1,mot=1)
!motor(mot=1,dirCur=0,contCur=100,peakCur=100,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True)
Motor[1].pLimits=0;Motor[1].AmpFaultLevel=0;Motor[1].pAmpEnable=0;Motor[1].pAmpFault=0
!encoder_sim(enc=2,tbl=2,mot=2)
!motor(mot=2,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True)
Motor[2].pLimits=0;Motor[2].AmpFaultLevel=0;Motor[2].pAmpEnable=0;Motor[2].pAmpFault=0
!encoder_sim(enc=3,tbl=3,mot=3)
!motor(mot=3,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True)
Motor[3].pLimits=0;Motor[3].AmpFaultLevel=0;Motor[3].pAmpEnable=0;Motor[3].pAmpFault=0
!encoder_sim(enc=4,tbl=4,mot=4)
!motor(mot=4,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True)
Motor[4].pLimits=0;Motor[4].AmpFaultLevel=0;Motor[4].pAmpEnable=0;Motor[4].pAmpFault=0
!encoder_sim(enc=5,tbl=5,mot=5)
!motor(mot=5,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True)
Motor[5].pLimits=0;Motor[5].AmpFaultLevel=0;Motor[5].pAmpEnable=0;Motor[5].pAmpFault=0

View File

@@ -1,5 +1,32 @@
!MX3_setup()
//!MX3_setup_sim() // comment out !MX3_setup() when this is active
//!MX3_home()
//using 360000 for 1 rev. -> 1.7453292519943296e-05=np.pi/180000
!MX3_coordTrf(exc=1000,height=2000,width=3000,length=4000,camSf=1.7453292519943296e-05)
//excentricity= 5mm
//height = 2mm ?
//width = 50cm ?
//length = 100cm ?
!MX3_coordTrf(exc=5000,height=2000,width=500000,length=1000000,camSf=1.7453292519943296e-05)
Coord[1].Ta=10
Coord[1].Td=10
Coord[1].AltFeedRate=1000
Coord[1].Tm=-10000 //1000um/FeedTime -> 1mm/sec
Coord[1].FeedTime=1000 //default value 1000um
Motor[1].InPosBand=10
Motor[2].InPosBand=10
Motor[3].InPosBand=10
Motor[4].InPosBand=10
Motor[5].InPosBand=10
#1..5hmz
#1..5j/
&1
cpx call 16 //lock brakes, motor current off

View File

@@ -1,6 +1,6 @@
//simulated 8 motors without needing real ones
$$$***
!common()
//$$$***
//!common()
//use some step and direction lines to setup simulate motors
// /afs/psi.ch/user/h/humar_t/public/Modules/XMI/cfg/xmi.cfg

78
python/5camMeas.py Executable file
View File

@@ -0,0 +1,78 @@
#!/usr/bin/env python
# *-----------------------------------------------------------------------*
# | |
# | Copyright (c) 2017 by Paul Scherrer Institute (http://www.psi.ch) |
# | |
# | Author Thierry Zamofing (thierry.zamofing@psi.ch) |
# *-----------------------------------------------------------------------*
'''
generate code to find HomeOffset for the 5cam systems
the results are:
amplitude: 5mm
#1: homeoffset: -20907.5928142
#2: homeoffset: 102320.329068
#3: homeoffset: 168946.772022
#4: homeoffset: -87830.7554146
#5: homeoffset: -47956.2759182
'''
import numpy as np
import matplotlib.pyplot as plt
def meas_rot_ctr(y,per=1):
# find the amplitude bias and phase of an equidistant sampled sinus
# it needs at least 3 measurements e.g. at 0,120 240 deg or 0 90 180 270 deg
# per is the number of persiods, default is 1 period =360 deg
n=len(y)
f = np.fft.fft(y)
idx=int(per)
bias=np.absolute(f[0]/n)
phase=np.angle(f[idx])
ampl=np.absolute(f[idx])*2/n
print('len: '+str(n))
print('bias: '+str(bias))
print('amplitude: '+str(ampl))
print('phase: '+str(phase*360./2/np.pi))
print('homeoffset: '+str(-phase*360./2/np.pi*1000))
def gen_code():
pos=np.arange(0,360000,12000)
mot=range(1,6)
#mot=range(1,2)
for m in mot:
print('''open prog %i
call15
abslinear
'''%(10+m))
for p in pos:
print(""" jog%i=%i
dwell 5000"""%(m,p))
print(""" jog%i=0
call16
close
"""%(m,))
for m in mot:
print("&1;b%ir"%(10+m))
def plot():
'''
&1;b11r
&1;b12r
&1;b13r
&1;b14r
&1;b15r
'''
data1=[0,-.475,-1.123,-1.916,-2.819,-3.797,-4.799,-5.786,-6.708,-7.531,-8.219,-8.746,-9.085,-9.229,-9.176,-8.929,-8.499,-7.895,-7.142,-6.271,-5.320,-4.325,-3.329,-2.377,-1.513,-.780,-.216,.151,.305,.241]
data2=[0,1.04,2.092,3.108,4.041,4.847,5.496,5.946,6.184,6.196,5.976,5.540,4.907,4.110,3.181,2.162,1.103,0.051,-.953,-1.859,-2.639,-3.252,-3.677,-3.892,-3.893,-3.677,-3.256,-2.648,-1.878,-.980]
data3=[0,.296,0.785,1.445,2.248,3.160,4.146,5.165,6.170,7.120,7.968,8.676,9.210,9.541,9.660,9.564,9.274,8.807,8.154,7.340,6.398,5.378,4.318,3.271,2.310,1.485,.790,.282,-.028,-.130,]
data4=[0,-1.035,-2.021,-2.930,-3.713,-4.333,-4.777,-5.018,-5.057,-4.888,-4.522,-3.967,-3.249,-2.393,-1.430,-0.402,.650,1.678,2.633,3.470,4.146,4.626,4.887,4.916,4.711,4.297,3.69,2.917,2.010,1.021]
data5=[0,-.847,-1.786,-2.794,-3.815,-4.808,-5.727,-6.537,-7.194,-7.681,-7.987,-8.089,-7.990,-7.688,-7.204,-6.547,-5.745,-4.831,-3.840,-2.814,-1.799,-.844,0.015,.726,1.257,1.58,1.683,1.562,1.223,.685]
data=[data1,data2,data3,data4,data5]
for d in data:
meas_rot_ctr(d,1)
plt.plot(d)
plt.show()
gen_code()
plot()

219
qt/ESB_MX_5cam.ui Normal file
View File

@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>776</width>
<height>342</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="caLabel" name="calabel">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>721</width>
<height>28</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>ESB MX 5 cam girder $(P)</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="background">
<color alpha="0">
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
</property>
</widget>
<widget class="caInclude" name="cainclude">
<property name="geometry">
<rect>
<x>20</x>
<y>70</y>
<width>725</width>
<height>240</height>
</rect>
</property>
<property name="macro">
<string>
P=$(P),M=MOT_GIR_1;
P=$(P),M=MOT_GIR_2;
P=$(P),M=MOT_GIR_3;
P=$(P),M=MOT_GIR_4;
P=$(P),M=MOT_GIR_5;
P=$(P),M=MOT_GIR_X;
P=$(P),M=MOT_GIR_Y;
P=$(P),M=MOT_GIR_U;
P=$(P),M=MOT_GIR_V;
P=$(P),M=MOT_GIR_W</string>
</property>
<property name="filename" stdset="0">
<string notr="true">ESB_MX_motor.ui</string>
</property>
<property name="numberOfItems" stdset="0">
<number>10</number>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>731</width>
<height>21</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="5,3,4,0,0,3">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="lbl_DESC_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>DESC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_VAL_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>VAL</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_RBV_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>RBV</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_LLS_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>LLS</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_HLS_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>HLS</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="MotPan_1">
<property name="text">
<string>Motors Panels</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>caLabel</class>
<extends>QLabel</extends>
<header>caLabel</header>
</customwidget>
<customwidget>
<class>caInclude</class>
<extends>QWidget</extends>
<header>caInclude</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -354,6 +354,48 @@ P=$(P),M=MOT_GIRDER5</string>
<property name="labels">
<string>HEXGIR</string>
</property>
<property name="files">
<string>ESB_MX_5cam.ui</string>
</property>
<property name="args">
<string>NAME=$(P), NAME1=$(P)</string>
</property>
<property name="stackingMode" stdset="0">
<enum>caRowColMenu::Menu</enum>
</property>
<property name="removeParent" stdset="0">
<string>false;false;false;false;false;false;false;false;false;false;false;false;false;false;false;false</string>
</property>
</widget>
<widget class="caRelatedDisplay" name="caRelatedDisplay_10">
<property name="geometry">
<rect>
<x>340</x>
<y>620</y>
<width>151</width>
<height>30</height>
</rect>
</property>
<property name="label">
<string notr="true">-ESB_MX Girder(old)</string>
</property>
<property name="foreground">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="background">
<color>
<red>89</red>
<green>126</green>
<blue>225</blue>
</color>
</property>
<property name="labels">
<string>HEXGIR</string>
</property>
<property name="files">
<string>S_CS_HEXGIR_5Dbasic.ui</string>
</property>