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

Switched back to kmp2 (now properly patched for syncing). Changed debug...

Switched back to kmp2 (now properly patched for syncing).  Changed debug messages to focus on DMOV now.  Still syncing soft motor targets at end of every move.

git-svn-id: https://subversion.xray.aps.anl.gov/kmp/transform/trunk@263 f095f811-4e88-6c84-d33e-e382bdb4531c
parent d0a6f722
No related branches found
No related tags found
No related merge requests found
#setenv EPICS_DISPLAY_PATH /APSshare/epics/synApps_5_5/support/all_adl
medm -x -attach -macro "P=kmp3:,M1=m1,M2=m2,M3=m3" motor3x.adl &
medm -x -attach -macro "P=kmp2:,M1=m1,M2=m2,M3=m3" motor3x.adl &
sleep 4.0
medm -x -attach -macro "P=kmp3:,M1=m4,M2=m5,M3=m6" motor3x.adl &
medm -x -attach -macro "P=kmp3:,M1=lab:m1,M2=lab:m2,M3=lab:m3" motor3x.adl &
medm -x -attach -macro "P=kmp3:,M=m1" ~/epics/synAppsSVN/support/motor/motorApp/op/adl/motorx_all.adl &
medm -x -attach -macro "P=kmp3:lab:,M=m1" ~/epics/synAppsSVN/support/motor/motorApp/op/adl/motorx_all.adl &
medm -x -attach -macro "P=kmp2:,M1=m4,M2=m5,M3=m6" motor3x.adl &
medm -x -attach -macro "P=kmp2:,M1=lab:m1,M2=lab:m2,M3=lab:m3" motor3x.adl &
medm -x -attach -macro "P=kmp2:,M=m1" ~/epics/synAppsSVN/support/motor/motorApp/op/adl/motorx_all.adl &
medm -x -attach -macro "P=kmp2:lab:,M=m1" ~/epics/synAppsSVN/support/motor/motorApp/op/adl/motorx_all.adl &
......@@ -51,8 +51,8 @@ class myTransform(transform.transform):
return retval.tolist()[0]
if __name__ == "__main__":
#!prefix = 'kmp2:'
prefix = 'kmp3:'
prefix = 'kmp2:'
#!prefix = 'kmp3:'
realMotors = ["%s%s" % (prefix, x) for x in ('m1', 'm2', 'm3') ]
transformMotors = ["%s%s" % (prefix, x) for x in ('m4', 'm5', 'm6') ]
softMotors = ["%s%s" % (prefix, x) for x in ('lab:m1', 'lab:m2', 'lab:m3') ]
......
......@@ -21,6 +21,7 @@ class transform:
self.stopMotorsFlag = False
self.syncSoftTargetFlag = False
self.reinitFlag = False
# Is only used if SYNC should happen conditionally
self.softMotorInitiatedMove = False
self.abortFlag = False
self.initCompleteFlag = False
......@@ -126,11 +127,27 @@ class transform:
### Callback functions (to be called when PV values change--only set flags that are watched in main loop)
def driveCallback(self, **kw):
print "driveCallback:\n", " ", kw['pvname'], kw['value']
#!print "driveCallback:\n", " ", kw['pvname'], kw['value']
#!print "_ updateReadbackFlag =", self.updateReadbackFlag
#!print "_ dmovChangeFlag =", self.dmovChangeFlag
#!print "_ moveSoftMotorFlag =", self.moveSoftMotorFlag
#!print "_ stopMotorsFlag =", self.stopMotorsFlag
#!print "_ syncSoftTargetFlag =", self.syncSoftTargetFlag
#!print "_ reinitFlag =", self.reinitFlag
#!print "_ softMotorInitiatedMove =", self.softMotorInitiatedMove
#!print "_ abortFlag =", self.abortFlag
#!print "_ initCompeteFlag =", self.initCompleteFlag
#!print "_ syncInProgress =", self.syncInProgress
if self.initCompleteFlag == True and self.syncInProgress == False:
self.moveSoftMotorFlag = True
self.softMotorInitiatedMove = True
#!print " move real motors because NOT syncing"
else:
#!print " not moving real motors because a sync is in progress or initializing"
pass
def rdbkCallback(self, **kw):
#!print "rdbkCallback:\n", " ", kw['pvname'], kw['value']
self.updateReadbackFlag = True
......@@ -141,7 +158,7 @@ class transform:
self.stopMotorsFlag = True
def dmovCallback(self, **kw):
#!print "dmovCallback:\n", " ", kw['pvname'], kw['value']
print "dmovCallback:\n", " ", kw['pvname'], kw['value']
self.dmovChangeFlag = True
def connectionCallback(self, **kw):
......@@ -164,7 +181,7 @@ class transform:
# Do the forward transform
tm_positions = self.fwdTrans(m_positions, t_positions)
print "updating readbacks:", tm_positions
#!print "updating readbacks:", tm_positions
# Write the soft (transformed) readback positions
for i in range(len(tm_positions)):
......@@ -174,7 +191,6 @@ class transform:
# This is only useful if LOCK = YES
def syncSoftTargets(self):
print "softMotorInitiatedMove =", self.softMotorInitiatedMove
# Synchronize soft targets if a real motor initated the move
#!if self.softMotorInitiatedMove == False:
# Always sync soft-motor target position (is this bad for spec?)
......@@ -183,25 +199,16 @@ class transform:
self.syncInProgress = True
# The following sleep is required to prevent problems when making small moves
sleep(0.05)
#!#tm_positions = [x.get() for x in self.tm_rbv]
#!### MAYBE SHOULD RECALCULATE BASED ON REAL MOTORS INSTEAD
#!m_positions = [x.get() for x in self.m_val]
#!t_positions = [x.get() for x in self.t_rbv]
#!# Do the forward transform
#!tm_positions = self.fwdTrans(m_positions, t_positions)
#!#!print "syncing these target positions:", tm_positions
###sleep(0.05)
for i in range(len(self.tm_rbv)):
print i
#!print i
self.tm_sync[i].put(1)
# A delay is necessary before setting syncInProgress to False
sleep(0.05)
#!self.tm_proc[i].put(1)
###sleep(0.05)
#
sleep(0.1)
self.syncInProgress = False
# For soft-motor-initiate moves don't do anything
......@@ -218,7 +225,7 @@ class transform:
m_dmovs = [x.get() for x in self.m_dmov]
t_dmovs = [x.get() for x in self.t_dmov]
#!print m_dmovs, t_dmovs
print m_dmovs, t_dmovs
# Determine if any motors are moving
if ( ( 0 in m_dmovs ) or ( 0 in t_dmovs ) ):
......@@ -230,7 +237,7 @@ class transform:
# Write the soft (transformed) dmovs
for i in range(len(self.tm_dmov)):
#!print "setting dmov for tm%i to %i" % (i, dmov)
print "setting dmov for tm%i to %i" % (i, dmov)
self.tm_dmov[i].put(dmov)
### Sanity check
......@@ -258,6 +265,7 @@ class transform:
# Write the real motor target positions
for i in range(len(self.m_val)):
#!print "Actually changing the real motor target positions"
self.m_val[i].put(m_positions[i])
# also manually the dmov since this needs to be in sync very quickly
self.tm_dmov[i].put(0)
......@@ -318,16 +326,16 @@ class transform:
#!print "idle: stop motors"
self.stopMotors()
if self.moveSoftMotorFlag == True:
print "idle: move motors"
#!print "idle: move motors"
self.moveMotors()
if self.dmovChangeFlag == True:
print "idle: update dmov"
#!print "idle: update dmov"
self.updateDmov()
if self.updateReadbackFlag == True:
print "idle: update readback"
#!print "idle: update readback"
self.updateReadbacks()
if self.syncSoftTargetFlag == True:
print "idle: sync soft targets"
#!print "idle: sync soft targets"
self.syncSoftTargets()
if __name__ == "__main__":
......
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