Package gda.device.motor
Class MotorBase
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.motor.MotorBase
- All Implemented Interfaces:
Device,Motor,Configurable,Findable,gda.observable.IObservable,Serializable
- Direct Known Subclasses:
DummyMotor,EpicsMotor,MotorIocDecorator,ThreadlessDummyMotor
A base implementation of a generic Motor for all real motor types, which are therefore subclasses of this class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected doubleprotected doubleFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Motor
FAST, MEDIUM, SLOW, SPEED_LEVELS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleaddInBacklash(double increment) The calculation used to determine the size of the first part of a backlash move and to set whether backlash is required.voidIf backlash is required, this method instigates the final backlash move.doubledoubledoubleGets 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.doubledoublereturn the position tolerance or accuracydoubledoubleReturns this motor's time to velocity.doublevoidhome()Moves the motor to a repeatable starting location.booleanChecks if the motor is homeable or not.booleanisHomed()Checks if the motor is homed or not.booleanGets initialisition state of the motor with respect to its connection to low level device service e.g.booleanChecks whether this motor is allowed to change its hardware soft limits.voidsetBacklashSteps(double backlashSteps) Changes the current backlash correction to the specified hardware units.voidsetFastSpeed(double fastSpeed) Changes the maximum velocity fast speed setting.voidsetInitialised(boolean initialised) voidsetLimitsSettable(boolean limitsSettable) Sets whether this motor should change the hardware's soft limits.voidsetMaxPosition(double maxPosition) Set the upper soft limit of the motorvoidsetMediumSpeed(double mediumSpeed) Changes the maximum velocity medium speed setting.voidsetMinPosition(double minPosition) Set the lower soft limit of the motorvoidsetMotorResolution(double motorResolution) voidsetSlowSpeed(double slowSpeed) Changes the maximum velocity slow speed setting.voidsetSoftLimits(double minPosition, double maxPosition) Sets the software limits.voidsetSpeedLevel(int speed) Sets the speed level of the motorvoidsetTimeToVelocity(double timeToVelocity) Sets this motor's time to velocity.Blocks while the motors status is BusyMethods 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
configure, isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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.Motor
getPosition, getSpeed, getStatus, isMoving, moveBy, moveContinuously, moveTo, panicStop, setPosition, setSpeed, stop
-
Field Details
-
correctBacklash
protected boolean correctBacklash -
minPosition
protected double minPosition -
maxPosition
protected double maxPosition -
isInitialised
protected volatile boolean isInitialised
-
-
Constructor Details
-
MotorBase
public MotorBase()
-
-
Method Details
-
setFastSpeed
public void setFastSpeed(double fastSpeed) Changes the maximum velocity fast speed setting.- Parameters:
fastSpeed- velocity in motor hardware units
-
getFastSpeed
public double getFastSpeed()- Returns:
- fast speed velocity in motor hardware units
-
setMediumSpeed
public void setMediumSpeed(double mediumSpeed) Changes the maximum velocity medium speed setting.- Parameters:
mediumSpeed- velocity in motor hardware units
-
getMediumSpeed
public double getMediumSpeed()- Returns:
- medium speed velocity in motor hardware units
-
setSlowSpeed
public void setSlowSpeed(double slowSpeed) Changes the maximum velocity slow speed setting.- Parameters:
slowSpeed- velocity in motor hardware units
-
getSlowSpeed
public double getSlowSpeed()- Returns:
- slow speed velocity in motor hardware units
-
setBacklashSteps
public void setBacklashSteps(double backlashSteps) Changes the current backlash correction to the specified hardware units.- Parameters:
backlashSteps- backlash correction drive in motor hardware units
-
getBacklashSteps
public double getBacklashSteps()- Returns:
- current backlash correction in hardware units
-
isLimitsSettable
public boolean isLimitsSettable()Checks whether this motor is allowed to change its hardware soft limits. Motor implementations should overide this method if required.- Specified by:
isLimitsSettablein interfaceMotor- Returns:
- a default of false here, but would return true where limits are settable.
-
setLimitsSettable
public void setLimitsSettable(boolean limitsSettable) Sets whether this motor should change the hardware's soft limits.- Parameters:
limitsSettable- flag true if limits are settable
-
getTimeToVelocity
Description copied from interface:MotorReturns this motor's time to velocity.- Specified by:
getTimeToVelocityin interfaceMotor- Throws:
MotorException
-
setTimeToVelocity
Description copied from interface:MotorSets this motor's time to velocity.- Specified by:
setTimeToVelocityin interfaceMotor- Throws:
MotorException
-
setSpeedLevel
Description copied from interface:MotorSets the speed level of the motor- Specified by:
setSpeedLevelin interfaceMotor- Parameters:
speed- one of a range of possible levels eg slow, medium, fast- Throws:
MotorException
-
addInBacklash
public double addInBacklash(double increment) The calculation used to determine the size of the first part of a backlash move and to set whether backlash is required.- Parameters:
increment- requested size of move in hardware units- Returns:
- size of move adjusted for backlash correction if needed
-
correctBacklash
If backlash is required, this method instigates the final backlash move. This method works for motors which use incremental moves and should be overridden by motors which use absolute encoder positions.- Specified by:
correctBacklashin interfaceMotor- Throws:
MotorException
-
waitWhileStatusBusy
Description copied from interface:MotorBlocks while the motors status is Busy- Specified by:
waitWhileStatusBusyin interfaceMotor- Returns:
- status after being busy
- Throws:
InterruptedExceptionDeviceException
-
setSoftLimits
Sets the software limits. Some motors/motor controllers are capable of setting up softlimits in them so that the so that the hard limit switch is never hit (at least theoretically) Such motor implementations should overide this method if required.- Specified by:
setSoftLimitsin interfaceMotor- Parameters:
minPosition- the minimum softlimitmaxPosition- the maximum softlimit- Throws:
MotorException
-
getMinPosition
Description copied from interface:MotorGets 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.- Specified by:
getMinPositionin interfaceMotor- Returns:
- the lower soft limit of the motor
- Throws:
MotorException
-
setMinPosition
Description copied from interface:MotorSet the lower soft limit of the motor- Specified by:
setMinPositionin interfaceMotor- Parameters:
minPosition- the lower limit to set- Throws:
MotorException
-
getMaxPosition
Description copied from interface:MotorGets 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.- Specified by:
getMaxPositionin interfaceMotor- Returns:
- the upper soft limit of the motor
- Throws:
MotorException
-
setMaxPosition
Description copied from interface:MotorSet the upper soft limit of the motor- Specified by:
setMaxPositionin interfaceMotor- Parameters:
maxPosition- upper limit to set- Throws:
MotorException
-
getRetryDeadband
Description copied from interface:Motorreturn the position tolerance or accuracy- Specified by:
getRetryDeadbandin interfaceMotor- Returns:
- positioning tolerance
- Throws:
MotorException
-
isHomeable
public boolean isHomeable()Checks if the motor is homeable or not. Motor implementations should overide this method if required.- Specified by:
isHomeablein interfaceMotor- Returns:
- if the motor is homeable. Returns false!
-
isHomed
Checks if the motor is homed or not. Motor implementations should overide this method if required.- Specified by:
isHomedin interfaceMotor- Returns:
- if the motor is homed. Returns false!
- Throws:
MotorException
-
home
Moves the motor to a repeatable starting location. Motor implementations should overide this method if required.- Specified by:
homein interfaceMotor- Throws:
MotorException
-
isInitialised
public boolean isInitialised()Description copied from interface:MotorGets initialisition state of the motor with respect to its connection to low level device service e.g. EPICS server. This value does not imply that the motors initial values are set (or not set).- Specified by:
isInitialisedin interfaceMotor- Returns:
- return true if motor is already initialised.
-
setInitialised
public void setInitialised(boolean initialised) - Parameters:
initialised-
-
setMotorResolution
- Throws:
MotorException
-
getMotorResolution
- Specified by:
getMotorResolutionin interfaceMotor- Throws:
MotorException
-
getUserOffset
- Specified by:
getUserOffsetin interfaceMotor- Returns:
- the user offset set on the motor
- Throws:
MotorException
-
getUnitString
- Specified by:
getUnitStringin interfaceMotor- Returns:
- unit as a String
- Throws:
MotorException
-