#! /usr/bin/env mpenv # # This script moves the motor to the requested position. # import sys import time import Mp import MpCa if ( len(sys.argv) != 4 ): print "" print "Usage: mpca_move motorname new_position" print "" sys.exit(0); motor_name = sys.argv[2] new_position = float(sys.argv[3]) dmov_pv = MpCa.PV( "%s.DMOV" % motor_name ) egu_pv = MpCa.PV( "%s.EGU" % motor_name ) rbv_pv = MpCa.PV( "%s.RBV" % motor_name ) val_pv = MpCa.PV( "%s.VAL" % motor_name ) units = egu_pv.caget() print "Moving motor '%s' to %f %s" % ( motor_name, new_position, units ) val_pv.caput( new_position ) # Wait for the move to complete. while (1): position = rbv_pv.caget() print " %f" % ( position ) dmov = dmov_pv.caget() if ( dmov == 1 ): break time.sleep( 1.0 ) print "Motor move complete."