#! /usr/bin/env mpscript # # This script moves the motor to the requested position. # import time def main( record_list, argv ): if ( len(argv) != 2 ): print( "" ) print( "Usage: mp_move motorname new_position" ) print( "" ) sys.exit(1); motorname = argv[0] new_position = float( argv[1] ) motor = record_list.get_record( motorname ) units = motor.get_field("units") print( "Moving motor '%s' to %f %s" \ % ( motorname, new_position, units ) ) motor.move_absolute( new_position ) # Wait for the move to complete. while (1): position = motor.get_position() print( " %f" % ( position ) ) if ( motor.is_busy() == 0 ): break time.sleep( 1.0 ) print( "Motor move complete." )