Class JActorSampleChanger

All Implemented Interfaces:
Device, Stoppable, Configurable, Findable, gda.observable.IObservable, BlockedPositions, IJActorSampleChanger, IJCameramanObserver, SampleChanger
Direct Known Subclasses:
DummyJCameramanSampleChanger, OscarSampleChanger

public class JActorSampleChanger extends DeviceBase implements IJActorSampleChanger, IJCameramanObserver
For ACTOR sample changers. Also acts as a base class for other SampleChanger classes using the JCameraman API.
  • Field Details

    • cameraClientInitialised

      protected boolean cameraClientInitialised
      flag to say if the camera client has been initialised (camera and sample positioner controls)
    • centreRequired

      protected boolean centreRequired
      if a sample has been mounted but not centred yet
    • host

      protected String host
      host name of the computer running cameraman
    • controller

      protected JCameramanController controller
      The JCameramanController object this object is using to communicate with Cameraman
    • centringAngles

      protected Double[] centringAngles
      List of angles to use during auto-centring
    • readingBarcodes

      protected boolean readingBarcodes
  • Constructor Details

    • JActorSampleChanger

      public JActorSampleChanger()
      Constructor.
  • Method Details

    • getSpecialPinPuckNumber

      public int getSpecialPinPuckNumber()
      Specified by:
      getSpecialPinPuckNumber in interface IJActorSampleChanger
    • setSpecialPinPuckNumber

      public void setSpecialPinPuckNumber(int specialPinPuckNumber)
    • abort

      public void abort() throws DeviceException
      Not a panic stop, but clears the robots error state to allow it to be moved to the wait location.
      Throws:
      DeviceException
      See Also:
      • RobotClient.abort()
    • anneal

      public void anneal(int time) throws DeviceException
      Anneal the currently mounted sample
      Parameters:
      time -
      Throws:
      DeviceException
    • centrelid

      public void centrelid(int lidNumber) throws DeviceException
      Calls close lid on the api which automatically centres the lid
      Specified by:
      centrelid in interface IJActorSampleChanger
      Throws:
      DeviceException
    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default implementation for classes that do not have to do any specific configuration.
      Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • firstOperationSinceInterlock

      public boolean firstOperationSinceInterlock()
      Returns:
      true if this is the first time the robot has been operated since the EH pss was interlocked. If this is true then users should be asked if they are sure the robot has been centred
    • dispose

      public void dispose() throws DeviceException
      Disposes of the currently mounted sample.
      Throws:
      DeviceException
    • dry

      public void dry() throws DeviceException
      Checks status and performs a dry. If an eStop has occurred then reconnect to Cameraman and dry.
      Throws:
      DeviceException
    • getActionApproverName

      public String getActionApproverName()
      Specified by:
      getActionApproverName in interface SampleChanger
      Returns:
      Returns the actionApproverName.
    • 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
      Overrides:
      getAttribute in class DeviceBase
      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
    • getBarcode

      public String getBarcode() throws DeviceException
      Description copied from interface: SampleChanger
      For SampleChangers which are set to read barcodes, returns as a string the barcode of the sample mounted during the last load operation.
      Specified by:
      getBarcode in interface SampleChanger
      Returns:
      the barcode of the currently mounted sample
      Throws:
      DeviceException
    • getHolder

      public int getHolder() throws DeviceException
      Description copied from interface: SampleChanger
      Returns the number of the holder of the current loaded sample.
      Specified by:
      getHolder in interface SampleChanger
      Returns:
      int
      Throws:
      DeviceException
    • getHolderAndSample

      public int[] getHolderAndSample() throws DeviceException
      Specified by:
      getHolderAndSample in interface IJActorSampleChanger
      Throws:
      DeviceException
    • getHolderType

      public String getHolderType() throws DeviceException
      Description copied from interface: SampleChanger
      Returns a string representing the type of puck in use
      Specified by:
      getHolderType in interface SampleChanger
      Returns:
      string
      Throws:
      DeviceException
    • getHost

      public String getHost()
      Returns:
      name of the machine running Cameraman2
    • getPssPVName

      public String getPssPVName()
      Returns:
      the pssPVName
    • setPssPVName

      public void setPssPVName(String pssPVName)
      Parameters:
      pssPVName - the pssPVName to set
    • getImageBySocket

      public Image getImageBySocket() throws rigaku.jcameraman.CameraException
      Returns:
      the latest Image object collected by Cameraman
      Throws:
      rigaku.jcameraman.CameraException
    • getNumberOfHolders

      public int getNumberOfHolders()
      Description copied from interface: SampleChanger
      Returns the number of holders (pucks) over all available dewars to load from.
      Specified by:
      getNumberOfHolders in interface SampleChanger
      Returns:
      int
    • getReadingBarcodes

      public boolean getReadingBarcodes() throws DeviceException
      Specified by:
      getReadingBarcodes in interface SampleChanger
      Returns:
      true if the samplechanger will read barcodes during loading.
      Throws:
      DeviceException
    • getSample

      public int getSample() throws DeviceException
      Description copied from interface: SampleChanger
      Get the position in its holder of the currently loaded sample.
      Specified by:
      getSample in interface SampleChanger
      Returns:
      int
      Throws:
      DeviceException
    • getSamplesInHolder

      public int getSamplesInHolder(int holder)
      Description copied from interface: SampleChanger
      Returns the number of samples in the specified holder (puck).
      Specified by:
      getSamplesInHolder in interface SampleChanger
      Parameters:
      holder - the holder number (starting from 1)
      Returns:
      the number of samples in that holder
    • getStatus

      public SampleChangerStatus getStatus()
      This is current progress of the sample changer. If the status is ERROR then this means that the last command has completed but failed. You should ignore this and try subsequent commands anyway. All failed commands should throw an exception (apart from dry operations at the end of loading/exchanging/unloading).
      Specified by:
      getStatus in interface SampleChanger
      Returns:
      the current status of the sample changer as a SampleChangerStatus object
      See Also:
    • getTypeString

      public String getTypeString() throws DeviceException
      Description copied from interface: SampleChanger
      Returns a string of the Java class of the type of this sample changer.
      Specified by:
      getTypeString in interface SampleChanger
      Returns:
      java.lang.String
      Throws:
      DeviceException
    • gotoWait

      public void gotoWait() throws DeviceException
      Moves the robot to the wait position. This can be useful when recovering from an error.
      Throws:
      DeviceException
    • panicStop

      public void panicStop()
      In this class, shutdown means continue no further after current operation.
    • initialise

      protected void initialise() throws DeviceException
      Throws:
      DeviceException
    • isCentreRequired

      public boolean isCentreRequired() throws DeviceException
      Description copied from interface: SampleChanger
      Returns true if the user needs to centre the crystal.
      Specified by:
      isCentreRequired in interface SampleChanger
      Throws:
      DeviceException
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: SampleChanger
      Returns true if this sample changer is in use for loading samples.
      Specified by:
      isEnabled in interface SampleChanger
      Returns:
      boolean
    • isSampleLoaded

      public boolean isSampleLoaded() throws DeviceException
      Description copied from interface: SampleChanger
      Returns true if a sample is in the sample position on the beamline.
      Specified by:
      isSampleLoaded in interface SampleChanger
      Returns:
      boolean
      Throws:
      DeviceException
    • isSampleDetected

      public boolean isSampleDetected() throws DeviceException
      Throws:
      DeviceException
    • load

      public void load(int holder, int sample) throws DeviceException
      Description copied from interface: SampleChanger
      Load a sample.
      Specified by:
      load in interface SampleChanger
      Parameters:
      holder - the holder number (≥1)
      sample - the sample number (≥1)
      Throws:
      DeviceException
    • 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
    • setActionApproverName

      public void setActionApproverName(String actionApproverName)
      Specified by:
      setActionApproverName in interface SampleChanger
      Parameters:
      actionApproverName - The actionApproverName to set.
    • 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
      Overrides:
      setAttribute in class DeviceBase
      Parameters:
      attributeName - is the name of the attribute
      value - is the value of the attribute
      Throws:
      DeviceException - if an attribute cannot be set
    • setCentreRequired

      public void setCentreRequired(boolean centringRequired) throws DeviceException
      Description copied from interface: SampleChanger
      Sets the centre required flag. This enables the detector to be told when manual centring has been successfully completed.
      Specified by:
      setCentreRequired in interface SampleChanger
      Parameters:
      centringRequired -
      Throws:
      DeviceException
    • setEnabled

      public void setEnabled(boolean enabled) throws DeviceException
      Description copied from interface: SampleChanger
      Sets if the sample changer is currently in use.
      Specified by:
      setEnabled in interface SampleChanger
      Parameters:
      enabled -
      Throws:
      DeviceException
    • setHolderType

      public void setHolderType(String puckType) throws DeviceException
      Description copied from interface: SampleChanger
      Sets a string representing the type of puck in use e.g. "Rigaku"
      Specified by:
      setHolderType in interface SampleChanger
      Parameters:
      puckType -
      Throws:
      DeviceException
    • setHost

      public void setHost(String host)
      Set the name of the machine running Cameraman2.
      Parameters:
      host -
    • clearSample

      public void clearSample() throws DeviceException
      Specified by:
      clearSample in interface IJActorSampleChanger
      Throws:
      DeviceException
    • setLoadedSample

      public void setLoadedSample(int holder, int sample)
      Description copied from interface: SampleChanger
      Sets the holder and sample numbers of the loaded sample. To be used if a sample is manually mounted onto the sample changer.
      Specified by:
      setLoadedSample in interface SampleChanger
      Parameters:
      holder - the holder number
      sample - the sample number
    • setNumberOfHolders

      public void setNumberOfHolders(int numberOfHolders)
      Description copied from interface: SampleChanger
      Sets the number of total holders (pucks/magazines/plates etc.) that the sample changer can load from
      Specified by:
      setNumberOfHolders in interface SampleChanger
      Parameters:
      numberOfHolders -
    • setNumberOfPlates

      public void setNumberOfPlates(int numberOfPlates)
    • getNumberOfPlates

      public int getNumberOfPlates()
    • setReadingBarcodes

      public void setReadingBarcodes(boolean readDuringLoad) throws DeviceException
      Description copied from interface: SampleChanger
      Sets whether to read barcodes during each load operation
      Specified by:
      setReadingBarcodes in interface SampleChanger
      Parameters:
      readDuringLoad -
      Throws:
      DeviceException
    • setSamplesInHolder

      public void setSamplesInHolder(int holder, int samples)
      Description copied from interface: SampleChanger
      Sets the number of samples in the specified holder. Used when changing the puck type mid-experiment.
      Specified by:
      setSamplesInHolder in interface SampleChanger
      Parameters:
      holder - the holder number (starting from 1)
      samples - the number of samples in that holder
    • setSamplesInEveryHolder

      public void setSamplesInEveryHolder(int samplesPerHolder)
      Sets the number of samples in every holder to the same value.
      Parameters:
      samplesPerHolder - the number of samples in each holder
    • setSoakAfterOperation

      public void setSoakAfterOperation(boolean soakAfterOperation) throws DeviceException
      Parameters:
      soakAfterOperation -
      Throws:
      DeviceException
      See Also:
      • RobotClient.setReturnToSafe(boolean)
    • getLocation

      public rigaku.jcameraman.RobotClient.RobotLocation getLocation() throws DeviceException
      Specified by:
      getLocation in interface IJActorSampleChanger
      Returns:
      The location of the robot e.g. RobotLocation.SOAK
      Throws:
      DeviceException
    • soak

      public void soak(int dewarNumber) throws DeviceException
      Soaks the end effector. This will not do anything if the end effector is already in the fast screen mode location.

      Note that this returns immediately and leaves the sample changer in a SOAKING status!

      Note that this will leave the end effector in the dewar and a mount/unmount or return to safe should be called asap after this function returns.

      Specified by:
      soak in interface IJActorSampleChanger
      Throws:
      DeviceException
    • store

      public void store(int holder, int sample) throws DeviceException
      Unmounts the current sample and puts it into the given location. Assumes that the sample has been manually mounted and the user has checked that nothing is in the holder at that position.
      Parameters:
      holder -
      sample -
      Throws:
      DeviceException
    • move

      public void move(int oldHolder, int oldSample, int newHolder, int newSample) throws DeviceException
      Throws:
      DeviceException
    • _move

      protected void _move(gda.px.sampleChanger.JActorSampleChanger.GdaPosition oldGdaPosition, gda.px.sampleChanger.JActorSampleChanger.GdaPosition newGdaPosition) throws DeviceException
      Throws:
      DeviceException
    • unload

      public void unload() throws DeviceException
      Description copied from interface: SampleChanger
      Unloads the current sample without loading a new one.
      Specified by:
      unload in interface SampleChanger
      Throws:
      DeviceException
    • _unload

      protected void _unload(boolean dryAtEnd) throws DeviceException
      Throws:
      DeviceException
    • waitForIdle

      public boolean waitForIdle() throws DeviceException
      Description copied from interface: SampleChanger
      Returns when the sample changer has finished its current operation.
      Specified by:
      waitForIdle in interface SampleChanger
      Returns:
      true if the current operation was successful
      Throws:
      DeviceException
    • disconnect

      public void disconnect()
      Sets this object to a state where it has to be reconfigured and enabled to work again.
    • setState

      protected final void setState(SampleChangerStatus status)
      Parameters:
      status -
    • logActorException

      protected void logActorException()
      Sets the status to error and changes the errorMessage attribute to a useful message.

      Does not throw an exception: the decision to do this should be made by the calling method.

    • commandComplete

      public void commandComplete(rigaku.jcameraman.RobotEvent event)
      Description copied from interface: IJCameramanObserver
      Called when a command has been completed in the Rigaku system.
      Specified by:
      commandComplete in interface IJCameramanObserver
      Parameters:
      event - - the event that has just been completed.
    • getErrorMessage

      protected String getErrorMessage()
    • stop

      public void stop() throws DeviceException
      Description copied from interface: Stoppable
      Stops the current operation.
      Specified by:
      stop in interface SampleChanger
      Specified by:
      stop in interface Stoppable
      Throws:
      DeviceException
    • isSampleLoaded

      public boolean isSampleLoaded(int holder, int sample) throws DeviceException
      Description copied from interface: SampleChanger
      Returns true if loaded sample has the specified index.
      Specified by:
      isSampleLoaded in interface SampleChanger
      Parameters:
      holder - the holder index (≥1)
      sample - the sample index (≥1)
      Returns:
      boolean
      Throws:
      DeviceException
    • getPuckName

      public String getPuckName(int position)
      Specified by:
      getPuckName in interface IJActorSampleChanger
    • isPositionBlocked

      public boolean isPositionBlocked(int holder, int sample)
      Specified by:
      isPositionBlocked in interface BlockedPositions
    • getBlockedPositions

      public Set<Sample> getBlockedPositions()
      Specified by:
      getBlockedPositions in interface BlockedPositions