The following script demonstrates how to control moves which are executed with a very low acceleration. The problem is that the de-acceleration lasts longer than 3s the Tango time-out. The problem is solved by monitoring the hardware register contents. The call to GetStepRegister() invokes a check-motor-registers(). Yes, this script is a horrible hack. Once the Oms server has been fixed in this respect, this example will be removed from the document.
#!/usr/bin/env python # # this script # - executes a move with a motor # - interrupts the movement # - wait for the motion to be finished by looking at # the state() and the controller register # import time import string import sys from PyTango import * motorName = "someNode:10000:p19/motor/exp.65"; def execMove( proxy, pos): proxy.Position = pos stepsOld = None count = 0 while 1: print( "state %s Ctrl %d Int %d" % (proxy.state(), proxy.StepPositionController, proxy.StepPositionInternal)) if proxy.state() == DevState.ON: if (not proxy.StepPositionController == proxy.StepPositionInternal) and \ (proxy.StepPositionController == stepsOld): print( "moveLowAcc: invoking check-motor-registers") proxy.GetStepPosition() return 1 stepsOld = proxy.StepPositionController count += 1 if count == 10: print9 "Calling stop move") proxy.StopMove() time.sleep(0.5) proxy = DeviceProxy( motorName) if len( sys.argv) == 1: print( " Position %g " % proxy.Position) sys.exit() if len( sys.argv) != 2: print( "\n usage: ./moveLowAcc.py [pos]") sys.exit() pos = sys.argv[1] execMove( proxy, float(pos)) print( "motor position %g " % proxy.Position)