Package gda.device.motor
Class EpicsMotor
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.motor.MotorBase
gda.device.motor.EpicsMotor
- All Implemented Interfaces:
ControllerRecord,Device,Motor,InitializationListener,Configurable,Findable,gda.observable.IObservable,gda.observable.IObserver,Serializable
- Direct Known Subclasses:
EpicsMotorDirect,EpicsReadyMotor,FeedbackControlledEpicsMotor,PiezoEpicsMotor
public class EpicsMotor
extends MotorBase
implements InitializationListener, gda.observable.IObserver, ControllerRecord
EpicsMotor implements GDA Motor interface and provide mapping from GDA interface to EPICS motor record. Note only
selected PVs or channels are instantiated in this class as required by the GDA motor interface.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPossible actions to take when a motor does not reach its target during a move -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected gov.aps.jca.Channelprotected EpicsChannelManagerEPICS Channel Managerprotected EpicsControllerEPICS controllerprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerMonitor EPICS motor dial higher limitprotected gov.aps.jca.event.MonitorListenerMonitor EPICS motor dial lower limitprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerMonitor EPICS motor higher limitprotected gov.aps.jca.event.MonitorListenerprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerMonitor EPICS motor lower limitprotected gov.aps.jca.event.MonitorListenerMonitors for the limit switch states .LLS and .HLSprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerMonitor EPICS motor limit violationprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenermonitor EPICS motor positionprotected gov.aps.jca.Channelprotected gov.aps.jca.event.PutListenerEPICS Put call back handlerprotected Stringprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerprotected gov.aps.jca.Channelprotected gov.aps.jca.event.MonitorListenerMonitor EPICS motor's DMOV - EPICS motor motion completion statusprotected gov.aps.jca.Channelprotected gov.aps.jca.Channelprotected gov.aps.jca.ChannelEPICS channels to connectprotected gov.aps.jca.Channelprotected gov.aps.jca.ChannelFields inherited from class gda.device.motor.MotorBase
correctBacklash, isInitialised, maxPosition, minPositionFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Motor
FAST, MEDIUM, SLOW, SPEED_LEVELS -
Constructor Summary
ConstructorsConstructorDescriptionEpicsMotor(EpicsController controller, Function<InitializationListener, EpicsChannelManager> channelManagerFactory) Constructor that takes an instance ofEpicsControllerand a factory for aEpicsChannelManagerto use.EpicsMotor(String name) Constructor taking a motor name -
Method Summary
Modifier and TypeMethodDescriptionprotected MotorStatuschecks motor StatusvoidInitialise the motor object.protected voidCreate Channel access for motor.voidgets EPICS access control name.Gets the name of the controller record, e.g.protected doubleReads the motor's dial high limit (DHLM).protected doubleReads the motor's dial low limit (DLLM).doubleGets the maximum or upper soft limits of the motor itself (i.e.doubledoubleGets the minimum or lower soft limits of the motor itself (i.e.doubleGets the motor resolution from EPICS motor.doubleThis method returns the current position of the motor in user coordinates.intdoubleGets the retry dead band for this motor from EPICS.doublegetSpeed()Gets the current speed of the motor in mm/secondReturns the motor status from the motor object.doubledoubleReturns this motor's time to velocity.gets the unit string from EPICS motor.doublevoidhome()Moves the motor to a repeatable starting location.voidCalled when all critical channels are connected.booleanbooleanbooleanisHomed()Checks if the motor is homed or not.booleanisHomedFromMSTAValue(double msta) booleanisMoving()Returns whether or not motor is actually movingbooleanvoidmoveBy(double increament) Relative move, moves the motor by the specified mount in user coordinate system units, specified in the .EGU field of the Motor record.voidmoveContinuously(int direction) Moves the motor in a continuous modevoidmoveTo(double position) Absolute move, moves the motor to the specified position in user coordinate system units, specified by .EGU field of the Motor Record.voidmoveTo(double position, double timeout) moves motor to the specified position with timeout in seconds.voidmoveTo(double position, gov.aps.jca.event.PutListener moveListener) Asynchronously moves the motor to the specified position in EGU with a specified PutListener.voidSome motors offer a control for emergence stop which stop the motor and switch off the power.doublereadMsta()voidRe-initialisation of values and states.voidsetAccessControl(AccessControl accessControl) Sets the access control object used by this motor.voidsetAccessControlName(String accessControlName) sets the EPICS access control name.voidsetAssertHomedBeforeMoving(boolean assertHomedBeforeMoving) voidsetCallbackWait(boolean callbackDelay) voidsetMaxPosition(double maximumPosition) Sets the maximum position.voidsetMinPosition(double minimumPosition) Sets the minimum position.voidvoidDeprecated.voidsetPosition(double position) Set the position of the motor without moving itvoidSets the record name that this motor will link to.voidsetReduceExcessiveReadyLogs(boolean reduceExcessiveReadyLogs) voidsetSpeed(double mmPerSec) Sets the speed of the motor in IOC in mm/second.voidsetTimeToVelocity(double timeToVelocity) Sets this motor's time to velocity.voidsetUnitStringOverride(String unitStringOverride) voidsetUserOffset(double userOffset) voidstop()Stops the motorvoidstopGo()Tells the motor record to stop trying to move the motor and then resets it.toString()voidBlocks while the motors status is BusyMethods inherited from class gda.device.motor.MotorBase
addInBacklash, correctBacklash, getBacklashSteps, getFastSpeed, getMediumSpeed, getSlowSpeed, isHomeable, isInitialised, isLimitsSettable, setBacklashSteps, setFastSpeed, setInitialised, setLimitsSettable, setMediumSpeed, setMotorResolution, setSlowSpeed, setSoftLimits, setSpeedLevelMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
isConfigured, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfiguredMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObservers
-
Field Details
-
val
protected gov.aps.jca.Channel valEPICS channels to connect -
rbv
protected gov.aps.jca.Channel rbv -
direction
protected gov.aps.jca.Channel direction -
offset
protected gov.aps.jca.Channel offset -
stop
protected gov.aps.jca.Channel stop -
velo
protected gov.aps.jca.Channel velo -
vmax
protected gov.aps.jca.Channel vmax -
accl
protected gov.aps.jca.Channel accl -
lvio
protected gov.aps.jca.Channel lvio -
dmov
protected gov.aps.jca.Channel dmov -
rdbd
protected gov.aps.jca.Channel rdbd -
hlm
protected gov.aps.jca.Channel hlm -
llm
protected gov.aps.jca.Channel llm -
hls
protected gov.aps.jca.Channel hls -
lls
protected gov.aps.jca.Channel lls -
dhlm
protected gov.aps.jca.Channel dhlm -
dllm
protected gov.aps.jca.Channel dllm -
homf
protected gov.aps.jca.Channel homf -
mres
protected gov.aps.jca.Channel mres -
unitString
protected gov.aps.jca.Channel unitString -
msta
protected gov.aps.jca.Channel msta -
spmg
protected gov.aps.jca.Channel spmg -
prec
protected gov.aps.jca.Channel prec -
positionMonitor
protected gov.aps.jca.event.MonitorListener positionMonitormonitor EPICS motor position -
statusMonitor
protected gov.aps.jca.event.MonitorListener statusMonitorMonitor EPICS motor's DMOV - EPICS motor motion completion status -
lowLimitMonitor
protected gov.aps.jca.event.MonitorListener lowLimitMonitorMonitor EPICS motor lower limit -
highLimitMonitor
protected gov.aps.jca.event.MonitorListener highLimitMonitorMonitor EPICS motor higher limit -
dialHighLimitMonitor
protected gov.aps.jca.event.MonitorListener dialHighLimitMonitorMonitor EPICS motor dial higher limit -
dialLowLimitMonitor
protected gov.aps.jca.event.MonitorListener dialLowLimitMonitorMonitor EPICS motor dial lower limit -
mstaMonitorListener
protected gov.aps.jca.event.MonitorListener mstaMonitorListener -
lvioMonitor
protected gov.aps.jca.event.MonitorListener lvioMonitorMonitor EPICS motor limit violation -
lowLimitStateMonitor
protected gov.aps.jca.event.MonitorListener lowLimitStateMonitorMonitors for the limit switch states .LLS and .HLS -
highLimitStateMonitor
protected gov.aps.jca.event.MonitorListener highLimitStateMonitor -
setPv
protected gov.aps.jca.Channel setPv -
setUseListener
protected gov.aps.jca.event.MonitorListener setUseListener -
putCallbackListener
protected gov.aps.jca.event.PutListener putCallbackListenerEPICS Put call back handler -
pvName
-
controller
EPICS controller -
channelManager
EPICS Channel Manager
-
-
Constructor Details
-
EpicsMotor
public EpicsMotor(EpicsController controller, Function<InitializationListener, EpicsChannelManager> channelManagerFactory) Constructor that takes an instance ofEpicsControllerand a factory for aEpicsChannelManagerto use. Used for testing.- Parameters:
controller- TheEpicsControllerto use.channelManagerFactory- A factory to create aEpicsChannelManager.
-
EpicsMotor
public EpicsMotor() -
EpicsMotor
Constructor taking a motor name- Parameters:
name- name of the motor
-
-
Method Details
-
setUnitStringOverride
-
setPvName
Sets the record name that this motor will link to.- Parameters:
pvName- the record name
-
getPvName
-
setAccessControl
Sets the access control object used by this motor.- Parameters:
accessControl- the access control object
-
configure
Initialise the motor object.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
forceCallback
- Throws:
MotorException
-
createChannelAccess
Create Channel access for motor. This must must on to EPICS motor record.- Throws:
FactoryException
-
getUnitString
gets the unit string from EPICS motor.- Specified by:
getUnitStringin interfaceMotor- Overrides:
getUnitStringin classMotorBase- Returns:
- unit string
- Throws:
MotorException
-
setSpeed
Sets the speed of the motor in IOC in mm/second.- Specified by:
setSpeedin interfaceMotor- Parameters:
mmPerSec- the speed- Throws:
MotorException
-
getSpeed
Gets the current speed of the motor in mm/second- Specified by:
getSpeedin interfaceMotor- Returns:
- double the motor speed in revolution per second
- Throws:
MotorException
-
getMaxSpeed
- Throws:
MotorException
-
setTimeToVelocity
Description copied from interface:MotorSets this motor's time to velocity.- Specified by:
setTimeToVelocityin interfaceMotor- Overrides:
setTimeToVelocityin classMotorBase- Throws:
MotorException
-
getTimeToVelocity
Description copied from interface:MotorReturns this motor's time to velocity.- Specified by:
getTimeToVelocityin interfaceMotor- Overrides:
getTimeToVelocityin classMotorBase- Throws:
MotorException
-
getRetryDeadband
Gets the retry dead band for this motor from EPICS.- Specified by:
getRetryDeadbandin interfaceMotor- Overrides:
getRetryDeadbandin classMotorBase- Returns:
- double - the retry dead band.
- Throws:
MotorException
-
getMotorResolution
Gets the motor resolution from EPICS motor.- Specified by:
getMotorResolutionin interfaceMotor- Overrides:
getMotorResolutionin classMotorBase- Returns:
- double - the motor resolution
- Throws:
MotorException
-
getDirection
- Throws:
MotorException
-
getUserOffset
- Specified by:
getUserOffsetin interfaceMotor- Overrides:
getUserOffsetin classMotorBase- Returns:
- the user offset set on the motor
- Throws:
MotorException
-
setUserOffset
- Throws:
MotorException
-
getPrecision
- Throws:
MotorException
-
isMoving
Description copied from interface:MotorReturns whether or not motor is actually moving- Specified by:
isMovingin interfaceMotor- Returns:
- true if moving
- Throws:
MotorException
-
checkStatus
checks motor Status- Throws:
MotorException
-
getStatus
Returns the motor status from the motor object.- Specified by:
getStatusin interfaceMotor- Returns:
- a value from the MotorStatus enum
- Throws:
MotorException
-
moveBy
Relative move, moves the motor by the specified mount in user coordinate system units, specified in the .EGU field of the Motor record.- Specified by:
moveByin interfaceMotor- Parameters:
increament- - double the distance that motor need to travel in EGU- Throws:
MotorException
-
moveTo
Absolute move, moves the motor to the specified position in user coordinate system units, specified by .EGU field of the Motor Record.- Specified by:
moveToin interfaceMotor- Parameters:
position- - double - the absolute position of the motor in EGU (- Throws:
MotorException
-
moveTo
public void moveTo(double position, double timeout) throws MotorException, gov.aps.jca.TimeoutException, InterruptedException moves motor to the specified position with timeout in seconds. If motor does not callback within the specified time, this method time-out.- Throws:
MotorExceptiongov.aps.jca.TimeoutExceptionInterruptedException
-
moveTo
public void moveTo(double position, gov.aps.jca.event.PutListener moveListener) throws MotorException Asynchronously moves the motor to the specified position in EGU with a specified PutListener. You must handle the callback in your PutListener code.- Parameters:
position- the absolute position of the motor in EGU- Throws:
MotorException
-
getDialLowLimit
Reads the motor's dial low limit (DLLM).- Returns:
- the dial low limit
- Throws:
MotorException
-
getDialHighLimit
Reads the motor's dial high limit (DHLM).- Returns:
- the dial high limit
- Throws:
MotorException
-
setMinPosition
Sets the minimum position. This does write to EPICS database.- Specified by:
setMinPositionin interfaceMotor- Overrides:
setMinPositionin classMotorBase- Parameters:
minimumPosition- the minimum position- Throws:
MotorException
-
getMinPosition
Gets the minimum or lower soft limits of the motor itself (i.e. NOT limits cached in GDA software). By convention return NaN if not set. Get the minimum position from EPICS database.- Specified by:
getMinPositionin interfaceMotor- Overrides:
getMinPositionin classMotorBase- Returns:
- the minimum position, or NaN if limits are not be checked
- Throws:
MotorException
-
setMaxPosition
Sets the maximum position. This does write to EPICS database.- Specified by:
setMaxPositionin interfaceMotor- Overrides:
setMaxPositionin classMotorBase- Parameters:
maximumPosition- the maximum position- Throws:
MotorException
-
getMaxPosition
Gets the maximum or upper soft limits of the motor itself (i.e. NOT limits cached in GDA software). By convention return NaN if not set. Get the maximum position from EPICS database.- Specified by:
getMaxPositionin interfaceMotor- Overrides:
getMaxPositionin classMotorBase- Returns:
- the maximum position, or NaN if limits are not be checked
- Throws:
MotorException
-
stop
Stops the motor- Specified by:
stopin interfaceMotor- Throws:
MotorException
-
stopGo
Tells the motor record to stop trying to move the motor and then resets it.This is different to a normal stop and should be used when the motor is 'stuck' in a moving state. This is the same as using the Combo box control in the edm screens.
This is for EpicsMotor specific error handling and would probably only need to be used when there are underlying hardware issues.
- Throws:
MotorException
-
panicStop
Some motors offer a control for emergence stop which stop the motor and switch off the power. This is not implemented here for EPICS motor, i.e. code block is empty.- Specified by:
panicStopin interfaceMotor- Throws:
MotorException
-
moveContinuously
Description copied from interface:MotorMoves the motor in a continuous mode- Specified by:
moveContinuouslyin interfaceMotor- Parameters:
direction- direction to move in- Throws:
MotorException
-
setPosition
Set the position of the motor without moving it- Specified by:
setPositionin interfaceMotor- Parameters:
position- the new offset in motor units- Throws:
MotorException
-
getPosition
This method returns the current position of the motor in user coordinates.- Specified by:
getPositionin interfaceMotor- Returns:
- the current position
- Throws:
MotorException
-
home
Description copied from class:MotorBaseMoves the motor to a repeatable starting location. Motor implementations should overide this method if required.- Specified by:
homein interfaceMotor- Overrides:
homein classMotorBase- Throws:
MotorException
-
initializationCompleted
public void initializationCompleted()Description copied from interface:InitializationListenerCalled when all critical channels are connected.- Specified by:
initializationCompletedin interfaceInitializationListener
-
isHomedFromMSTAValue
public boolean isHomedFromMSTAValue(double msta) -
isHomed
public boolean isHomed()Description copied from class:MotorBaseChecks if the motor is homed or not. Motor implementations should overide this method if required. -
readMsta
public double readMsta() throws gov.aps.jca.TimeoutException, gov.aps.jca.CAException, InterruptedException- Throws:
gov.aps.jca.TimeoutExceptiongov.aps.jca.CAExceptionInterruptedException
-
getTargetPosition
- Throws:
MotorException
-
getAccessControlName
gets EPICS access control name.- Returns:
- name of the access control.
-
setAccessControlName
sets the EPICS access control name. -
update
- Specified by:
updatein interfacegda.observable.IObserver
-
toString
-
isCallbackWait
public boolean isCallbackWait() -
setCallbackWait
public void setCallbackWait(boolean callbackDelay) -
setAssertHomedBeforeMoving
public void setAssertHomedBeforeMoving(boolean assertHomedBeforeMoving) -
isAssertHomedBeforeMoving
public boolean isAssertHomedBeforeMoving() -
waitWhileStatusBusy
Description copied from interface:MotorBlocks while the motors status is Busy- Specified by:
waitWhileStatusBusyin interfaceMotor- Overrides:
waitWhileStatusBusyin classMotorBase- Returns:
- status after being busy
- Throws:
InterruptedException
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Overrides:
reconfigurein classConfigurableBase- Throws:
FactoryException
-
setMissedTargetLevel
@Deprecated(since="9.31", forRemoval=false) public void setMissedTargetLevel(EpicsMotor.MissedTargetLevel level) Deprecated.Please usesetMissedTargetAction(MissedTargetLevel)instead- Parameters:
level-
-
setMissedTargetAction
-
getControllerRecordName
Description copied from interface:ControllerRecordGets the name of the controller record, e.g. EPICS process variable name. For example, in NeXus this value can be written as the value of thecontroller_recordfield for theNXpositionerfor the scannable.- Specified by:
getControllerRecordNamein interfaceControllerRecord- Returns:
- controller record name
- See Also:
-
isReduceExcessiveReadyLogs
public boolean isReduceExcessiveReadyLogs() -
setReduceExcessiveReadyLogs
public void setReduceExcessiveReadyLogs(boolean reduceExcessiveReadyLogs)
-
setMissedTargetAction(MissedTargetLevel)instead