Package gda.px.sampleChanger
Class JCameramanController
java.lang.Object
gda.px.sampleChanger.JCameramanController
- All Implemented Interfaces:
PropertyChangeListener,EventListener,rigaku.jcameraman.RobotListener
public class JCameramanController
extends Object
implements rigaku.jcameraman.RobotListener, PropertyChangeListener
Operates the JCameraman api for Rigaku/MSC sample changers. The methods are intended to be thread safe so that only
one command may be operated at a time. However the methods are run asynchronously. To wait for the command to be
completed, call waitWhileBusy.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassExceptions to be thrown by this class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanflag to prevent waitWhileBusy from returningbooleanflag to say if robot will return to the soak position after mount/unmount -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Actor panic stop.voidaddEventCompleteObservers(IJCameramanObserver newObserver) Add an observer of asynchronous events this class creates.voidanneal(int time) If a sample is at the sample position, then this anneals that sample.voidcloseDewar(int dewarNumber) Calls close lid on the api which automatically centres the lidvoidvoiddismount(int dewar, int magazine, int position) voidDismounts the current special pin.voiddispose()If a sample is at the sample position, then this disposes of that sample.voiddry(boolean wait) Dries the end effector.voidexchange(int oldDewar, int oldMagazine, int oldPosition, int newDewar, int newMagazine, int newPosition) static JCameramanControllerint[]intintint[]rigaku.jcameraman.RobotClient.RobotLocationReturns the enumneration value of the current robot location as understood by the Java side of the Rigaku api.voidgotoWait()Move the robot to the wait position.voidhome()Homes the sample positionervoidinitialiseRobotClient(String host) Make the connection to the robot, (re)initialises it and does a pin check.voidintialiseCameraClient(String host) Creates the connection to the camera and homes the sample positionervoidInitialises OSCARbooleanbooleanbooleanvoidmount(int dewar, int magazine, int position) voidmountSpecialPin(Integer pin) Mounts a special pin.voidmove(boolean absolute, int x, int y, int z) Moves the sample positioner.voidmove(int oldDewar, int oldMagazine, int oldPosition, int newDewar, int newMagazine, int newPosition) voidoscarInventory(String path) Performs an inventory and saves the information in an xml file.voidoscarRetrievePlate(int cassette, int plate) voidoscarRetrievePlate(String barcode) voidoscarStorePlate(int iCassette, int iPlate) Store the plate in the given positionvoidvoidrobotCommandCompleted(rigaku.jcameraman.RobotEvent event) voidsetMountedPin(int dewar, int magazine, int position) Tells the robot the identity of the mounted pin.voidsetSoakAfterOperation(boolean soakAfterOperation) voidsoak(int dewarNumber) Soak the end effector.voidA version of waitWhileBusy that does not check for an error state in the robot.voidHold up the current string until a robot command has been received.
-
Field Details
-
soakAfterOperation
public boolean soakAfterOperationflag to say if robot will return to the soak position after mount/unmount -
robotBusy
protected volatile boolean robotBusyflag to prevent waitWhileBusy from returning
-
-
Method Details
-
getInstance
- Returns:
- the static instance of this object
-
isRobotClientInitialised
public boolean isRobotClientInitialised() -
isCameraClientInitialised
public boolean isCameraClientInitialised()- Returns:
- true if the robot has been initialised, so the sample positioner motors can be operated.
-
closedown
public void closedown() -
initialiseRobotClient
Make the connection to the robot, (re)initialises it and does a pin check.- Parameters:
host-- Throws:
JCameramanController.JCameramanException
-
intialiseCameraClient
Creates the connection to the camera and homes the sample positionerIf reading barcodes then ensure the following is in the Cameraman config:
BarCodePort = 4
BarCodeTimeOut = 2
- Parameters:
host-- Throws:
JCameramanController.JCameramanException
-
intialiseOscarClient
Initialises OSCAR -
getCommandError
- Returns:
- String - the latest error code
-
abort
Actor panic stop. Robot software will require re-initialisation after calling this method. -
anneal
If a sample is at the sample position, then this anneals that sample.- Parameters:
time-- Throws:
JCameramanController.JCameramanException
-
closeDewar
Calls close lid on the api which automatically centres the lid -
dispose
If a sample is at the sample position, then this disposes of that sample. -
gotoWait
Move the robot to the wait position. This should be used when something has gone wrong but does not require re-initialising the robot. -
getRobotLocation
public rigaku.jcameraman.RobotClient.RobotLocation getRobotLocation() throws JCameramanController.JCameramanExceptionReturns the enumneration value of the current robot location as understood by the Java side of the Rigaku api. So this value might be out of date if there has been some comm failure.NB: SAFE means the location hovering above an open dewar keeping the end effector cool. WAIT means the location where the robot normally rests when not in use.
- Returns:
- RobotLocation
- Throws:
JCameramanController.JCameramanException
-
setSoakAfterOperation
public void setSoakAfterOperation(boolean soakAfterOperation) throws JCameramanController.JCameramanException - Parameters:
soakAfterOperation-- Throws:
JCameramanController.JCameramanException- See Also:
-
getBarcode
- Returns:
- String - the barcode of the sample mounted during the last load/exchange operation.
- Throws:
JCameramanController.JCameramanException
-
getPosition
- Returns:
- int[] - the position of the sample positioner
- Throws:
JCameramanController.JCameramanException
-
home
Homes the sample positioner -
move
public void move(boolean absolute, int x, int y, int z) throws JCameramanController.JCameramanException, IllegalArgumentException Moves the sample positioner. It is limited to 5mm movement, so has fixed limits of +/- 2500 um on all axes.- Parameters:
absolute-x-y-z-- Throws:
JCameramanController.JCameramanExceptionIllegalArgumentException
-
getMountedPin
-
soak
Soak the end effector. -
mount
public void mount(int dewar, int magazine, int position) throws JCameramanController.JCameramanException - Parameters:
dewar-magazine-position-- Throws:
JCameramanController.JCameramanException
-
mountSpecialPin
Mounts a special pin.- Parameters:
pin-- Throws:
JCameramanController.JCameramanException
-
exchange
public void exchange(int oldDewar, int oldMagazine, int oldPosition, int newDewar, int newMagazine, int newPosition) throws JCameramanController.JCameramanException - Parameters:
oldDewar-oldMagazine-oldPosition-newDewar-newMagazine-newPosition-- Throws:
JCameramanController.JCameramanException
-
dry
Dries the end effector.- Parameters:
wait-- Throws:
JCameramanController.JCameramanException
-
dismount
public void dismount(int dewar, int magazine, int position) throws JCameramanController.JCameramanException - Parameters:
dewar-magazine-position-- Throws:
JCameramanController.JCameramanException
-
dismountSpecialPin
Dismounts the current special pin. -
setMountedPin
public void setMountedPin(int dewar, int magazine, int position) throws JCameramanController.JCameramanException Tells the robot the identity of the mounted pin.- Parameters:
dewar-magazine-position-- Throws:
JCameramanController.JCameramanException
-
move
public void move(int oldDewar, int oldMagazine, int oldPosition, int newDewar, int newMagazine, int newPosition) throws JCameramanController.JCameramanException -
getImageBySocket
- Returns:
- Image - the latest image from the camera
- Throws:
JCameramanController.JCameramanException
-
getOscarPlate
- Returns:
- int - current Oscar plate number
- Throws:
JCameramanController.JCameramanException
-
getOscarCassette
- Returns:
- int - cassette of the current plate
- Throws:
JCameramanController.JCameramanException
-
oscarStorePlate
public void oscarStorePlate(int iCassette, int iPlate) throws JCameramanController.JCameramanException Store the plate in the given position- Parameters:
iCassette-iPlate-- Throws:
JCameramanController.JCameramanException
-
oscarRetrievePlate
public void oscarRetrievePlate(int cassette, int plate) throws JCameramanController.JCameramanException - Parameters:
cassette-plate-- Throws:
JCameramanController.JCameramanException
-
oscarRetrievePlate
- Parameters:
barcode-- Throws:
JCameramanController.JCameramanException
-
oscarInventory
Performs an inventory and saves the information in an xml file.- Parameters:
path-- Throws:
JCameramanController.JCameramanException
-
robotCommandCompleted
public void robotCommandCompleted(rigaku.jcameraman.RobotEvent event) - Specified by:
robotCommandCompletedin interfacerigaku.jcameraman.RobotListener
-
addEventCompleteObservers
Add an observer of asynchronous events this class creates.- Parameters:
newObserver-
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
waitWhileBusy
Hold up the current string until a robot command has been received. This should be called after every asynchronous command called. This will throw an exception if the command failed (apart from calls to update the status) -
waitWhileAPIBusy
public void waitWhileAPIBusy()A version of waitWhileBusy that does not check for an error state in the robot. This should be called if you are not interested in the state of the robot, just if it is free to try a command.This is useful for recovering from errors; by using this method to test if the robot is busy, then running a command but ignoring the state of the robot.
-
isRobotAPIBusy
public boolean isRobotAPIBusy()- Returns:
- true if a command has been started but no command completed message received from Cameraman.
-