Package gda.px.camera

Class MXCamera

All Implemented Interfaces:
Device, Configurable, Findable, gda.observable.IObservable, gda.observable.IObserver, Camera, MXCameraInterface
Direct Known Subclasses:
VmxmMXCamera

@ServiceInterface(MXCameraInterface.class) public class MXCamera extends DeviceBase implements gda.observable.IObserver, MXCameraInterface
A camera for the Diamond MX beamlines. Underlying is a shutter, omega axis and detector-support. The omega axis is an EpicsAngularDOF, the detector-support an OE, and the shutter and omega-shutter combined motion bespoke Epics records.

If the goniometer rotation axis record name is not specified, it will be automatically determined by appending "-MO-GONIO-01:PHI" to the EPICS beamline name; for example, "BL02I-MO-GONIO-01:PHI". If this is not suitable for your beamline, set the record name explicitly using setGonioRotationAxisRecord(String).

  • Field Details

    • shutter

      protected Shutter shutter
    • safeDistance

      protected double safeDistance
    • imageAngle

      protected double imageAngle
    • imageTotalTime

      protected double imageTotalTime
    • imageStart

      protected double imageStart
    • numberPassesPerImage

      protected int numberPassesPerImage
    • omegaName

      protected String omegaName
    • detectorSupportZName

      protected String detectorSupportZName
    • omegaMotor

      protected ScannableMotionUnits omegaMotor
    • detectorSupportMotor

      protected ScannableMotor detectorSupportMotor
    • gonioRotationAxisRecord

      protected String gonioRotationAxisRecord
    • exposureState

      protected String exposureState
    • lastKnownDetectorPosition

      protected double lastKnownDetectorPosition
    • lastKnowOmegaPosition

      protected double lastKnowOmegaPosition
    • Ixx21

      protected final double Ixx21
      See Also:
    • acceleration

      protected double acceleration
    • shutterOpenTime

      protected double shutterOpenTime
    • shutterCloseTime

      protected double shutterCloseTime
    • openExtraTime

      protected double openExtraTime
    • closeExtraTime

      protected double closeExtraTime
    • isDefaultSpeedSet

      protected boolean isDefaultSpeedSet
    • isDefaultAccelerationTimeSet

      protected boolean isDefaultAccelerationTimeSet
    • defaultMoveTime

      protected double defaultMoveTime
      Time to move omega back to start of exposure as observed by the GDA. This is based on the assumption that exposures are invalid input: '<' 30 degrees.
    • overallTimePerPassFudgeFactor

      protected double overallTimePerPassFudgeFactor
    • omegaAxisMultiplicationFactor

      protected double omegaAxisMultiplicationFactor
    • moveTriggerToSafePosition

      protected boolean moveTriggerToSafePosition
    • safePosition

      protected int safePosition
      if moveTriggerToSafePosition is used, move to this value during setDefaultSpeeds() original message from I24MXCamera: this is the angle that the omega is moved to so that it is out of the way and ensure that the shutter isn't triggered this default value is fine for I24 (131 counts/deg), but may need to be changed with higher precision rotation stages
    • openAngle

      protected double openAngle
    • closeAngle

      protected double closeAngle
    • desiredAngularVelocity

      protected double desiredAngularVelocity
    • desiredAccelerationTime

      protected double desiredAccelerationTime
    • omegaStartPosition

      protected double omegaStartPosition
    • omegaEndPosition

      protected double omegaEndPosition
    • minExposeTime

      protected double minExposeTime
      This value is really more of a ceiling on the expected exposure time instead of the minimum exposure time.
    • trigger

      protected Trigger trigger
    • omegaAxisController

      protected ShutteredScannableMotor omegaAxisController
    • omegaMaxVelocity

      protected OmegaMaxVelocity omegaMaxVelocity
    • omegaRecordName

      protected String omegaRecordName
  • Constructor Details

    • MXCamera

      public MXCamera()
  • Method Details

    • setShutter

      public void setShutter(Shutter shutter)
      Specified by:
      setShutter in interface MXCameraInterface
    • getShutter

      public Shutter getShutter()
    • setDetectorSupportMotor

      public void setDetectorSupportMotor(ScannableMotor motor)
      Sets the detector support motor used by this camera.
      Specified by:
      setDetectorSupportMotor in interface MXCameraInterface
      Parameters:
      motor - the detector support motor
    • setOmegaMotor

      public void setOmegaMotor(ScannableMotionUnits motor)
      Sets the omega motor used by this camera.
      Specified by:
      setOmegaMotor in interface MXCameraInterface
      Parameters:
      motor - the omega motor
    • setGonioRotationAxisRecord

      public void setGonioRotationAxisRecord(String gonioRotationAxisRecord)
      Sets the record name for the goniometer rotation axis (e.g. "BL04J-MO-MD2-01:GONIO:OMEGA").
      Specified by:
      setGonioRotationAxisRecord in interface MXCameraInterface
      Parameters:
      gonioRotationAxisRecord - the rotation axis record name
    • checkDetectorDistance

      public boolean checkDetectorDistance(double distance) throws DeviceException
      Description copied from interface: Camera
      Returns whether or not the requested detector distance is within the available range.
      Specified by:
      checkDetectorDistance in interface Camera
      Parameters:
      distance -
      Returns:
      true if it is, false if not
      Throws:
      DeviceException
    • close

      public void close() throws DeviceException
      Description copied from interface: Device
      Close and unconfigure the device.
      Specified by:
      close in interface Device
      Overrides:
      close in class DeviceBase
      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
    • checkConfiguration

      protected void checkConfiguration()
    • retrieveOmega

      protected void retrieveOmega()
      Retrieves the omega motor from the Finder.
    • retrieveDetectorSupport

      protected void retrieveDetectorSupport()
      Retrieves the detector support motor from the Finder.
    • expose

      public void expose() throws DeviceException
      Perform a protein crystallography exposure according to the set parameters.

      This should be called after prepareForExposure. Then setDefaultSpeeds should be called afterwards.

      This should be called after lineupOmegaBeforeExpose and setupOmegaForMove. Then resetOmegaShutterParameters should be called afterwards.

      Specified by:
      expose in interface Camera
      Throws:
      DeviceException
    • 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
    • getCloseAngle

      public double getCloseAngle()
      Specified by:
      getCloseAngle in interface MXCameraInterface
      Returns:
      double - the angle to send the close signal to the shutter
    • getDefaultAccelerationTime

      public double getDefaultAccelerationTime()
      Specified by:
      getDefaultAccelerationTime in interface MXCameraInterface
      Returns:
      double - the accel curve to reset to after exposure
    • getDefaultMoveTime

      public double getDefaultMoveTime()
      Specified by:
      getDefaultMoveTime in interface MXCameraInterface
      Returns:
      double - the time to return the goniometer after an exposure to its start position
    • getDefaultSpeed

      public double getDefaultSpeed()
      Specified by:
      getDefaultSpeed in interface MXCameraInterface
      Returns:
      double - the speed to set the motor to after exposure
    • getDesiredAccelerationTime

      public double getDesiredAccelerationTime()
      Specified by:
      getDesiredAccelerationTime in interface MXCameraInterface
      Returns:
      double - the accel curve to use during the exposure
    • getDesiredAngularVelocity

      public double getDesiredAngularVelocity()
      Specified by:
      getDesiredAngularVelocity in interface MXCameraInterface
      Returns:
      double - the angular velocity of the exposure
    • getDetectorDistance

      public double getDetectorDistance() throws DeviceException
      Description copied from interface: Camera
      Get the current camera crystal to detector distance.
      Specified by:
      getDetectorDistance in interface Camera
      Returns:
      Current camera crystal to detector distance.
      Throws:
      DeviceException
    • getDetectorMotionTolerance

      public double getDetectorMotionTolerance() throws DeviceException
      Specified by:
      getDetectorMotionTolerance in interface Camera
      Throws:
      DeviceException
    • getDetectorSupportZName

      public String getDetectorSupportZName()
      Specified by:
      getDetectorSupportZName in interface MXCameraInterface
      Returns:
      the name of the dof of the detector support z-axis
    • getExtraCloseTime

      public double getExtraCloseTime()
      Specified by:
      getExtraCloseTime in interface MXCameraInterface
      Returns:
      the angular delay when stopping omega after the shutter has been closed
    • getExtraOpenTime

      public double getExtraOpenTime()
      Specified by:
      getExtraOpenTime in interface MXCameraInterface
      Returns:
      the angular space factor to start the omega movement before the exposure start position
    • getMaxDistance

      public double getMaxDistance() throws DeviceException
      Description copied from interface: Camera
      Get the maximum allowed camera crystal to detector distance.
      Specified by:
      getMaxDistance in interface Camera
      Returns:
      Maximum camera crystal to detector distance.
      Throws:
      DeviceException
    • getMinDistance

      public double getMinDistance() throws DeviceException
      Description copied from interface: Camera
      Get the minimum allowed camera crystal to detector distance.
      Specified by:
      getMinDistance in interface Camera
      Returns:
      Minimum camera crystal to detector distance.
      Throws:
      DeviceException
    • getMinExposeTime

      public double getMinExposeTime()
      Specified by:
      getMinExposeTime in interface MXCameraInterface
      Returns:
      double - minimum predicted time which the omega movement of the exposure will take
    • getOpenAngle

      public double getOpenAngle()
      Specified by:
      getOpenAngle in interface MXCameraInterface
      Returns:
      double - the angle to send the open signal to the shutter
    • getOmegaDOFName

      public String getOmegaDOFName()
      Specified by:
      getOmegaDOFName in interface MXCameraInterface
      Returns:
      the name of the omega dof
    • getOmegaEndPosition

      public double getOmegaEndPosition()
      Specified by:
      getOmegaEndPosition in interface MXCameraInterface
      Returns:
      double - the omega angle to move to during the exposure
    • getOmegaStartPosition

      public double getOmegaStartPosition()
      Specified by:
      getOmegaStartPosition in interface MXCameraInterface
      Returns:
      double - the omega angle to start the exposure
    • getOmegaPosition

      public double getOmegaPosition() throws DeviceException
      Description copied from interface: Camera
      Returns the rotation axis's omega position.
      Specified by:
      getOmegaPosition in interface Camera
      Returns:
      Omega
      Throws:
      DeviceException
    • getRAState

      public String getRAState() throws DeviceException
      Get rotation axis state.
      Specified by:
      getRAState in interface MXCameraInterface
      Returns:
      the state
      Throws:
      DeviceException - if a device exception occurs
    • getSafeDistance

      public double getSafeDistance()
      Specified by:
      getSafeDistance in interface MXCameraInterface
      Returns:
      a safe distance for the detector to move to when users enter the hutch
    • getShutterCloseTime

      public double getShutterCloseTime()
      Specified by:
      getShutterCloseTime in interface MXCameraInterface
      Returns:
      the time to delay sending the shutter close signal before the omega rotation completes
    • getShutterOpenTime

      public double getShutterOpenTime()
      Specified by:
      getShutterOpenTime in interface MXCameraInterface
      Returns:
      the time to delay sending the shutter open signal before the omega gets to the start of the exposure
    • hasShutterStatus

      public boolean hasShutterStatus()
    • isShutterOpen

      public boolean isShutterOpen() throws DeviceException
      Description copied from interface: Camera
      Get the current shutter state of the camera as a string.
      Specified by:
      isShutterOpen in interface Camera
      Returns:
      Current shutter state.
      Throws:
      DeviceException
    • isSpeedAchievable

      public boolean isSpeedAchievable(double time, double oscillation) throws DeviceException
      Description copied from interface: Camera
      Based on passed parameters checks whether requested speed is achivable.
      Specified by:
      isSpeedAchievable in interface Camera
      Parameters:
      time - The exposure duration in seconds.
      oscillation - The rotation of the crystal during an exposure in degrees.
      Returns:
      true for achievable.
      Throws:
      DeviceException
    • prepareForExposure

      public void prepareForExposure() throws DeviceException
      This must be called after setting the exposure parameters (by calling setImageAngle, setImageTime and setImageStart) and before expose. This move the omega axis to the correct position for its run-up before opening the shutter during the exposure.
      Specified by:
      prepareForExposure in interface Camera
      Throws:
      DeviceException
    • makeDetectorSafe

      public void makeDetectorSafe(boolean wait) throws DeviceException
      Description copied from interface: Camera
      Returns the detector to a safe distance from the crystal position. At the end of data collection this may well be done to allow easy access to the crystal mounting area, for manual or automatic crystal mounting.
      Specified by:
      makeDetectorSafe in interface Camera
      Parameters:
      wait - Whether to wait until the move is complete, true to wait.
      Throws:
      DeviceException
    • moveOmegaBy

      public void moveOmegaBy(double distance) throws DeviceException
      Description copied from interface: Camera
      Move the rotation axis's omega axis by an increment.
      Specified by:
      moveOmegaBy in interface Camera
      Parameters:
      distance - The required increment in degrees.
      Throws:
      DeviceException
    • moveDetectorTo

      public void moveDetectorTo(double distance) throws DeviceException
      Description copied from interface: Camera
      Moves the detector to achieve a required crystal to detector distance.
      Specified by:
      moveDetectorTo in interface Camera
      Parameters:
      distance - Required crystal to detector distance.
      Throws:
      DeviceException
    • moveOmegaTo

      public void moveOmegaTo(double position) throws DeviceException
      Description copied from interface: Camera
      Move the rotation axis's omega axis to a position.
      Specified by:
      moveOmegaTo in interface Camera
      Parameters:
      position - The required position in degrees.
      Throws:
      DeviceException
    • open

      public void open() throws DeviceException
      Description copied from interface: Camera
      Open the shutter.
      Specified by:
      open in interface Camera
      Throws:
      DeviceException
    • calculateMinimumExposeTime

      protected void calculateMinimumExposeTime()
      The minExposeTime calculated here really reflects the longest amount of time that an image would take to be collected if the motors and communications to trigger the moves are working normally.
    • getOverallTimePerPassFudgeFactor

      public double getOverallTimePerPassFudgeFactor()
      Returns the additional time to be added to the overall time per pass.
      Returns:
      the additional time
    • setOverallTimePerPassFudgeFactor

      public void setOverallTimePerPassFudgeFactor(double fudgeFactor)
      Sets the additional time to be added to the overall time per pass.
    • setDefaultSpeeds

      public void setDefaultSpeeds() throws DeviceException
      This should be called after an exposure to reset the omega motor parameters back to normal. This can also be called during a experiment emergency stop to ensure the beamline is returned to a known status.
      Specified by:
      setDefaultSpeeds in interface Camera
      Throws:
      DeviceException
    • setDefaultAccelerationTime

      public void setDefaultAccelerationTime(double defaultAccelCurve)
      Specified by:
      setDefaultAccelerationTime in interface MXCameraInterface
      Parameters:
      defaultAccelCurve -
    • setDefaultSpeed

      public void setDefaultSpeed(double defaultSpeed)
      Specified by:
      setDefaultSpeed in interface MXCameraInterface
      Parameters:
      defaultSpeed -
    • setDetectorSupportZName

      public void setDetectorSupportZName(String detectorSupportZName)
      Sets the name of the dof of the detector support z-axis
      Specified by:
      setDetectorSupportZName in interface MXCameraInterface
      Parameters:
      detectorSupportZName -
    • setExtraCloseTime

      public void setExtraCloseTime(double close)
      Sets the angular delay when stopping omega after the shutter has been closed
      Specified by:
      setExtraCloseTime in interface MXCameraInterface
      Parameters:
      close -
    • setExtraOpenTime

      public void setExtraOpenTime(double open)
      Sets the angular space factor to start the omega movement before the exposure start position
      Specified by:
      setExtraOpenTime in interface MXCameraInterface
      Parameters:
      open -
    • setImageAngularSize

      public void setImageAngularSize(double angle) throws DeviceException
      Description copied from interface: Camera
      Set the omega rotation during an exposure (in degrees).
      Specified by:
      setImageAngularSize in interface Camera
      Parameters:
      angle - Omega rotation during an exposure (in degrees).
      Throws:
      DeviceException
    • setImageStartAngle

      public void setImageStartAngle(double startPosition)
      Description copied from interface: Camera
      Set the starting angle of the exposure.
      Specified by:
      setImageStartAngle in interface Camera
      Parameters:
      startPosition - angle of the exposure (in degrees).
    • setImageTime

      public void setImageTime(double time) throws DeviceException
      Description copied from interface: Camera
      Set the total shutter open time during an exposure (in seconds).
      Specified by:
      setImageTime in interface Camera
      Parameters:
      time - Shutter open time during an exposure (in seconds).
      Throws:
      DeviceException
    • setNumberPasses

      public void setNumberPasses(int numPasses) throws DeviceException
      Description copied from interface: Camera
      Set the number of repeated passes across the oscillation range during an exposure. This is assumed to be 1 by default. If this number is greater than 1 then the exposure time for each pass is adjusted so that the total exposure time is that set by setImageTime.
      Specified by:
      setNumberPasses in interface Camera
      Parameters:
      numPasses -
      Throws:
      DeviceException
    • setOmegaDOFName

      public void setOmegaDOFName(String omegaDOFName)
      Sets the name of the omega dof
      Specified by:
      setOmegaDOFName in interface MXCameraInterface
      Parameters:
      omegaDOFName -
    • setSafeDistance

      public void setSafeDistance(double safeDistance)
      sets a safe distance for the detector to move to when users enter the hutch
      Specified by:
      setSafeDistance in interface MXCameraInterface
      Parameters:
      safeDistance -
    • setShutterCloseTime

      public void setShutterCloseTime(double delayClose)
      Sets the time to delay sending the shutter close signal before the omega rotation completes
      Specified by:
      setShutterCloseTime in interface MXCameraInterface
      Parameters:
      delayClose -
    • setShutterOpenTime

      public void setShutterOpenTime(double delayOpen)
      Sets the time to delay sending the shutter open signal before the omega gets to the start of the exposure
      Specified by:
      setShutterOpenTime in interface MXCameraInterface
      Parameters:
      delayOpen -
    • getOmegaAxisMultiplicationFactor

      public double getOmegaAxisMultiplicationFactor()
    • setOmegaAxisMultiplicationFactor

      public void setOmegaAxisMultiplicationFactor(double omegaAxisMultiplicationFactor)
    • isMoveTriggerToSafePosition

      public boolean isMoveTriggerToSafePosition()
    • setMoveTriggerToSafePosition

      public void setMoveTriggerToSafePosition(boolean moveTriggerToSafePosition)
    • getSafePosition

      public int getSafePosition()
      Get the current safe position for the goniometer during a data collection.
    • setSafePosition

      public void setSafePosition(int SafePosition)
      Set the safe position for the goniometer during a data collection.
    • setupOmegaForMove

      public void setupOmegaForMove() throws gov.aps.jca.TimeoutException, DeviceException
      Sets the shutter and movement parameters for the next exposure based on the values given by setImageStart/Angle/Time
      Specified by:
      setupOmegaForMove in interface MXCameraInterface
      Throws:
      gov.aps.jca.TimeoutException
      DeviceException
    • stopOmega

      public void stopOmega() throws DeviceException
      Description copied from interface: Camera
      Move any motion of the rotation axis's omega axis.
      Specified by:
      stopOmega in interface Camera
      Throws:
      DeviceException
    • update

      public void update(Object theObserved, Object changeCode)
      Specified by:
      update in interface gda.observable.IObserver
    • waitWhileExposing

      public void waitWhileExposing() throws DeviceException
      Description copied from interface: Camera
      Wait until the camera is no longer performing an exposure.
      Specified by:
      waitWhileExposing in interface Camera
      Throws:
      DeviceException
    • waitWhileMoving

      public void waitWhileMoving() throws DeviceException
      Description copied from interface: Camera
      Wait until all elements of the camera are no longer moving.
      Specified by:
      waitWhileMoving in interface Camera
      Throws:
      DeviceException
    • getOmegaReadbackPositions

      public Integer[] getOmegaReadbackPositions() throws DeviceException
      Specified by:
      getOmegaReadbackPositions in interface MXCameraInterface
      Returns:
      Integer[] of the omegaStartReadBack PV and omegaStopReadBack PV
      Throws:
      DeviceException
    • getTrigger

      public Trigger getTrigger()
    • setTrigger

      public void setTrigger(Trigger trigger)
    • getOmegaAxisController

      public ShutteredScannableMotor getOmegaAxisController()
    • setOmegaAxisController

      public void setOmegaAxisController(ShutteredScannableMotor omegaAxisController)
    • getOmegaMaxVelocity

      public OmegaMaxVelocity getOmegaMaxVelocity()
    • setOmegaMaxVelocity

      public void setOmegaMaxVelocity(OmegaMaxVelocity omegaMaxVelocity)
    • refreshOpenCloseAngles

      protected void refreshOpenCloseAngles()
    • refreshStartTimeFudgeFactor

      protected void refreshStartTimeFudgeFactor()
    • refreshEndTimeFudgeFactor

      protected void refreshEndTimeFudgeFactor()
    • refreshStartEndPositions

      protected void refreshStartEndPositions()
    • setAutoMode

      public void setAutoMode() throws DeviceException
      Throws:
      DeviceException
    • setAcceleration

      public void setAcceleration(double acceleration) throws DeviceException
      Description copied from interface: Camera
      Set the acceleration used for ramp up and ramp down in degrees/sec/sec
      Specified by:
      setAcceleration in interface Camera
      Parameters:
      acceleration -
      Throws:
      DeviceException
    • getAcceleration

      public double getAcceleration() throws DeviceException
      Description copied from interface: Camera
      Acceleration of rotation axis in degrees/sec/sec used for ramp up and ramp down.
      Specified by:
      getAcceleration in interface Camera
      Returns:
      acceleration in degrees/sec/sec
      Throws:
      DeviceException