public interface MotionPlanner extends PropertySheetHolder, Solutions.Subject
The MotionPlanner coordinates motion, homing etc. across multiple drivers. It has a similar interface as the drivers themselves and acts as a black box to abstract from the complexities of multiple, mixed drivers.
In OpenPnP, the Head does not move on it's own. It is moved by the moving of attached objects: Nozzles, Cameras, Actuators, so-called HeadMountables. The HeadMountables specify by which axes they are moved. The axes are in turn assigned to the Driver. When you move a HeadMountable the MotionPlanner will determine which axes are involved and call the drivers accordingly.
The Motion planner may also perform advanced motion planning i.e. it might reorder, blend and interpolate the original moveTo() commands in order to improve performance, reduce machine vibrations etc.
These are the most important tasks:
A MotionPlanner can be a simple proxy, just sending commands directly to the drivers. See the NullMotionPlanner. Future advanced MotionPlanners can do nth order Kinematics control, motion blending etc.
The MotionPlanner is an envelope planner i.e. it will only plan the maximum velocity, acceleration, jerk allowed to the controller. It is not a real-time planner, therefore the real physical motion that is later executed by the controller, might be more constrained i.e. take more time. Having said that, it remains a goal to anticipate the controller's motion as good as possible, so that simulation and reality will be very similar and optimizations are purposeful.
An advanced Planner will first record the commands and it may (or may not yet) plan the moves. A waitForCompletion() will force the planning and generate the needed output commands. Note that proper envelope motion control is only possible for complete moves, because the the planner must know when to decelerate in time.
Sometimes, motion might be recorded but no immediate waitForCompletion() is wanted. The most prominent example is jogging, where the planner never knows if and when the user will press another button. In this case up-front envelope motion planning is impossible, at least for the deceleration part. Therefore motion control is mostly left to the hardware controller, perhaps with more conservative deceleration parameters.
The MotionPlanner must plan all the Axes of the machine, across all the Drivers. Therefore driver/controller specific behavior must be modeled per Axis. The MotionPlanner should also try to approximate coordinated motion across controllers. A best-effort approximation should be enough for PnP purposes.
Unless Length and Location are used, units are Millimeters and Seconds.
Modifier and Type | Interface and Description |
---|---|
static class |
MotionPlanner.CompletionType |
PropertySheetHolder.PropertySheet
Modifier and Type | Method and Description |
---|---|
void |
clearMotionPlanOlderThan(double time)
Clear the motion planning older than the given real-time from the history of the motion planner.
|
Motion |
getLastMotion()
Get the last planned motion with displacement of axes.
|
double |
getMinimumSpeed() |
Motion |
getMomentaryMotion(double time)
Get the planned motion at a certain time.
|
void |
home()
Perform the homing operation.
|
boolean |
isValidLocation(HeadMountable hm,
AxesLocation axesLocation) |
void |
moveTo(HeadMountable hm,
AxesLocation axesLocation,
double speed,
Motion.MotionOption... options)
Add a nominal moveTo() command to the motion sequence.
|
void |
setGlobalOffsets(AxesLocation axesLocation)
Set the current physical or virtual axis positions to be reinterpreted as the specified coordinates.
|
void |
waitForCompletion(HeadMountable hm,
MotionPlanner.CompletionType completionType)
Perform a coordinated wait for completion.
|
getChildPropertySheetHolders, getPropertySheetHolderActions, getPropertySheetHolderIcon, getPropertySheetHolderTitle, getPropertySheets
findIssues, getSubjectIcon, getSubjectText
void home() throws java.lang.Exception
java.lang.Exception
void setGlobalOffsets(AxesLocation axesLocation) throws java.lang.Exception
machine
- axesLocation
- java.lang.Exception
http://www.linuxcnc.org/docs/html/gcode/coordinates.html#_the_g92_commands
,
http://smoothieware.org/g92-cnc
,
https://github.com/synthetos/TinyG/wiki/Coordinate-Systems#offsets-to-the-offsets-g92
void moveTo(HeadMountable hm, AxesLocation axesLocation, double speed, Motion.MotionOption... options) throws java.lang.Exception
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.axesLocation
- speed
- options
- java.lang.Exception
void waitForCompletion(HeadMountable hm, MotionPlanner.CompletionType completionType) throws java.lang.Exception
hm
- The HeadMountable to wait for. If a hm's axes map to only a sub-set of drivers, this will not
wait for the other drivers and these are free to move on. If null, wait for all the drivers/machine axes.completionType
- The kind of completion wanted.java.lang.Exception
Motion getMomentaryMotion(double time)
time
- Motion getLastMotion()
void clearMotionPlanOlderThan(double time)
time
- The start time of the motion to keep. This must be a time returned by waitForCompletion().boolean isValidLocation(HeadMountable hm, AxesLocation axesLocation)
hm
- axesLocation
- double getMinimumSpeed()