Class LaterationSolver<P extends com.irurueta.geometry.Point<?>>
java.lang.Object
com.irurueta.navigation.lateration.LaterationSolver<P>
- Type Parameters:
P- aPointtype.
- Direct Known Subclasses:
HomogeneousLinearLeastSquaresLaterationSolver,InhomogeneousLinearLeastSquaresLaterationSolver,NonLinearLeastSquaresLaterationSolver
Solves the lateration problem.
This is a formulation for a nonlinear least squares optimizer.
This class is base on the implementation found at:
https://github.com/lemmingapex/trilateration
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double[]Euclidean distances from static nodes to mobile node.static final doubleMinimum allowed distance for a given circle or sphere.protected double[]Estimated inhomogeneous position coordinates.protected LaterationSolverListener<P> Listener to be notified of events raised by this instance.protected booleanIndicates if this instance is locked because lateration is being solved.protected P[]Known positions of static nodes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedLaterationSolver(LaterationSolverListener<P> listener) Constructor.protectedLaterationSolver(P[] positions, double[] distances) Constructor.protectedLaterationSolver(P[] positions, double[] distances, LaterationSolverListener<P> listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]Gets euclidean distances from static nodes to mobile node.abstract PGets estimated position.voidgetEstimatedPosition(P estimatedPosition) Gets estimated position and stores result into provided instance.double[]Gets estimated inhomogeneous position coordinates.Gets listener to be notified of events raised by this instance.abstract intMinimum required number of positions and distances.abstract intGets number of dimensions of provided points.P[]Gets known positions of static nodes.abstract LaterationSolverTypegetType()Gets lateration solver type.protected voidinternalSetPositionsAndDistances(P[] positions, double[] distances) Internally sets known positions and Euclidean distances.booleanisLocked()Returns boolean indicating if solver is locked because estimation is under progress.booleanisReady()Indicates whether solver is ready to find a solution.voidsetListener(LaterationSolverListener<P> listener) Sets listener to be notified of events raised by this instance.voidsetPositionsAndDistances(P[] positions, double[] distances) Sets known positions and Euclidean distances.abstract voidsolve()Solves the lateration problem.
-
Field Details
-
EPSILON
public static final double EPSILONMinimum allowed distance for a given circle or sphere.- See Also:
-
positions
Known positions of static nodes. -
distances
protected double[] distancesEuclidean distances from static nodes to mobile node. -
listener
Listener to be notified of events raised by this instance. -
estimatedPositionCoordinates
protected double[] estimatedPositionCoordinatesEstimated inhomogeneous position coordinates. -
locked
protected boolean lockedIndicates if this instance is locked because lateration is being solved.
-
-
Constructor Details
-
LaterationSolver
protected LaterationSolver()Constructor. -
LaterationSolver
Constructor. Sets known positions and Euclidean distances.- Parameters:
positions- known positions of static nodes.distances- euclidean distances from static nodes to mobile node.- Throws:
IllegalArgumentException- if either positions or distances are null, don't have the same length or their length is smaller than required (3 for 2D points or 4 for 3D points).
-
-
Method Details
-
getListener
Gets listener to be notified of events raised by this instance.- Returns:
- listener to be notified of events raised by this instance.
-
getPositions
Gets known positions of static nodes.- Returns:
- known positions of static nodes.
-
getDistances
public double[] getDistances()Gets euclidean distances from static nodes to mobile node.- Returns:
- euclidean distances from static nodes to mobile node.
-
isReady
public boolean isReady()Indicates whether solver is ready to find a solution.- Returns:
- true if solver is ready, false otherwise.
-
isLocked
public boolean isLocked()Returns boolean indicating if solver is locked because estimation is under progress.- Returns:
- true if solver is locked, false otherwise.
-
setPositionsAndDistances
Sets known positions and Euclidean distances. If any distance value is zero or negative, it will be fixed assuming an EPSILON value.- Parameters:
positions- known positions of static nodes.distances- euclidean distances from static nodes to mobile node.- Throws:
IllegalArgumentException- if either positions or distances are null, don't have the same length or their length is smaller than required (2 points).LockedException- if instance is busy solving the lateration problem.
-
getEstimatedPositionCoordinates
public double[] getEstimatedPositionCoordinates()Gets estimated inhomogeneous position coordinates.- Returns:
- estimated inhomogeneous position coordinates.
-
getEstimatedPosition
Gets estimated position and stores result into provided instance.- Parameters:
estimatedPosition- instance where estimated position will be stored.
-
getEstimatedPosition
Gets estimated position.- Returns:
- estimated position.
-
getNumberOfDimensions
public abstract int getNumberOfDimensions()Gets number of dimensions of provided points.- Returns:
- number of dimensions of provided points.
-
solve
Solves the lateration problem.- Throws:
LaterationException- if lateration fails.NotReadyException- is solver is not ready.LockedException- if instance is busy solving the lateration problem.
-
getType
Gets lateration solver type.- Returns:
- lateration solver type.
-
getMinRequiredPositionsAndDistances
public abstract int getMinRequiredPositionsAndDistances()Minimum required number of positions and distances. This value will depend on actual implementation and whether we are solving a 2D or 3D problem.- Returns:
- minimum required number of positions and distances.
-
internalSetPositionsAndDistances
Internally sets known positions and Euclidean distances. If any distance value is zero or negative, it will be fixed assuming an EPSILON value.- Parameters:
positions- known positions of static nodes.distances- euclidean distances from static nodes to mobile node.- Throws:
IllegalArgumentException- if either positions or distances are null, don't have the same length or their length is smaller than required (2 points).
-