rework panels using motor_[exp|usr].ui
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -46,3 +46,4 @@ src/usrServo/usrServo.sublime-workspace
|
||||
*Doc/*.blg
|
||||
|
||||
|
||||
qt/motor_*.ui
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>776</width>
|
||||
<height>798</height>
|
||||
<width>720</width>
|
||||
<height>620</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -46,156 +46,30 @@
|
||||
<widget class="caInclude" name="cainclude">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>731</width>
|
||||
<height>420</height>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>700</width>
|
||||
<height>274</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">PB_motor.ui</string>
|
||||
<string notr="true">motor_1m.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 name="verticalSpacing" stdset="0">
|
||||
<number>6</number>
|
||||
</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 class="caTextEntry" name="ca_VAL_1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>750</y>
|
||||
<y>582</y>
|
||||
<width>411</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
@@ -211,7 +85,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>700</y>
|
||||
<y>532</y>
|
||||
<width>451</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@@ -225,7 +99,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>500</y>
|
||||
<y>332</y>
|
||||
<width>341</width>
|
||||
<height>194</height>
|
||||
</rect>
|
||||
@@ -1223,7 +1097,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>450</x>
|
||||
<y>510</y>
|
||||
<y>342</y>
|
||||
<width>161</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>645</width>
|
||||
<height>680</height>
|
||||
<width>610</width>
|
||||
<height>735</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -60,15 +60,15 @@
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>53</y>
|
||||
<width>626</width>
|
||||
<height>612</height>
|
||||
<width>590</width>
|
||||
<height>672</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="macro">
|
||||
<string>P=$(P),T=$(T),M=$(M)1;P=$(P),T=$(T),M=$(M)2;P=$(P),T=$(T),M=$(M)3;P=$(P),T=$(T),M=$(M)4;P=$(P),T=$(T),M=$(M)5;P=$(P),T=$(T),M=$(M)6;P=$(P),T=$(T),M=$(M)7;P=$(P),T=$(T),M=$(M)8;P=$(P),T=$(T),M=$(M)9;P=$(P),T=$(T),M=$(M)10;P=$(P),T=$(T),M=$(M)11;P=$(P),T=$(T),M=$(M)12;P=$(P),T=$(T),M=$(M)13;P=$(P),T=$(T),M=$(M)14;P=$(P),T=$(T),M=$(M)15</string>
|
||||
</property>
|
||||
<property name="filename" stdset="0">
|
||||
<string notr="true">MCS_stage.ui</string>
|
||||
<string notr="true">motor_exp.ui</string>
|
||||
</property>
|
||||
<property name="numberOfItems" stdset="0">
|
||||
<number>15</number>
|
||||
@@ -80,83 +80,6 @@
|
||||
<enum>caInclude::NoFrame</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>30</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>URW Gothic L</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Relative</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>215</x>
|
||||
<y>30</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>URW Gothic L</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>7</x>
|
||||
<y>30</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>URW Gothic L</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Motor</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>346</x>
|
||||
<y>30</y>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>URW Gothic L</family>
|
||||
<pointsize>12</pointsize>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Absolute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
146
qt/ESB_MX_SmarAct_home.py
Executable file
146
qt/ESB_MX_SmarAct_home.py
Executable file
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env python
|
||||
#*-----------------------------------------------------------------------*
|
||||
#| |
|
||||
#| Copyright (c) 2014 by Paul Scherrer Institute (http://www.psi.ch) |
|
||||
#| |
|
||||
#| Author Thierry Zamofing (thierry.zamofing@psi.ch) |
|
||||
#*-----------------------------------------------------------------------*
|
||||
'''
|
||||
Homing procedure for PPRM.
|
||||
|
||||
Long Doc'''
|
||||
#for ID in 1 2 3 4 5 6
|
||||
#do
|
||||
#caput MYPREFIX:MOTOR_$ID.RLV 55
|
||||
#caput MYPREFIX:MOTOR_$ID.SET Set
|
||||
#caput MYPREFIX:MOTOR_$ID.VAL 0
|
||||
#caput MYPREFIX:MOTOR_$ID.SET Use
|
||||
#done
|
||||
|
||||
#for ID in 1 2 3 4 5 6
|
||||
#do
|
||||
#caput MYPREFIX:MOTOR_$ID.RLV -10
|
||||
#done
|
||||
|
||||
|
||||
import logging, sys, os, json
|
||||
import CaChannel,time
|
||||
|
||||
class EsbMxSmaract:
|
||||
|
||||
def __init__(self, args):
|
||||
self.args=args
|
||||
prefix=self.args.var[0]
|
||||
if prefix[-1]==':':prefix[:-1]
|
||||
self.prefix=prefix
|
||||
self.pv=pvDict=dict()
|
||||
for i in range(1,16):
|
||||
#SARES30-ESBMX1:FRM_FORW.PROC
|
||||
#SARES30-ESBMX1:DRIVE
|
||||
|
||||
s1=prefix+'%i'%i
|
||||
for j in ('DRIVE','MOTRBV','FRM_FORW.PROC','FRM_BACK.PROC','GET_HOMED','STATUS'):
|
||||
s2=s1+':'+j
|
||||
print(s2)
|
||||
pv = CaChannel.CaChannel(s2)
|
||||
pv.setTimeout(10.0)
|
||||
pv.search()
|
||||
pvDict[s2]=pv
|
||||
CaChannel.ca.pend_io(10.0)
|
||||
#print(pvDict)
|
||||
#pvDict['cryorbv'] = CaChannel.CaChannel("SAR-EXPMX:MOT_CRYO.RBV")
|
||||
#pvDict['cryorbv'].search()
|
||||
|
||||
def home(self,idx,fwd):
|
||||
print('home motor %i fwd:%d...'%(idx,fwd))
|
||||
if fwd:
|
||||
pv=self.pv[self.prefix+'%i'%idx+':'+'FRM_FORW.PROC']
|
||||
else:
|
||||
pv=self.pv[self.prefix+'%i'%idx+':'+'FRM_BACK.PROC']
|
||||
pv.putw(1) #set position and move
|
||||
CaChannel.ca.pend_event(0.1)
|
||||
|
||||
def waitHomed(self,idx):
|
||||
pv=self.pv[self.prefix+'%i'%idx+':'+'GET_HOMED']
|
||||
while pv.getw()==0:
|
||||
print('wait motor %i homing done ...'%idx)
|
||||
CaChannel.ca.pend_event(0.2)
|
||||
|
||||
def moveAbs(self,idx,val):
|
||||
pv=self.pv[self.prefix+'%i'%idx+':'+'DRIVE']
|
||||
pv.putw(val) #set position and move
|
||||
|
||||
|
||||
def check_pos(self, idx, val, tolerance=0.1):
|
||||
pvrbv = self.pv[self.prefix+'%i'%idx+':'+'MOTRBV']
|
||||
pvst = self.pv[self.prefix+'%i'%idx+':'+'STATUS']
|
||||
|
||||
CaChannel.ca.pend_event(0.2)
|
||||
while pvst.getw():
|
||||
CaChannel.ca.pend_event(0.2)
|
||||
rbv=pvrbv.getw()
|
||||
if abs(val - rbv) > tolerance:
|
||||
raise Exception("failed to reach target value %g,%g,%g"%(val,rbv,tolerance))
|
||||
|
||||
def homing(self):
|
||||
#start homing in desired direction
|
||||
#cryorbv = self.pv['cryorbv']
|
||||
#if cryorbv.getw() < 4.9:
|
||||
# raise Exception("Cryojet is too close, move it to 5.0 mm")
|
||||
|
||||
# home Colli Y first and move it to the TOP
|
||||
self.home(2, True)
|
||||
CaChannel.ca.pend_event(0.5)
|
||||
self.waitHomed(2)
|
||||
CaChannel.ca.pend_event(0.5)
|
||||
self.moveAbs(2, 10.0)
|
||||
self.check_pos(2, 10.0)
|
||||
|
||||
for idx,fwd in ((1,True),(4,True),(5,True),(6,True),(7,True),(8,True),(10,True),(11,True),(12,True),(13,True),(14,True),(15,True),):
|
||||
self.home(idx,fwd)
|
||||
CaChannel.ca.pend_event(0.5)
|
||||
#wait homing done
|
||||
for idx in (1,4,5,6,7,8,10,11,12,13,14,15,):
|
||||
self.waitHomed(idx)
|
||||
|
||||
#move to desired position
|
||||
for idx,val in ((1,-10),(4,.4),(5,.5),(6,.6),(7,.7),(8,.8),(10,1.0),(11,1.1),(12,1.2),(13,1.3),(14,1.4),(15,1.5),):
|
||||
self.moveAbs(idx,val)
|
||||
print('Homing done')
|
||||
|
||||
if __name__=='__main__':
|
||||
from optparse import OptionParser, IndentedHelpFormatter
|
||||
class MyFormatter(IndentedHelpFormatter):
|
||||
'helper class for formating the OptionParser'
|
||||
|
||||
def __init__(self):
|
||||
IndentedHelpFormatter.__init__(self)
|
||||
|
||||
def format_epilog(self, epilog):
|
||||
if epilog:
|
||||
return epilog
|
||||
else:
|
||||
return ""
|
||||
|
||||
def parse_args():
|
||||
'main command line interpreter function'
|
||||
#usage: gpasciiCommunicator.py --host=PPMACZT84 myPowerBRICK.cfg
|
||||
(h, t)=os.path.split(sys.argv[0]);cmd='\n '+(t if len(h)>3 else sys.argv[0])+' '
|
||||
exampleCmd=('SARES30-ESBMX',
|
||||
)
|
||||
epilog=__doc__+'''
|
||||
Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n '
|
||||
|
||||
fmt=MyFormatter()
|
||||
parser=OptionParser(epilog=epilog, formatter=fmt)
|
||||
#parser.add_option('', '--host', dest='host', help='hostname (or none to use locally)', metavar='HOST')
|
||||
#parser.add_option('-v', '--verbose', type="int", dest='verbose', help='verbosity bits (see below)', default=0)
|
||||
(args, other)=parser.parse_args()
|
||||
print(args,other)
|
||||
args.var=other
|
||||
esbMxSmaract=EsbMxSmaract(args)
|
||||
esbMxSmaract.homing()
|
||||
|
||||
#os.environ['EPICS_CA_ADDR_LIST']='localhost'
|
||||
parse_args()
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>776</width>
|
||||
<height>977</height>
|
||||
<width>720</width>
|
||||
<height>680</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -16,7 +16,7 @@
|
||||
<widget class="caLabel" name="calabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>721</width>
|
||||
<height>28</height>
|
||||
@@ -46,27 +46,30 @@
|
||||
<widget class="caInclude" name="cainclude">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>731</width>
|
||||
<height>882</height>
|
||||
<width>700</width>
|
||||
<height>582</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="macro">
|
||||
<string>P=$(P),M=MOT_FY;P=$(P),M=MOT_FX;P=$(P),M=MOT_CY;P=$(P),M=MOT_CX;P=$(P),M=MOT_CZ;P=$(P),M=MOT_WEDGE1;P=$(P),M=MOT_WEDGE2;P=$(P),M=MOT_WEDGE3;P=$(P),M=MOT_WEDGE4;P=$(P),M=MOT_WEDGEX;P=$(P),M=MOT_WEDGEY;P=$(P),M=MOT_WEDGEA;P=$(P),M=MOT_WEDGEB;P=$(P),M=MOT_BLGT;P=$(P),M=MOT_CRYO;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;P=$(P),M=MOT_DET_Z</string>
|
||||
</property>
|
||||
<property name="filename" stdset="0">
|
||||
<string notr="true">PB_motor.ui</string>
|
||||
<string notr="true">motor_1m.ui</string>
|
||||
</property>
|
||||
<property name="numberOfItems" stdset="0">
|
||||
<number>21</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" stdset="0">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="caMessageButton" name="camessagebutton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>940</y>
|
||||
<x>130</x>
|
||||
<y>640</y>
|
||||
<width>120</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -87,8 +90,8 @@
|
||||
<widget class="caToggleButton" name="catogglebutton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>940</y>
|
||||
<x>350</x>
|
||||
<y>640</y>
|
||||
<width>100</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -109,8 +112,8 @@
|
||||
<widget class="caMessageButton" name="camessagebutton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>940</y>
|
||||
<x>250</x>
|
||||
<y>640</y>
|
||||
<width>90</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -128,8 +131,8 @@
|
||||
<widget class="caMessageButton" name="camessagebutton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>940</y>
|
||||
<x>10</x>
|
||||
<y>640</y>
|
||||
<width>120</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -150,8 +153,8 @@
|
||||
<widget class="caRelatedDisplay" name="caRelatedDisplay_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>560</x>
|
||||
<y>940</y>
|
||||
<x>510</x>
|
||||
<y>640</y>
|
||||
<width>180</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
|
||||
Reference in New Issue
Block a user