Class SimpleMotor

All Implemented Interfaces:
Device, Motor, Configurable, Findable, gda.observable.IObservable, org.springframework.beans.factory.InitializingBean

public class SimpleMotor extends FindableConfigurableBase implements Motor, org.springframework.beans.factory.InitializingBean
part of
  • Constructor Details

    • SimpleMotor

      public SimpleMotor()
  • Method Details

    • setAttribute

      public void setAttribute(String attributeName, Object value) throws DeviceException
      Description copied from interface: Device
      Set any attribute the implementing classes may provide
      Specified by:
      setAttribute in interface Device
      Parameters:
      attributeName - is the name of the attribute
      value - is the value of the attribute
      Throws:
      DeviceException - if an attribute cannot be set
    • getAttribute

      public Object getAttribute(String attributeName) throws DeviceException
      Description copied from interface: Device
      Get the value of the specified attribute
      Specified by:
      getAttribute in interface Device
      Parameters:
      attributeName - is the name of the attribute
      Returns:
      the value of the attribute as an Object type
      Throws:
      DeviceException - if an attribute cannot be retrieved
    • close

      public void close() throws DeviceException
      Description copied from interface: Device
      Close and unconfigure the device.
      Specified by:
      close in interface Device
      Throws:
      DeviceException
    • setProtectionLevel

      public void setProtectionLevel(int newLevel)
      Description copied from interface: Device
      Sets the permission level for this object. If this is not set then a default value will be applied.
      Specified by:
      setProtectionLevel in interface Device
      Parameters:
      newLevel -
    • getProtectionLevel

      public int getProtectionLevel()
      Specified by:
      getProtectionLevel in interface Device
      Returns:
      int - the permission level for this object.
    • addIObserver

      public void addIObserver(gda.observable.IObserver observer)
      Specified by:
      addIObserver in interface gda.observable.IObservable
    • deleteIObserver

      public void deleteIObserver(gda.observable.IObserver observer)
      Specified by:
      deleteIObserver in interface gda.observable.IObservable
    • deleteIObservers

      public void deleteIObservers()
      Specified by:
      deleteIObservers in interface gda.observable.IObservable
    • reconfigure

      public void reconfigure() throws FactoryException
      Description copied from interface: Configurable
      Re-initialisation of values and states.

      Moved from Reconfigurable which has been deleted

      Specified by:
      reconfigure in interface Configurable
      Overrides:
      reconfigure in class ConfigurableBase
      Throws:
      FactoryException
    • moveBy

      public void moveBy(double increment) throws MotorException
      Description copied from interface: Motor
      Moves the motor by the specified number of steps
      Specified by:
      moveBy in interface Motor
      Parameters:
      increment - the number of steps to move by
      Throws:
      MotorException
    • moveTo

      public void moveTo(double position) throws MotorException
      Description copied from interface: Motor
      Moves the motor to the specified position in steps
      Specified by:
      moveTo in interface Motor
      Parameters:
      position - the number of steps to move to
      Throws:
      MotorException
    • moveContinuously

      public void moveContinuously(int direction) throws MotorException
      Description copied from interface: Motor
      Moves the motor in a continuous mode
      Specified by:
      moveContinuously in interface Motor
      Parameters:
      direction - direction to move in
      Throws:
      MotorException
    • setPosition

      public void setPosition(double steps) throws MotorException
      Description copied from interface: Motor
      Sets the current position of the motor
      Specified by:
      setPosition in interface Motor
      Parameters:
      steps - the position to be set as current
      Throws:
      MotorException
    • getPosition

      public double getPosition() throws MotorException
      Description copied from interface: Motor
      Gets the current position of the motor
      Specified by:
      getPosition in interface Motor
      Returns:
      the current position
      Throws:
      MotorException
    • setSpeed

      public void setSpeed(double speed) throws MotorException
      Description copied from interface: Motor
      Sets the speed of the motor
      Specified by:
      setSpeed in interface Motor
      Parameters:
      speed - the speed
      Throws:
      MotorException
    • setSpeedLevel

      public void setSpeedLevel(int level) throws MotorException
      Description copied from interface: Motor
      Sets the speed level of the motor
      Specified by:
      setSpeedLevel in interface Motor
      Parameters:
      level - one of a range of possible levels eg slow, medium, fast
      Throws:
      MotorException
    • getSpeed

      public double getSpeed() throws MotorException
      Description copied from interface: Motor
      Gets the current speed setting of the motor
      Specified by:
      getSpeed in interface Motor
      Returns:
      the speed in steps per second
      Throws:
      MotorException
    • getTimeToVelocity

      public double getTimeToVelocity() throws MotorException
      Description copied from interface: Motor
      Returns this motor's time to velocity.
      Specified by:
      getTimeToVelocity in interface Motor
      Throws:
      MotorException
    • setTimeToVelocity

      public void setTimeToVelocity(double timeToVelocity) throws MotorException
      Description copied from interface: Motor
      Sets this motor's time to velocity.
      Specified by:
      setTimeToVelocity in interface Motor
      Throws:
      MotorException
    • stop

      public void stop() throws MotorException
      Description copied from interface: Motor
      Brings the motor to a controlled stop if possible
      Specified by:
      stop in interface Motor
      Throws:
      MotorException
    • panicStop

      public void panicStop() throws MotorException
      Description copied from interface: Motor
      Brings the motor to an uncontrolled stop if possible
      Specified by:
      panicStop in interface Motor
      Throws:
      MotorException
    • getStatus

      public MotorStatus getStatus() throws MotorException
      Description copied from interface: Motor
      Gets the state of the motor
      Specified by:
      getStatus in interface Motor
      Returns:
      a value from the MotorStatus enum
      Throws:
      MotorException
    • correctBacklash

      public void correctBacklash() throws MotorException
      Description copied from interface: Motor
      Do backlash correction
      Specified by:
      correctBacklash in interface Motor
      Throws:
      MotorException
    • isMoving

      public boolean isMoving() throws MotorException
      Description copied from interface: Motor
      Returns whether or not motor is actually moving
      Specified by:
      isMoving in interface Motor
      Returns:
      true if moving
      Throws:
      MotorException
    • isHomeable

      public boolean isHomeable() throws MotorException
      Description copied from interface: Motor
      Returns whether or not motor can home
      Specified by:
      isHomeable in interface Motor
      Returns:
      true if homeable
      Throws:
      MotorException
    • isHomed

      public boolean isHomed() throws MotorException
      Description copied from interface: Motor
      Returns whether or not motor is already homed
      Specified by:
      isHomed in interface Motor
      Returns:
      true if homed
      Throws:
      MotorException
    • home

      public void home() throws MotorException
      Description copied from interface: Motor
      Moves the motor to a repeatable starting location
      Specified by:
      home in interface Motor
      Throws:
      MotorException
    • setSoftLimits

      public void setSoftLimits(double minPosition, double maxPosition) throws MotorException
      Description copied from interface: Motor
      Sets the soft limits of the motor itself (i.e. NOT limits in our software)
      Specified by:
      setSoftLimits in interface Motor
      Parameters:
      minPosition - minimum software limit
      maxPosition - maximum software limit
      Throws:
      MotorException
    • getMinPosition

      public double getMinPosition() throws MotorException
      Description copied from interface: Motor
      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.
      Specified by:
      getMinPosition in interface Motor
      Returns:
      the lower soft limit of the motor
      Throws:
      MotorException
    • getMaxPosition

      public double getMaxPosition() throws MotorException
      Description copied from interface: Motor
      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.
      Specified by:
      getMaxPosition in interface Motor
      Returns:
      the upper soft limit of the motor
      Throws:
      MotorException
    • getSmc

      public SimpleMotorController getSmc()
    • setSmc

      public void setSmc(SimpleMotorController smc)
    • setMinPosition

      public void setMinPosition(double minPosition)
      Description copied from interface: Motor
      Set the lower soft limit of the motor
      Specified by:
      setMinPosition in interface Motor
      Parameters:
      minPosition - the lower limit to set
    • setMaxPosition

      public void setMaxPosition(double maxPosition)
      Description copied from interface: Motor
      Set the upper soft limit of the motor
      Specified by:
      setMaxPosition in interface Motor
      Parameters:
      maxPosition - upper limit to set
    • isLimitsSettable

      public boolean isLimitsSettable() throws MotorException
      Description copied from interface: Motor
      Returns whether or not limits are settable (in the motor itself).
      Specified by:
      isLimitsSettable in interface Motor
      Returns:
      true if the limits are settable.
      Throws:
      MotorException
    • isInitialised

      public boolean isInitialised() throws MotorException
      Description copied from interface: Motor
      Gets 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:
      isInitialised in interface Motor
      Returns:
      return true if motor is already initialised.
      Throws:
      MotorException
    • getRetryDeadband

      public double getRetryDeadband() throws MotorException
      Description copied from interface: Motor
      return the position tolerance or accuracy
      Specified by:
      getRetryDeadband in interface Motor
      Returns:
      positioning tolerance
      Throws:
      MotorException
    • getMotorResolution

      public double getMotorResolution() throws MotorException
      Specified by:
      getMotorResolution in interface Motor
      Throws:
      MotorException
    • getUserOffset

      public double getUserOffset() throws MotorException
      Specified by:
      getUserOffset in interface Motor
      Returns:
      the user offset set on the motor
      Throws:
      MotorException
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • waitWhileStatusBusy

      public MotorStatus waitWhileStatusBusy() throws InterruptedException, DeviceException
      Description copied from interface: Motor
      Blocks while the motors status is Busy
      Specified by:
      waitWhileStatusBusy in interface Motor
      Returns:
      status after being busy
      Throws:
      InterruptedException
      DeviceException
    • getUnitString

      public String getUnitString() throws MotorException
      Specified by:
      getUnitString in interface Motor
      Returns:
      unit as a String
      Throws:
      MotorException