Package org.openpnp.spi
Interface Driver
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,Identifiable
,Named
,PropertySheetHolder
,Solutions.Subject
,WizardConfigurable
- All Known Implementing Classes:
AbstractDriver
,AbstractReferenceDriver
,GcodeAsyncDriver
,GcodeDriver
,NeoDen4Driver
,NullDriver
public interface Driver extends Identifiable, Named, java.io.Closeable, WizardConfigurable, PropertySheetHolder, Solutions.Subject
Defines the interface for a driver that the MotionPlanner can drive. All methods result in machine operations and most methods should block until they are complete or throw an error. This Driver interface is intended to talk to one controller with Axes and Actuators attached. Drivers should only expose the functionality of the controller in a unified way. They should not add additional logic other than what is needed to make an attached controller behave like any other. This is different from previous versions of OpenPnP where the driver did much more.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Driver.MotionControlType
The MotionControlType determines how the OpenPnP MotionPlanner will do its planning and how it will talk to the controller.-
Nested classes/interfaces inherited from interface org.openpnp.spi.PropertySheetHolder
PropertySheetHolder.PropertySheet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
actuate(Actuator actuator, boolean on)
Actuates a machine defined object with a boolean state.void
actuate(Actuator actuator, double value)
Actuates a machine defined object with a double value.default void
actuate(Actuator actuator, java.lang.String value)
Actuates a machine defined object with a String value.default java.lang.String
actuatorRead(Actuator actuator)
Read a String value from the given Actuator.default java.lang.String
actuatorRead(Actuator actuator, java.lang.Object parameter)
Read a given String value from the given Actuator.Length
getFeedRatePerSecond()
default java.lang.Integer
getInterpolationJerkSteps()
default java.lang.Integer
getInterpolationMaxSteps()
default java.lang.Integer
getInterpolationMinStep()
default java.lang.Double
getInterpolationTimeStep()
default Length
getJunctionDeviation()
Length
getMinimumRate(int order)
Driver.MotionControlType
getMotionControlType()
AxesLocation
getReportedLocation(long timeout)
Get the momentary real-time location from the controller.LengthUnit
getUnits()
void
home(Machine machine)
Perform the hardware homing operation.default boolean
isAllowUnhomedMotion()
boolean
isMotionPending()
boolean
isSupportingPreMove()
boolean
isSyncInitialLocation()
boolean
isUsingLetterVariables()
void
moveTo(HeadMountable hm, Motion.MoveToCommand moveToCommand)
Executes the given Motion.void
setEnabled(boolean enabled)
Attempts to enable the Driver, turning on all outputs.void
setGlobalOffsets(Machine machine, AxesLocation axesLocation)
Set the current physical axis positions to be reinterpreted as the specified coordinates.void
waitForCompletion(HeadMountable hm, MotionPlanner.CompletionType completionType)
Perform a coordinated wait for completion.-
Methods inherited from interface org.openpnp.model.Identifiable
getId
-
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
-
-
-
-
Method Detail
-
getUnits
LengthUnit getUnits()
- Returns:
- The LengthUnit used by the controller that is driven by this driver.
-
home
void home(Machine machine) throws java.lang.Exception
Perform the hardware homing operation. When this completes the axes should be at their homing location. The call might return before this physically happens, so a waitForCompletion() is needed if you need to be sure.- Parameters:
machine
-- Throws:
java.lang.Exception
-
setGlobalOffsets
void setGlobalOffsets(Machine machine, AxesLocation axesLocation) throws java.lang.Exception
Set the current physical axis positions to be reinterpreted as the specified coordinates. Used after visual homing and to reset a rotation angle after it has wrapped around. In G-Code parlance this is setting a global offset:- Parameters:
machine
-axesLocation
-- Throws:
java.lang.Exception
-
moveTo
void moveTo(HeadMountable hm, Motion.MoveToCommand moveToCommand) throws java.lang.Exception
Executes the given Motion.- Parameters:
hm
- The HeadMountable having triggered the move. This is mostly for proprietary machine driver support and might only be a stand-in in some motion blending scenarios.moveToCommand
- The moveTo Motion to execute, including target location and limits for feedrate, acceleration etc. as shaped by the MotionPlanner- Throws:
java.lang.Exception
-
getReportedLocation
AxesLocation getReportedLocation(long timeout) throws java.lang.Exception
Get the momentary real-time location from the controller. This might be in mid-motion.- Parameters:
timeout
- TODO- Returns:
- Throws:
java.lang.Exception
-
isSyncInitialLocation
boolean isSyncInitialLocation()
- Returns:
- true if the driver should synchronize its initial position after enabling.
-
isAllowUnhomedMotion
default boolean isAllowUnhomedMotion()
- Returns:
- true if the driver allows motion on an unhomed machine.
-
isMotionPending
boolean isMotionPending()
- Returns:
- true if a motion is still assumed to be pending, i.e. waitForCompletion() has not yet been called.
-
waitForCompletion
void waitForCompletion(HeadMountable hm, MotionPlanner.CompletionType completionType) throws java.lang.Exception
Perform a coordinated wait for completion. This must be issued before capturing camera frames etc.- Parameters:
hm
- The HeadMountable to wait for. If null, wait for all the axes on the driver. Most drivers/controllers will probably not be able to wait for just a sub-set of axes, so the'll wait for all the axes anyway.completionType
- The kind of completion wanted.- Throws:
java.lang.Exception
-
actuate
void actuate(Actuator actuator, boolean on) throws java.lang.Exception
Actuates a machine defined object with a boolean state.- Parameters:
actuator
-on
-- Throws:
java.lang.Exception
-
actuate
void actuate(Actuator actuator, double value) throws java.lang.Exception
Actuates a machine defined object with a double value.- Parameters:
actuator
-value
-- Throws:
java.lang.Exception
-
actuate
default void actuate(Actuator actuator, java.lang.String value) throws java.lang.Exception
Actuates a machine defined object with a String value.- Parameters:
actuator
-value
-- Throws:
java.lang.Exception
-
actuatorRead
default java.lang.String actuatorRead(Actuator actuator) throws java.lang.Exception
Read a String value from the given Actuator.- Parameters:
actuator
-- Returns:
- Throws:
java.lang.Exception
-
actuatorRead
default java.lang.String actuatorRead(Actuator actuator, java.lang.Object parameter) throws java.lang.Exception
Read a given String value from the given Actuator.- Parameters:
actuator
-parameter
-- Returns:
- Throws:
java.lang.Exception
-
setEnabled
void setEnabled(boolean enabled) throws java.lang.Exception
Attempts to enable the Driver, turning on all outputs.- Parameters:
enabled
-- Throws:
java.lang.Exception
-
isSupportingPreMove
boolean isSupportingPreMove()
-
isUsingLetterVariables
boolean isUsingLetterVariables()
-
getMotionControlType
Driver.MotionControlType getMotionControlType()
- Returns:
- The MotionControlType that determines how the OpenPnP MotionPlanner will do its planning and how it will talk to the controller.
-
getFeedRatePerSecond
Length getFeedRatePerSecond()
- Returns:
- A driver specific feed-rate limit, applied in addition to axis feed-rate limits and according to NIST RS274NGC Interpreter - Version 3, Section 2.1.2.5 (p. 7). Given per second (will be converted to the standard per minute rate when using Gcode F values).
-
getInterpolationMaxSteps
default java.lang.Integer getInterpolationMaxSteps()
- Returns:
- The maximum number of interpolation steps that should be applied to simulate more advanced motion control. Usually depends on the depth of the look-ahead motion planner queue inside the controller.
-
getInterpolationJerkSteps
default java.lang.Integer getInterpolationJerkSteps()
- Returns:
- The maximum number of interpolation steps that should be applied to simulate jerk control per acceleration/deceleration ramp. Should be much less than getInterpolationMaxSteps().
-
getInterpolationTimeStep
default java.lang.Double getInterpolationTimeStep()
- Returns:
- The minimal time step that should be used to simulate more advanced motion control.
-
getInterpolationMinStep
default java.lang.Integer getInterpolationMinStep()
- Returns:
- The minimal interpolation step distance, given in resolution ticks (i.e. usually micro-steps) of the axes.
-
getJunctionDeviation
default Length getJunctionDeviation()
-
getMinimumRate
Length getMinimumRate(int order)
- Parameters:
order
- Derivative order, velocity (1), acceleration (2), jerk (3)- Returns:
- The minimum velocity, acceleration, jerk the driver supports. Used to prevent "rounded to zero" errors in decimal formatting and interpolation.
-
-