public abstract class AbstractMotionPath extends java.lang.Object implements java.lang.Iterable<MotionProfile[]>
Modifier and Type | Field and Description |
---|---|
protected static int |
segments |
Constructor and Description |
---|
AbstractMotionPath() |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
controlOvershoot(MotionProfile[] prevProfiles,
MotionProfile[] entryProfiles,
MotionProfile[] exitProfiles,
MotionProfile[] nextProfiles,
int axis,
MotionProfile solverProfile,
double approximation,
int iteration)
Helper for the optimizer: reduces excess overshoot into uncoordinated moves.
|
abstract MotionProfile[] |
get(int i) |
java.util.Iterator<MotionProfile[]> |
iterator() |
abstract int |
size() |
void |
solve() |
void |
solve(double approximation,
int iterations)
Simplified "PnP use case" heuristics for continuous smoothed motion path optimization.
|
void |
toSvg(java.lang.String title,
double zr) |
void |
validate(java.lang.String title)
Validate the path for seamless continuity.
|
protected static final int segments
public abstract int size()
public abstract MotionProfile[] get(int i)
public java.util.Iterator<MotionProfile[]> iterator()
iterator
in interface java.lang.Iterable<MotionProfile[]>
public void solve() throws java.lang.Exception
java.lang.Exception
public void solve(double approximation, int iterations) throws java.lang.Exception
The solver can find a partially optimized path for the typical moveToLocationAtSaveZ() moving pattern of OpenPnP. It will gracefully revert to unoptimized moving when confronted with more complex motion sequences.
Moves are distinguished to be coordinated or not. A coordinated move follows a strict straight line from A to B while an uncoordinated moves may stray from that line to allow for a more smoothed-out motion. OpenPnP will handle all below Safe Z moves as coordinated, while handling everything within the Safe Z zone as uncoordinated.Code may override this default heuristic.
Subsequent straight coordinated moves are combined into one. Coordinated moves will overshoot into uncoordinated moves to smooth the path. The path is then iteratively refined to reduce overshooting where it is wasteful. However this is done in a very crude form with very few iterations to keep computation times useful. Subsequent uncoordinated moves are not yet optimized, i.e. corners are not smoothed-out. These moves are rare in OpenPnP.
The heuristics works as follows:
approximation
- Determines by what rate it should approximate the estimated best solution, per iteration.iterations
- How many iterations should be computed.java.lang.Exception
protected static boolean controlOvershoot(MotionProfile[] prevProfiles, MotionProfile[] entryProfiles, MotionProfile[] exitProfiles, MotionProfile[] nextProfiles, int axis, MotionProfile solverProfile, double approximation, int iteration)
public void validate(java.lang.String title) throws java.lang.Exception
title
- java.lang.Exception
public void toSvg(java.lang.String title, double zr)