Class ScannableMotionWithScannableFieldsBase
- All Implemented Interfaces:
INeXusInfoWriteable,Device,Scannable,ContinuouslyScannableViaController,ScannableMotion,Configurable,Findable,gda.observable.IObservable
- Direct Known Subclasses:
DummyConstantVelocityRasterScannable,DummyScannableFieldScannableMotion,HklScannable,PIE725ConstantVelocityRasterScannable
ScannableMotionBase.completeInstantiation() method which adds a dictionary of
ScannableFields to an instance. Each ScannableField allows one of the instances fields to be interacted with like it
itself is a scannable. Fields are accessible from Jython as attributes, or using the
getFieldScannable(String).
When moving a ScannableField (via either a pos or scan command), the ScnnableField calls the parent to perform the actual task. The ScannableField's asynchronousMoveto command will call the parent with a list of None values except for the field it represents which will be passed the desired position value.
The asynchronousMoveTo method in class that inherits from this base class then must handle these Nones. In some cases the method may actually be able to move the underlying system associated with one field individually from others. However by default it substitute's the None values with the actual current position of parent's scannables associated fields.
TODO: THIS IS NOT YET IMPLEMENTED ScannableMotionBaseWithMemory() extends this class and provides a solution useful for some scenarios: it keeps track of the last position moved to, and replaces the Nones in an asynchronousMoveTo request with these values. There are a number of dangers associated with this which are addressed in that class's documentation, but it provides a way to move one axis within a group of non-orthogonal axis while keeping the others still.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class gda.device.scannable.ScannableMotionBase
numberTries, toleranceFields inherited from class gda.device.scannable.ScannableBase
__doc__, DEFAULT_INPUT_NAME, DEFAULT_OUTPUT_FORMAT, extraNames, inputNames, level, outputFormatFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLEFields inherited from interface gda.device.ScannableMotion
FIRSTINPUTLIMITS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription__getattr__(String name) Returns the ScannableField with the given name.voidaddChildToMove(gda.device.scannable.scannablegroup.ICoordinatedChildScannable element) voidasynchronousMoveFieldTo(int index, Object position) Calls asynchronousMovoTo on the DottedAccessScannable.voidasynchronousMoveTo(Object externalPosition) Trigger a move/operation and return immediately.voidHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred.voidCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).voidCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)protected Object[]completePartialMoveTarget(Object[] externalTarget) protected voidPopulates scannableFields and scannableFieldByName.getFieldPosition(int index) Override this if there is a more efficient way for your Scannable to get the value of a field than than by calling getPosition and picking out the ith object.getFieldScannable(String name) Returns the ScannableField with the given name.Object[]Returns the position sampled at the start of the scan, or null if operating in a scan.getPositionWhileMovingContinuousely(gda.device.scannable.scannablegroup.ICoordinatedScannableGroupChildScannable childScannable) booleanbooleanisBusy()Check if the Scannable is moving/operating.booleanIndicates whether the Scannable has deferred control to the he configuredContinuousMoveControllerbooleanbooleanvoidsetAutoCompletePartialMoveToTargets(boolean autoCompletePartialMoveToTargets) voidsetChildTarget(gda.device.scannable.scannablegroup.ICoordinatedChildScannable element, Object position) voidsetContinuousMoveController(ContinuousMoveController controller) voidsetExtraNames(String[] names) Sets extra names and creates scannable for each field;voidsetInputNames(String[] names) Sets input names and creates scannable for each field;voidsetMembers(List<gda.device.scannable.scannablegroup.ICoordinatedChildScannable> members) voidsetOperatingContinuously(boolean b) Enable or disable control through the configuredContinuousMoveControllervoidsetPositionAtScanStart(Object[] positionAtScanStart) voidsetUsePositionAtScanStartWhenCompletingPartialMoves(boolean usePositionAtScanStartWhenCompletingPartialMoves) voidstop()Stop the current move/operation.voidReturns when operation carried out by moveTo has completedMethods inherited from class gda.device.scannable.ScannableMotionBase
a, addPositionValidator, ar, checkPositionValid, checkPositionWithinGdaLimits, checkPositionWithinGdaLimits, completeInstantiation, externalToInternal, generateScannableLimitsReport, getAdditionalPositionValidators, getAttribute, getFirstInputLimits, getInputLimits, getInputLimits, getLimitsComponent, getLowerGdaLimits, getNumberTries, getOffset, getScalingFactor, getTolerances, getUpperGdaLimits, internalToExternal, isAt, moveTo, r, rawIsBusy, removePositionValidator, setAdditionalPositionValidators, setLimitsComponent, setLowerGdaLimits, setLowerGdaLimits, setNumberTries, setOffset, setOffsetAndScalingComponent, setScalingFactor, setTolerance, setTolerances, setUpperGdaLimits, setUpperGdaLimits, toFormattedString, writeNeXusInformation, writeNeXusInformationLimitsMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanLineEnd, atScanLineStart, getExtraNames, getInputNames, getLevel, getOutputFormat, getPosition, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, rawAsynchronousMoveTo, rawGetPosition, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, throwExceptionIfInvalidTarget, toString, validateScannable, valueUnavailableString, waitWhileBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
configure, isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.factory.Configurable
configure, isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObserversMethods inherited from interface gda.device.Scannable
atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanLineEnd, atScanLineStart, checkPositionValid, getExtraNames, getInputNames, getLevel, getOutputFormat, getPosition, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, toFormattedString
-
Constructor Details
-
ScannableMotionWithScannableFieldsBase
public ScannableMotionWithScannableFieldsBase()
-
-
Method Details
-
setPositionAtScanStart
-
isUsePositionAtScanStartWhenCompletingPartialMoves
public boolean isUsePositionAtScanStartWhenCompletingPartialMoves() -
setUsePositionAtScanStartWhenCompletingPartialMoves
public void setUsePositionAtScanStartWhenCompletingPartialMoves(boolean usePositionAtScanStartWhenCompletingPartialMoves) -
isAutoCompletePartialMoveToTargets
public boolean isAutoCompletePartialMoveToTargets() -
setAutoCompletePartialMoveToTargets
public void setAutoCompletePartialMoveToTargets(boolean autoCompletePartialMoveToTargets) -
setInputNames
Sets input names and creates scannable for each field;- Specified by:
setInputNamesin interfaceScannable- Overrides:
setInputNamesin classScannableBase- Parameters:
names-
-
setExtraNames
Sets extra names and creates scannable for each field;- Specified by:
setExtraNamesin interfaceScannable- Overrides:
setExtraNamesin classScannableBase- Parameters:
names-
-
atScanStart
Description copied from class:ScannableBaseCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanStartin interfaceScannable- Overrides:
atScanStartin classScannableBase- Throws:
DeviceException- See Also:
-
atCommandFailure
Description copied from class:ScannableBaseHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred. However not called when the command is aborted using an InterruptionException. If a Scan is aborted then onlyScannable.stop()will be called by the Scan or pos command.Useful for telling Scannables which hold state during a scan for example, to reset themselves. Used for example by CoordinatedMotionScannables. This hook should be used not in the same way as the stop hook. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
- Specified by:
atCommandFailurein interfaceScannable- Overrides:
atCommandFailurein classScannableBase- Throws:
DeviceException- See Also:
-
atScanEnd
Description copied from class:ScannableBaseCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).Note that this is only called if the Scan finishes normally, or has been requested to finish early. This will not be called if the scan finishes due to an exception of any kind. See
Scannable.atCommandFailure()Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanEndin interfaceScannable- Overrides:
atScanEndin classScannableBase- Throws:
DeviceException- See Also:
-
getPositionAtScanStart
Returns the position sampled at the start of the scan, or null if operating in a scan.- Returns:
- position if in scan or null
-
asynchronousMoveFieldTo
Calls asynchronousMovoTo on the DottedAccessScannable. Fills all fields but index with nulls. May be overridden to improve performance.- Parameters:
index-position-- Throws:
DeviceException
-
asynchronousMoveTo
Description copied from class:ScannableBaseTrigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed. Converts the external (user) position to an internal position and passes this to rawAsynchronousMoveTo.- Specified by:
asynchronousMoveToin interfaceScannable- Overrides:
asynchronousMoveToin classScannableMotionBase- Parameters:
externalPosition- Position to move to should have an element for each input field.- Throws:
DeviceException
-
completePartialMoveTarget
- Throws:
DeviceException
-
createScannableForEachField
protected void createScannableForEachField()Populates scannableFields and scannableFieldByName. -
__getattr__
Returns the ScannableField with the given name. As ScannableMotionBase does not extend PyObject, it is an 'old style' class and the more appropriate __getattribute__ method won't get called. The problem with __getattr__ is that defined methods (such as Scannable.a()) will block it. Then again, maybe this is not a problem!- Parameters:
name-
-
getFieldScannable
Returns the ScannableField with the given name.- Parameters:
name-- Returns:
- the Scannablefield, or null if it could not be found.
-
getFieldPosition
Override this if there is a more efficient way for your Scannable to get the value of a field than than by calling getPosition and picking out the ith object.- Parameters:
index-- Returns:
- position of ith field
- Throws:
DeviceException
-
addChildToMove
public void addChildToMove(gda.device.scannable.scannablegroup.ICoordinatedChildScannable element) -
isTargeting
public boolean isTargeting() -
setChildTarget
public void setChildTarget(gda.device.scannable.scannablegroup.ICoordinatedChildScannable element, Object position) throws DeviceException - Throws:
DeviceException
-
setMembers
public void setMembers(List<gda.device.scannable.scannablegroup.ICoordinatedChildScannable> members) -
setOperatingContinuously
public void setOperatingContinuously(boolean b) Description copied from interface:ContinuouslyScannableViaControllerEnable or disable control through the configuredContinuousMoveController- Specified by:
setOperatingContinuouslyin interfaceContinuouslyScannableViaController- Parameters:
b-
-
isOperatingContinously
public boolean isOperatingContinously()Description copied from interface:ContinuouslyScannableViaControllerIndicates whether the Scannable has deferred control to the he configuredContinuousMoveController- Specified by:
isOperatingContinouslyin interfaceContinuouslyScannableViaController- Returns:
- true if control is defered
-
getContinuousMoveController
- Specified by:
getContinuousMoveControllerin interfaceContinuouslyScannableViaController
-
setContinuousMoveController
- Specified by:
setContinuousMoveControllerin interfaceContinuouslyScannableViaController
-
isBusy
Description copied from class:ScannableMotionBaseCheck if the Scannable is moving/operating.. Calls onto rawIsBusy for historical reasons, although there is currently no need for this.- Specified by:
isBusyin interfaceScannable- Overrides:
isBusyin classScannableMotionBase- Returns:
- true - if operation carried out by moveTo has not completed yet
- Throws:
DeviceException- See Also:
-
waitWhileBusy
Description copied from class:ScannableBaseReturns when operation carried out by moveTo has completed If this is to be overriden, isBusy must also be valid. Although the pos and scan command currently use this method to determine if the Scannable is busy, this must not be relied upon.- Specified by:
waitWhileBusyin interfaceScannable- Overrides:
waitWhileBusyin classScannableBase- Throws:
DeviceExceptionInterruptedException
-
stop
Description copied from class:ScannableBaseStop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
stopin interfaceScannable- Overrides:
stopin classScannableBase- Throws:
DeviceException- See Also:
-
getPositionWhileMovingContinuousely
public Object getPositionWhileMovingContinuousely(gda.device.scannable.scannablegroup.ICoordinatedScannableGroupChildScannable childScannable) throws DeviceException - Throws:
DeviceException
-