Motor Controls & Drive using PythonFerdi Franceschini2008-11-08 12:48Drive commandsMany objects in SICS are drivable . This means they can run to a new value. Obvious
examples are motors. Less obvious examples include composite adjustments such as setting
a wavelength or an energy. Such devices are also called virtual motors. This class of
objects can be operated by the drive, run, success family of commands. These commands
cater for blocking and non-blocking modes of operation. In the example commands below, "mot1" can be replaced by
the motor short name, or the hdb_path. hdb_path is the verbose path to the motor e.g.
/sample/azimuthal_angle whereas the short name is
stth. The tcl command line only allows use of the short name for
these commands. Commands are CASE SENSITIVE.These python commands are available from both the python command line and python
scripts. Firstly you must import the sics module. from gumpy.commons import sicsCommandssics.execute("any_sics_command")executes any_sics_command without feedback.
Useful for when a sics command is not implemented in python. sics.run("mot1", pos1)runs mot1 to pos1.
Asynchronous. sics.set("mot1", pos1)is the same as sics.run. Prints log information to
console. "set" is a universal computing keyword for setting values.
Asynchronous. success()not implemented in python. In tcl, waits and blocks the command connection
until all pending operations have finished (or an interrupt occured).sics.drive("mot1", pos1)is the same as run but it blocks the client that
requested the drive from issuing commands until the
motion has finished. This command will set the variables in motion and wait
until the driving has finished. A drive can be seen as a
sequence of a run command as stated above immediatly
followed by a success commandsics.multiDrive({"mot1":pos1, "mot2":pos2})is the same as sics.drive but allows you to drive a
list of motors simultaneously. Due to the verbose syntax to create a list,
this is not the default drive command. sics.setpos("mot", oldPosition, newPosition)Sets the position value of oldPosition to
newPosition. TO BE TESTED.sics.getValue("mot")returns the current position of the motor. All zero point and sign
corrections are appliedmothardpositionnot implemented in pythonmotlistnot implemented in pythonmotresetnot implemented in pythonmotinterestnot implemented in pythonmotuninterestnot implemented in pythonmothomerun not implemented in pythonParametersThese values are generally not used during an experiment. These are used to optimise
and protect the instrument and hence are used by the instrument scientist or computing
& electronics staff. These values can be get and set using sics.getValue("hdb_path")
and sics.set("hdb_path",value)You cannot use the motor short name. BUG: If you try to set values that are at a higher
level of privilege, the console will report OK, but the SICS Server view will report an
error.Parameters that are persistent between restarts of SICS are marked as persists,
otherwise a restart of SICS will revert to the value in the configuration file. Parameters to be added: Blockage_Thresh, Blockage_Ratio, Blockage_Fail, Backlash_offsetProtocol, absEncoder, absEncHome, cntsPerXCreep_Offset, Creep_Precision, stepsPerXmaxSpeed, maxAccel, maxDecel, motOffDelay, Debug, Settle. motabsencPrivilege = UserNot implemented. Does not have an hdb_path. Get the absolute encoder reading. (Only implemented by motors that have
absolute encoders.)accelPrivilege = UserGet/Set the acceleration along/about the axis controlled by this motor in
physical units per square second, ie mm/s^2, deg/s^2accesscode(persists)Default = i.e. userPrivilege = ManagerControls which type of user is allowed to control the motorAllowed val Internal. Motor is reserved for internal use by
SICS Manager. Only users who logon as managers are allowed
to move the motor. Usually just instrument scientists User Spy. Anyone is allowed to move the motorBlockage_Check_Interval(persists)Privilege = ManagerUnits = secondsGet/Set the interval at which the motor driver checks the axis for
significant changes in positiondecelPrivilege = UserGet/Set the deceleration along/about the axis controlled by this motor in
physical units per second, ie mm/s2,
deg/s2.failafterPrivilege = ManagerThis is the number of consecutive failures of positioning operations this
motor allows before it thinks that something is really broken and aborts the
experimentfixed(persists)Default = 1.0Privilege = UserSet to 1.0 to prevent the motor from being moved, set to -1.0 to allow
movement.NOTE: The instrument manager can set the accesscode to prevent users from
moving a motor.mothomevalsubject to change. This may be changed to a configuration only
parameterPrivilege = ManagerGet/Set the home position for the axis which the motor controls, (ie phi,
chi, two-theta, x, y). So it is the physical home position in the units
given by the units parameter below, (ie mm,
degrees, ...)ignorefault(persists)Position faults will be ignored if this is greater than zerointerruptmode(persists)Default = 0 (continue)Privilege = ManagerControls what effect a motor failure has on operationsAllowed val one of: Continue. A motor failure will not affect other
operations AbortOperation. Stop current hardware operation but no
scans or batchfiles AbortScan. Stop current scan or operation but continue
processing of batch files with next command AbortBatch. Stop all processing, even batch
filesmaxretryDefault = Privilege = ManagerThe number of times that SICS will retry a move
if a motor has not reached the target position to within the required
precisionmovecount(persists)Default=Privilege = ManagerControls frequency with which position changes are reported if a user
subscribes interest to a motor. A larger value reduces the frequencyprecision(persists)Privilege = ManagerControls precision of movements. If a motor has not completed a move to
the required precision then the move command will be resent. The number of
retries is controlled by the maxretry parameter.sign(persists)Default = Privilege = ManagerControls direction of motion, set to -1 to reverse.softlowerlim(persists)Privilege = UserGet/set lower software limit. This is automatically adjusted when you set
the softzero or use the setpos command.softupperlim(persists)Privilege = UserGet/set upper software limit. This is automatically adjusted when you set
the softzero or use the setpos command.softzero(persists)Default = 0Privilege = UserSets the zero position to val. You probably
want to use setpos described below, it's easier to
understand. speedPrivilege = UserGet/Set the speed of motion along/about the axis controlled by this motor
in physical units per second, ie mm/s, deg/s.motunitsvalPrivilege = UserNot implemented. Does not have an hdb_path. Get/Set the physical unitsPreferred val:list output mot list shows the values of the
parameters listed below, in the order listed below.PositionReports the current positonTargetPositionShows target positionhardlowerlim Hardware lower limit for motor set in SICS configuration filehardupperlim Hardware upper limit for motor set in SICS configuration filesoftlowerlimLower software limit. This is automatically adjusted when you set the
softzero or use the setpos command.softupperlimUpper software limit. This is automatically adjusted when you set the
softzero or use the setpos command.softzeroThe zero position. fixed prevents movement allows movement.NOTE: The instrument manager can set the accesscode to prevent users from
moving a motor.interruptmodeControls what effect a motor failure has on operationsValues: Continue. A motor failure will not affect other
operations AbortOperation. Stop current hardware operation but no
scans or batchfiles AbortScan. Stop current scan or operation but continue
processing of batch files with next command AbortBatch. Stop all processing, even batch
filesprecisionControls precision of movements. If a motor has not completed a move to
the required precision then the move command will be resent. The number of
retries is controlled by the maxretry parameter.accesscodeControls which type of user is allowed to control the motorAllowed values: Internal. Motor is reserved for internal use by
SICS Manager. Only users who logon as managers are allowed
to move the motor. Usually just instrument scientists User Spy. Anyone is allowed to move the motorsignDefault = 1Privilege = ManagerControls direction of motion, set to -1 to reverse.failafterThis is the number of consecutive failures of positioning operations this
motor allows before it thinks that something is really broken and aborts the
experimentmaxretryThe number of times that SICS will retry a move
if a motor has not reached the target position to within the required
precisionignorefaultPosition faults will be ignored if this is greater than zeromovecountDefault=10Controls frequency with which position changes are reported if a user
subscribes interest to a motor. A larger value reduces the frequencyhomehome position for the axis which the motor controls, (ie phi, chi,
two-theta, x, y). So it is the physical home position in the units given by
the units parameter below, (ie mm, degrees,
...)speedThe speed of motion along/about the axis controlled by this motor in
physical units per second, ie mm/s, deg/s.maxSpeed Speed in units/saccelAcceleration along/about the axis controlled by this motor. ConfigurablemaxAccel Maximum allowed acceleration in
units/s2decelDeceleration along/about the axis controlled by this motor. ConfigurablemaxDecel Maximum allowed deceleration in
units/s2motOffDelay Number of msec to wait before switching off a motor after a moveDefault = Debug Settle Blockage_Check_Interval Blockage_Thresh Blockage_Ratio Blockage_Fail Backlash_offset Protocol absEncoder Allowed values: no absolute encoder absolute encoder enabledabsEncHome The calibrated "home" position in encoder countsRequired if absEncoder = 1cntsPerX Number of absolute encoder counts per unit of movement
along/about the axis of motionCreep_Offset Creep_Precision posit_count posit_1 posit_2 posit_3 stepsPerX Number of motor steps per unit of movement along/about
the axis of motion