Skip to content
Snippets Groups Projects
Commit f3ed52a8 authored by kpetersn's avatar kpetersn
Browse files

The deployed copy from the beamline. Timestamps are older than the previous commits:

-rw-rw-r-- 1 epix34id     xsdmc     2532 Dec  4  2013 labTransform.py
-rw-rw-r-- 1 epix34id     xsdmc    12030 Oct 17  2013 transform.py



git-svn-id: https://subversion.xray.aps.anl.gov/kmp/transform/trunk@861 f095f811-4e88-6c84-d33e-e382bdb4531c
parent 5ffb31df
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python #!/usr/bin/env python
#start this with epd python: /APSshare/epd/rh5-x86/bin/python labTransform.py #start this with epd python: /APSshare/epd/rh5-x86/bin/python labTransform.py
# /APSshare/epd/rh5-x86_64/bin/python labTransform.py
import transform import transform
from numpy import matrix, sin, cos, degrees, radians from numpy import matrix, sin, cos, degrees, radians
...@@ -55,9 +56,12 @@ class myTransform(transform.transform): ...@@ -55,9 +56,12 @@ class myTransform(transform.transform):
if __name__ == "__main__": if __name__ == "__main__":
prefix = '34idc:' prefix = '34idc:'
labStr = 'lab' labStr = 'lab'
realMotors = ["%s%s" % (prefix, x) for x in ('m58:c3:m5', 'm58:c3:m6', 'm58:c0:m8') ] # realMotors = ["%s%s" % (prefix, x) for x in ('sm1', 'sm2', 'sm3') ]
realMotors = ["%s%s" % (prefix, x) for x in ('mxv:c1:m5', 'mxv:c1:m6', 'mxv:c0:m1') ]
# realMotors = ["%s%s" % (prefix, x) for x in ('npt:c0:m1', 'npt:c0:m2', 'npt:c0:m3') ] # realMotors = ["%s%s" % (prefix, x) for x in ('npt:c0:m1', 'npt:c0:m2', 'npt:c0:m3') ]
transformMotors = ["%s%s" % (prefix, x) for x in ('aero:c0:m1', 'm58:c3:m1', 'm58:c3:m2') ] # realMotors = ["%s%s" % (prefix, x) for x in ('npt:c1:m1', 'npt:c1:m2', 'npt:c1:m3') ]
transformMotors = ["%s%s" % (prefix, x) for x in ('aero:c0:m1',
'mxv:c1:m1', 'mxv:c1:m2') ]
softMotors = ["%s%s:%s" % (prefix, labStr, x) for x in ('m1', 'm2', 'm3') ] softMotors = ["%s%s:%s" % (prefix, labStr, x) for x in ('m1', 'm2', 'm3') ]
enablePv = "%s%s:enable" % (prefix, labStr) enablePv = "%s%s:enable" % (prefix, labStr)
print realMotors, transformMotors, softMotors, enablePv print realMotors, transformMotors, softMotors, enablePv
......
...@@ -27,7 +27,6 @@ class transform: ...@@ -27,7 +27,6 @@ class transform:
self.initCompleteFlag = False self.initCompleteFlag = False
self.syncInProgress = False self.syncInProgress = False
self.motorSyncComplete = {}
### PVs to set ### PVs to set
...@@ -111,7 +110,6 @@ class transform: ...@@ -111,7 +110,6 @@ class transform:
self.tm_val.append( epics.PV(tempStr, callback=self.driveCallback, connection_callback=self.connectionCallback) ) self.tm_val.append( epics.PV(tempStr, callback=self.driveCallback, connection_callback=self.connectionCallback) )
self.tm_dict[tempStr] = 0 self.tm_dict[tempStr] = 0
self.tm_keys.append(tempStr) self.tm_keys.append(tempStr)
self.motorSyncComplete[tempStr] = True
#!print self.tm_dict #!print self.tm_dict
# soft motor STOP (monitor for stop request detection) # soft motor STOP (monitor for stop request detection)
...@@ -147,23 +145,15 @@ class transform: ...@@ -147,23 +145,15 @@ class transform:
def driveCallback(self, **kw): def driveCallback(self, **kw):
#!print "driveCallback:\n", " ", kw['pvname'], kw['value'] #!print "driveCallback:\n", " ", kw['pvname'], kw['value']
#!print "---> syncInProgress", self.syncInProgress if self.initCompleteFlag == True and self.syncInProgress == False:
if self.initCompleteFlag == True: self.moveSoftMotorFlag = True
if self.syncInProgress == False: self.softMotorInitiatedMove = True
self.moveSoftMotorFlag = True #!print " move real motors because NOT syncing"
self.softMotorInitiatedMove = True # Set sotf-move indicator
#!print " move real motors because NOT syncing" self.tm_dict[ kw['pvname'] ] = 1
# Set soft-move indicator #!print self.tm_dict
self.tm_dict[ kw['pvname'] ] = 1
#!print self.tm_dict
else:
# syncInProgress
self.motorSyncComplete[ kw['pvname'] ] = True
if False not in self.motorSyncComplete.values():
# sync is done
self.syncInProgress = False
else: else:
#!print " not moving real motors because initializing" #!print " not moving real motors because a sync is in progress or initializing"
pass pass
def rdbkCallback(self, **kw): def rdbkCallback(self, **kw):
...@@ -216,12 +206,18 @@ class transform: ...@@ -216,12 +206,18 @@ class transform:
# #
self.syncInProgress = True self.syncInProgress = True
# The following sleep is required to prevent problems when making small moves
###sleep(0.05)
for i in range(len(self.tm_rbv)): for i in range(len(self.tm_rbv)):
#!print i #!print i
self.tm_sync[i].put(1) self.tm_sync[i].put(1)
# A delay is necessary before setting syncInProgress to False
###sleep(0.05)
for k in self.motorSyncComplete.keys(): #
self.motorSyncComplete[k] = False sleep(0.1)
self.syncInProgress = False
# For soft-motor-initiate moves don't do anything # For soft-motor-initiate moves don't do anything
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment