Package org.openpnp.spi
Interface Machine
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,PropertySheetHolder
,Solutions.Subject
,WizardConfigurable
- All Known Implementing Classes:
AbstractMachine
,ReferenceMachine
,SimulationModeMachine
public interface Machine extends WizardConfigurable, PropertySheetHolder, java.io.Closeable, Solutions.Subject
Machine represents the pick and place machine itself. It provides the information and interface needed to cause the machine to do work. A Machine has one or more Heads. Unless otherwise noted, the methods in this class block while performing their operations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openpnp.spi.PropertySheetHolder
PropertySheetHolder.PropertySheet
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_TASK_BUSY_TIMEOUT_MS
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addActuator(Actuator actuator)
void
addAxis(Axis axis)
void
addCamera(Camera camera)
void
addDriver(Driver driver)
void
addFeeder(Feeder feeder)
void
addListener(MachineListener listener)
void
addNozzleTip(NozzleTip nozzleTip)
void
addSignaler(Signaler signaler)
default <T> T
execute(java.util.concurrent.Callable<T> callable)
Callsexecute(Callable, boolean, long, long)
with default busy timeout.default <T> T
execute(java.util.concurrent.Callable<T> callable, boolean onlyIfEnabled, long busyTimeout)
Callsexecute(Callable, boolean, long, long)
with default busy timeout.<T> T
execute(java.util.concurrent.Callable<T> callable, boolean onlyIfEnabled, long busyTimeout, long executeTimeout)
Execute a task to be run with access to the Machine.default <T> T
executeIfEnabled(java.util.concurrent.Callable<T> callable)
Same asexecute(Callable, boolean, long, long)
but the task is only executed if the Machine is enabled.Actuator
getActuator(java.lang.String id)
Get the Actuator attached to this Machine and not to a Head that has the specified id.Actuator
getActuatorByName(java.lang.String name)
java.util.List<Actuator>
getActuators()
Get a list of Actuators that are attached to this Machine and not to a Head.java.util.List<Actuator>
getAllActuators()
Gets a list of all Actuator attached to the Machine and to all the Heads.java.util.List<Camera>
getAllCameras()
Gets a list of all Cameras attached to the Machine and to all the Heads.java.util.List<Axis>
getAxes()
Gets a List of Axes attached to the Machine.Axis
getAxis(java.lang.String id)
Camera
getCamera(java.lang.String id)
java.util.List<Camera>
getCameras()
Gets a List of Cameras attached to the Machine that are not attached to Heads.java.util.List<java.lang.Class<? extends Actuator>>
getCompatibleActuatorClasses()
java.util.List<java.lang.Class<? extends Axis>>
getCompatibleAxisClasses()
java.util.List<java.lang.Class<? extends Camera>>
getCompatibleCameraClasses()
java.util.List<java.lang.Class<? extends Driver>>
getCompatibleDriverClasses()
java.util.List<java.lang.Class<? extends Feeder>>
getCompatibleFeederClasses()
java.util.List<java.lang.Class<? extends MotionPlanner>>
getCompatibleMotionPlannerClasses()
java.util.List<java.lang.Class<? extends Nozzle>>
getCompatibleNozzleClasses()
java.util.List<java.lang.Class<? extends Signaler>>
getCompatibleSignalerClasses()
Location
getDefaultBoardLocation()
Head
getDefaultHead()
Location
getDiscardLocation()
Driver
getDriver(java.lang.String id)
java.util.List<Driver>
getDrivers()
Gets a List of Drivers attached to the Machine.Feeder
getFeeder(java.lang.String id)
Feeder
getFeederByName(java.lang.String name)
java.util.List<Feeder>
getFeeders()
Gets a List of Feeders attached to the Machine.FiducialLocator
getFiducialLocator()
Head
getHead(java.lang.String id)
Head
getHeadByName(java.lang.String name)
java.util.List<Head>
getHeads()
Gets all active heads on the machine.boolean
getHomeAfterEnabled()
MotionPlanner
getMotionPlanner()
NozzleTip
getNozzleTip(java.lang.String id)
NozzleTip
getNozzleTipByName(java.lang.String name)
java.util.List<NozzleTip>
getNozzleTips()
Get a list of the NozzleTips currently attached to the Nozzle.java.util.List<PartAlignment>
getPartAlignments()
PnpJobProcessor
getPnpJobProcessor()
java.lang.Object
getProperty(java.lang.String name)
Signaler
getSignaler(java.lang.String id)
Signaler
getSignalerByName(java.lang.String name)
java.util.List<Signaler>
getSignalers()
Gets a List of Signalers attached to the Machine.double
getSpeed()
Length
getUnsafeZRoamingDistance()
Virtual Z axes (typically on cameras) are invisible, therefore it can easily be overlooked by users that it is at unsafe Z.void
home()
Commands all Heads to perform visual homing if available.boolean
isAutoLoadMostRecentJob()
boolean
isAutoToolSelect()
boolean
isBusy()
boolean
isEnabled()
Returns whether the Machine is currently ready for commands.boolean
isHomed()
Returns whether the Machine is homedboolean
isParkAfterHomed()
boolean
isPoolScriptingEngines()
boolean
isSafeZPark()
boolean
isTask(java.lang.Thread thread)
Determines whether the given thread is a task thread currently executed by the machine.void
permutateActuator(Actuator actuator, int direction)
void
permutateAxis(Axis axis, int direction)
void
permutateCamera(Camera driver, int direction)
void
permutateDriver(Driver driver, int direction)
void
removeActuator(Actuator actuator)
void
removeAxis(Axis axis)
void
removeCamera(Camera camera)
void
removeDriver(Driver driver)
void
removeFeeder(Feeder feeder)
void
removeListener(MachineListener listener)
void
removeNozzleTip(NozzleTip nozzleTip)
void
removeSignaler(Signaler signaler)
void
setEnabled(boolean enabled)
Attempts to bring the Machine to a ready state or attempts to immediately stop it depending on the value of enabled.void
setHomed(boolean homed)
void
setProperty(java.lang.String name, java.lang.Object value)
void
setSpeed(double speed)
java.util.concurrent.Future<java.lang.Object>
submit(java.lang.Runnable runnable)
<T> java.util.concurrent.Future<T>
submit(java.util.concurrent.Callable<T> callable)
<T> java.util.concurrent.Future<T>
submit(java.util.concurrent.Callable<T> callable, com.google.common.util.concurrent.FutureCallback<T> callback)
<T> java.util.concurrent.Future<T>
submit(java.util.concurrent.Callable<T> callable, com.google.common.util.concurrent.FutureCallback<T> callback, boolean ignoreEnabled)
Submit a task to be run with access to the Machine.-
Methods inherited from interface org.openpnp.spi.PropertySheetHolder
getChildPropertySheetHolders, getPropertySheetHolderActions, getPropertySheetHolderIcon, getPropertySheetHolderTitle, getPropertySheets
-
Methods inherited from interface org.openpnp.model.Solutions.Subject
findIssues, getSubjectIcon, getSubjectText
-
Methods inherited from interface org.openpnp.spi.WizardConfigurable
getConfigurationWizard
-
-
-
-
Field Detail
-
DEFAULT_TASK_BUSY_TIMEOUT_MS
static final long DEFAULT_TASK_BUSY_TIMEOUT_MS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAxes
java.util.List<Axis> getAxes()
Gets a List of Axes attached to the Machine.- Returns:
-
getAxis
Axis getAxis(java.lang.String id)
-
getHeads
java.util.List<Head> getHeads()
Gets all active heads on the machine.- Returns:
-
getHead
Head getHead(java.lang.String id)
-
getHeadByName
Head getHeadByName(java.lang.String name)
-
getSignalers
java.util.List<Signaler> getSignalers()
Gets a List of Signalers attached to the Machine.- Returns:
-
getSignaler
Signaler getSignaler(java.lang.String id)
-
getSignalerByName
Signaler getSignalerByName(java.lang.String name)
-
getFeeders
java.util.List<Feeder> getFeeders()
Gets a List of Feeders attached to the Machine.- Returns:
-
getFeeder
Feeder getFeeder(java.lang.String id)
-
getFeederByName
Feeder getFeederByName(java.lang.String name)
-
getCameras
java.util.List<Camera> getCameras()
Gets a List of Cameras attached to the Machine that are not attached to Heads.- Returns:
-
getAllCameras
java.util.List<Camera> getAllCameras()
Gets a list of all Cameras attached to the Machine and to all the Heads.- Returns:
-
getCamera
Camera getCamera(java.lang.String id)
-
getActuators
java.util.List<Actuator> getActuators()
Get a list of Actuators that are attached to this Machine and not to a Head.- Returns:
-
getAllActuators
java.util.List<Actuator> getAllActuators()
Gets a list of all Actuator attached to the Machine and to all the Heads.- Returns:
-
getActuator
Actuator getActuator(java.lang.String id)
Get the Actuator attached to this Machine and not to a Head that has the specified id.- Parameters:
id
-- Returns:
-
getActuatorByName
Actuator getActuatorByName(java.lang.String name)
-
getDrivers
java.util.List<Driver> getDrivers()
Gets a List of Drivers attached to the Machine.- Returns:
-
getDriver
Driver getDriver(java.lang.String id)
-
getMotionPlanner
MotionPlanner getMotionPlanner()
-
home
void home() throws java.lang.Exception
Commands all Heads to perform visual homing if available. Depending on the head configuration of the machine the home positions may not all be the same but the end result should be that any head commanded to move to a certain position will end up in the same position.- Throws:
java.lang.Exception
-
isEnabled
boolean isEnabled()
Returns whether the Machine is currently ready for commands.
-
isHomed
boolean isHomed()
Returns whether the Machine is homed
-
setEnabled
void setEnabled(boolean enabled) throws java.lang.Exception
Attempts to bring the Machine to a ready state or attempts to immediately stop it depending on the value of enabled. If true, this would include turning on motor drivers, turning on compressors, resetting solenoids, etc. If the Machine is unable to become ready for any reason it should throw an Exception explaining the reason. This method should block until the Machine is ready. After this method is called successfully, isEnabled() should return true unless the Machine encounters some error. If false, stops the machine and disables it as soon as possible. This may include turning off power to motors and stopping compressors. It is expected that the machine may need to be re-homed after this is called. If the Machine cannot be stopped for any reason, this method may throw an Exception explaining the reason but this should probably only happen in very extreme cases. This method should effectively be considered a software emergency stop. After this method returns, isEnabled() should return false until setEnabled(true) is successfully called again.- Throws:
java.lang.Exception
-
setHomed
void setHomed(boolean homed)
-
addListener
void addListener(MachineListener listener)
-
removeListener
void removeListener(MachineListener listener)
-
getCompatibleAxisClasses
java.util.List<java.lang.Class<? extends Axis>> getCompatibleAxisClasses()
-
getCompatibleFeederClasses
java.util.List<java.lang.Class<? extends Feeder>> getCompatibleFeederClasses()
-
getCompatibleCameraClasses
java.util.List<java.lang.Class<? extends Camera>> getCompatibleCameraClasses()
-
getCompatibleNozzleClasses
java.util.List<java.lang.Class<? extends Nozzle>> getCompatibleNozzleClasses()
-
getCompatibleActuatorClasses
java.util.List<java.lang.Class<? extends Actuator>> getCompatibleActuatorClasses()
-
getCompatibleSignalerClasses
java.util.List<java.lang.Class<? extends Signaler>> getCompatibleSignalerClasses()
-
getCompatibleDriverClasses
java.util.List<java.lang.Class<? extends Driver>> getCompatibleDriverClasses()
-
getCompatibleMotionPlannerClasses
java.util.List<java.lang.Class<? extends MotionPlanner>> getCompatibleMotionPlannerClasses()
-
addAxis
void addAxis(Axis axis) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeAxis
void removeAxis(Axis axis)
-
permutateAxis
void permutateAxis(Axis axis, int direction)
-
addDriver
void addDriver(Driver driver) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeDriver
void removeDriver(Driver driver)
-
permutateDriver
void permutateDriver(Driver driver, int direction)
-
addFeeder
void addFeeder(Feeder feeder) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeFeeder
void removeFeeder(Feeder feeder)
-
addSignaler
void addSignaler(Signaler signaler) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeSignaler
void removeSignaler(Signaler signaler)
-
addCamera
void addCamera(Camera camera) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeCamera
void removeCamera(Camera camera)
-
permutateCamera
void permutateCamera(Camera driver, int direction)
-
addActuator
void addActuator(Actuator actuator) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeActuator
void removeActuator(Actuator actuator)
-
permutateActuator
void permutateActuator(Actuator actuator, int direction)
-
getPnpJobProcessor
PnpJobProcessor getPnpJobProcessor()
-
submit
java.util.concurrent.Future<java.lang.Object> submit(java.lang.Runnable runnable)
-
submit
<T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> callable)
-
submit
<T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> callable, com.google.common.util.concurrent.FutureCallback<T> callback)
-
getHomeAfterEnabled
boolean getHomeAfterEnabled()
-
submit
<T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> callable, com.google.common.util.concurrent.FutureCallback<T> callback, boolean ignoreEnabled)
Submit a task to be run with access to the Machine. The submit() and execute() methods are the primary entry points into executing any blocking operation on the Machine. If you are doing anything that results in the Machine doing something it should happen here. With the submit() method, tasks can be cancelled and interrupted via the returned Future. Tasks which operate in a loop should check Thread.currentThread().isInterrupted(). When a task begins the MachineListeners are notified with machineBusy(true). When the task ends, if there are no more tasks to run then machineBusy(false) is called. TODO: When any task is running the driver for the machine is locked and any calls to the driver outside of the task will throw an Exception. If any tasks throws an Exception then all queued future tasks are cancelled. If a task includes a callback the callback is executed before the next task begins. TODO: By supplying a tag you can guarantee that there is only one of a certain type of task queued. Attempting to queue another task with the same tag will return null and the task will not be queued.- Parameters:
callable
-callback
-ignoreEnabled
- True if the task should execute even if the machine is not enabled. This is specifically for enabling the machine and should not typically be used elsewhere.
-
execute
<T> T execute(java.util.concurrent.Callable<T> callable, boolean onlyIfEnabled, long busyTimeout, long executeTimeout) throws java.lang.Exception
Execute a task to be run with access to the Machine. The submit() and execute() methods are the primary entry points into executing any blocking operation on the Machine. If you are doing anything that results in the Machine doing something it should happen here. With the execute() method, tasks are executed and waited for, rather than queued. If called from inside a machine task the execution is immediate. If called from a different thread, the task is submitted and then the calling thread will wait for completion. Return value and exceptions are always handled as if called directly.- Type Parameters:
T
-- Parameters:
callable
-onlyIfEnabled
- True if the task must only be executed if the machine is enabled.busyTimeout
- If the machine is busy executing other submitted task, the execution will be rejected when the timeout (in milliseconds) expires, throwing a TimeoutException. This will typically happen, when a long-running operation like a Job is pending.executeTimeout
- If the execution takes longer than this time (in milliseconds) the method throws a TimeoutException. Note the callable will still continue after that.- Returns:
- Throws:
java.lang.Exception
-
execute
default <T> T execute(java.util.concurrent.Callable<T> callable, boolean onlyIfEnabled, long busyTimeout) throws java.lang.Exception
Callsexecute(Callable, boolean, long, long)
with default busy timeout.- Throws:
java.lang.Exception
-
execute
default <T> T execute(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
Callsexecute(Callable, boolean, long, long)
with default busy timeout.- Type Parameters:
T
-- Parameters:
callable
-- Returns:
- Throws:
java.lang.Exception
-
executeIfEnabled
default <T> T executeIfEnabled(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
Same asexecute(Callable, boolean, long, long)
but the task is only executed if the Machine is enabled.- Type Parameters:
T
-- Parameters:
callable
-- Returns:
- Throws:
java.lang.Exception
-
isTask
boolean isTask(java.lang.Thread thread)
Determines whether the given thread is a task thread currently executed by the machine.- Parameters:
thread
-- Returns:
-
isBusy
boolean isBusy()
- Returns:
- True if a machine task is currently running/pending.
-
getDefaultHead
Head getDefaultHead() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getPartAlignments
java.util.List<PartAlignment> getPartAlignments()
-
getFiducialLocator
FiducialLocator getFiducialLocator()
-
getDiscardLocation
Location getDiscardLocation()
-
getDefaultBoardLocation
Location getDefaultBoardLocation()
-
setSpeed
void setSpeed(double speed)
-
getSpeed
double getSpeed()
-
getProperty
java.lang.Object getProperty(java.lang.String name)
-
setProperty
void setProperty(java.lang.String name, java.lang.Object value)
-
getNozzleTips
java.util.List<NozzleTip> getNozzleTips()
Get a list of the NozzleTips currently attached to the Nozzle.- Returns:
-
addNozzleTip
void addNozzleTip(NozzleTip nozzleTip) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeNozzleTip
void removeNozzleTip(NozzleTip nozzleTip)
-
getNozzleTip
NozzleTip getNozzleTip(java.lang.String id)
-
getNozzleTipByName
NozzleTip getNozzleTipByName(java.lang.String name)
-
isAutoToolSelect
boolean isAutoToolSelect()
- Returns:
- True if the tool in machine controls should be auto-selected based on targeted user action.
-
isSafeZPark
boolean isSafeZPark()
- Returns:
- True if the Z Park button should move all other HeadMountables to Safe Z.
-
isParkAfterHomed
boolean isParkAfterHomed()
- Returns:
- True if the machine heads should be parked after the machine was homed.
-
getUnsafeZRoamingDistance
Length getUnsafeZRoamingDistance()
Virtual Z axes (typically on cameras) are invisible, therefore it can easily be overlooked by users that it is at unsafe Z. When they later press the Move tool to camera location button, an unexpected Z down-move will result, potentially crashing the tool. The maximum allowable roaming distance at unsafe Z therefore limits the jogging area within which an unsafe virtual Z is kept. It should be enough to fine-adjust a captured location, but jogging further away will automatically move the virtual axis to Safe Z.- Returns:
- Maximum allowable roaming distance at unsafe Z.
-
isPoolScriptingEngines
boolean isPoolScriptingEngines()
- Returns:
- True if scripting engines should be pooled for faster reuse.
-
isAutoLoadMostRecentJob
boolean isAutoLoadMostRecentJob()
- Returns:
- True if automatic loading of most recent job at start has been enabled.
-
-