Motors control¶
This is the basic Python class to control motor devices by using EPICS set of tools to provide the minimal infrastructure for use in managing and operating motor devices by reading and/or setting their record fields - also known as PVs, Process Variables.
You will find below a set of methods which is available at this version of the Motor’s class with their expected input parameters and/or waited results (if any), describing involved data types.
Using the EPICS Motors control module¶
Usage of Python class using basic Motor Record fields.
-
class
py4syn.epics.MotorClass.
Motor
(pvName, mnemonic)[source]¶ Class to control motor devices via EPICS.
Examples
>>> from py4syn.epics.MotorClass import Motor >>> >>> def createMotor(pvName="", mne=""): ... ... new_motor = '' ... ... try: ... new_motor = Motor(pvName, mne) ... print "Motor " + pvName + " created with success!" ... except Exception,e: ... print "Error: ",e ... ... return new_motor
Constructor See
py4syn.epics.StandardDevice
Parameters: - pvName : string
Motor’s base naming of the PV (Process Variable)
- mnemonic : string
Motor’s mnemonic
-
calculateBacklash
(target)[source]¶ Calculates the backlash distance of a given motor
Returns: - `double`
-
canPerformMovement
(target)[source]¶ Check if a movement to a given position is possible using the limit values and backlash distance
Returns: - `boolean`
- .. note::
- True – Motor CAN perform the desired movement;
- False – Motor CANNOT perform the desired movement.
-
canPerformMovementCalc
(target)[source]¶ Check if a movement to a given position is possible using the limit values and backlash distance calculating the values
Returns: - `boolean`
- .. note::
- True – Motor CAN perform the desired movement;
- False – Motor CANNOT perform the desired movement.
-
getAcceleration
()[source]¶ Get the motor acceleration time based on the ACCL (Seconds to Velocity) field from Motor Record
Returns: - `double`
-
getBacklashDistanceValue
()[source]¶ Read the motor backlash distance based on the BDST (Backlash Distance, EGU) field of Motor Record
Returns: - `double`
-
getDescription
()[source]¶ Read the motor descrition based on the DESC field of Motor Record
Returns: - `string`
-
getDialHighLimitValue
()[source]¶ Read the motor dial high limit based on the DHLM (Dial High Limit) field of Motor Record
Returns: - `double`
-
getDialLowLimitValue
()[source]¶ Read the motor dial low limit based on the DLLM (Dial Low Limit) field of Motor Record
Returns: - `double`
-
getDialPosition
()[source]¶ Read the motor target DIAL position based on the DVAL (Dial Desired Value) field of Motor Record
Returns: - `double`
-
getDialRealPosition
()[source]¶ Read the motor DIAL real position based on the DRBV (Dial Readback Value) field of Motor Record
Returns: - `double`
-
getDirection
()[source]¶ Read the motor direction based on the DIR (User Direction) field of Motor Record
Returns: - `integer`
- .. note::
- Positive direction;
- Negative direction.
-
getEGU
()[source]¶ Read the motor engineering unit based on the EGU (Engineering Units) field of Motor Record
Returns: - `string`
-
getFreezeOffset
()[source]¶ Read the motor freeze offset based on the FOF (Freeze Offset) field of Motor Record
Returns: - `integer`
-
getHighLimitValue
()[source]¶ Read the motor high limit based on the HLM (User High Limit) field of Motor Record
Returns: - `double`
-
getLVIO
()[source]¶ Read the motor limit violation LVIO (Limit Violation) field of Motor Record
Returns: - `short`
-
getLowLimitValue
()[source]¶ Read the motor low limit based on the LLM (User Low Limit) field of Motor Record
Returns: - `double`
-
getOffset
()[source]¶ Read the motor offset based on the OFF (User Offset, EGU) field of Motor Record
Returns: - `string`
-
getPosition
()[source]¶ Read the motor target position based on the VAL (User Desired Value) field of Motor Record
Returns: - `double`
-
getRawPosition
()[source]¶ Read the motor RAW position based on the RVAL (Raw Desired Value) field of Motor Record
Returns: - `double`
-
getRawRealPosition
()[source]¶ Read the motor RAW real position based on the RRBV (Raw Readback Value) field of Motor Record
Returns: - `double`
-
getRealPosition
()[source]¶ Read the motor real position based on the RBV (User Readback Value) field of Motor Record
Returns: - `double`
-
getSETMode
()[source]¶ Checks if the motor is in SET mode
Note
Motor will NOT move until it is in in USE mode
-
getValue
()[source]¶ Get the current position of the motor. See
py4syn.epics.IScannable
Returns: - `double`
Read the current value (Motor Real Position)
-
getVariableOffset
()[source]¶ Read the motor variable offset based on the VOF (Variable Offset) field of Motor Record
Returns: - `integer`
-
getVelocity
()[source]¶ Get the motor velocity based on the VELO (Velocity, EGU/s) field from Motor Record
Returns: - `double`
-
isAtHighLimitSwitch
()[source]¶ Check if a motor high limit switch is activated, based on the HLS (At High Limit Switch) field of Motor Record
Returns: - `boolean`
- .. note::
- True – Motor is at High Limit;
- False – Motor is NOT at High Limit.
-
isAtLowLimitSwitch
()[source]¶ Check if a motor low limit switch is activated, based on the LLS (At Low Limit Switch) field of Motor Record
Returns: - `boolean`
- .. note::
- True – Motor is at Low Limit;
- False – Motor is NOT at Low Limit.
-
isMoving
()[source]¶ Check if a motor is moving or not based on the callback
Returns: - `boolean`
- .. note::
- True – Motor is moving;
- False – Motor is stopped.
-
isMovingPV
()[source]¶ Check if a motor is moving or not from the PV
Returns: - `boolean`
- .. note::
- True – Motor is moving;
- False – Motor is stopped.
-
setAbsolutePosition
(pos, waitComplete=False)[source]¶ Move the motor to an absolute position received by an input parameter
Parameters: - pos : double
The desired position to set
- waitComplete : boolean (default is False)
Note
If True, the function will wait until the movement finish to return, otherwise don’t.
-
setAcceleration
(accl)[source]¶ Set the motor acceleration time based on the ACCL (Seconds to Velocity) field from Motor Record
Parameters: - accl : double
The desired acceleration to set
-
setDialHighLimitValue
(val)[source]¶ Set the motor dial high limit based on the DHLM (Dial High Limit) field of Motor Record
Parameters: - val : double
The desired value to set
-
setDialLowLimitValue
(val)[source]¶ Set the motor dial low limit based on the DLLM (Dial Low Limit) field of Motor Record
Parameters: - val : double
The desired value to set
-
setDialPosition
(pos, waitComplete=False)[source]¶ Set the motor target DIAL position based on the DVAL (Dial Desired Value) field of Motor Record
Parameters: - pos : double
The desired position to set
- waitComplete : boolean (default is False)
Note
If True, the function will wait until the movement finish to return, otherwise don’t.
-
setEGU
(unit)[source]¶ Set the motor engineering unit to the EGU (Engineering Units) field of Motor Record
Parameters: - unit : string
The desired engineering unit.
Note
Example: “mm.”, “deg.”
-
setFreezeOffset
(val)[source]¶ Set the motor freeze offset based on the FOF (Freeze Offset) field of Motor Record
Parameters: - val : integer
The desired value to set
-
setHighLimitValue
(val)[source]¶ Set the motor high limit based on the HLM (User High Limit) field of Motor Record
Parameters: - val : double
The desired value to set
-
setLowLimitValue
(val)[source]¶ Set the motor low limit based on the LLM (User Low Limit) field of Motor Record
Parameters: - val : double
The desired value to set
-
setOffset
(val)[source]¶ Set the motor offset based on the OFF (User Offset, EGU) field of Motor Record
Parameters: - val : double
The desired value to set
-
setRawPosition
(position)[source]¶ Sets the motor RAW position based on the RVAL (Raw Desired Value) field of Motor Record
Returns: - `double`
-
setRelativePosition
(pos, waitComplete=False)[source]¶ Move the motor a distance, received by an input parameter, to a position relative to that current one
Parameters: - pos : double
The desired distance to move based on current position
- waitComplete : boolean (default is False)
-
setUpdateRequest
(val)[source]¶ Set the motor update request flag based on the STUP (Status Update Request) field from Motor Record
Parameters: - val : integer
The desired value to set for the flag
-
setValue
(v)[source]¶ Set the desired motor position. See
py4syn.epics.IScannable
Parameters: - v : double
The desired value (Absolute Position) to set
-
setVariableOffset
(val)[source]¶ Set the motor variable offset based on the VOF (Variable Offset) field of Motor Record
Parameters: - val : integer
The desired value to set
-
setVelocity
(velo)[source]¶ Set the motor velocity up based on the VELO (Velocity, EGU/s) field from Motor Record
Parameters: - velo : double
The desired velocity to set