Class LaterationSolver<P extends com.irurueta.geometry.Point<?>>
java.lang.Object
com.irurueta.navigation.lateration.LaterationSolver<P>
- Type Parameters:
P
- aPoint
type.
- 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 double
Minimum 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 boolean
Indicates if this instance is locked because lateration is being solved.protected P[]
Known positions of static nodes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor.protected
LaterationSolver
(LaterationSolverListener<P> listener) Constructor.protected
LaterationSolver
(P[] positions, double[] distances) Constructor.protected
LaterationSolver
(P[] positions, double[] distances, LaterationSolverListener<P> listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
Gets euclidean distances from static nodes to mobile node.abstract P
Gets estimated position.void
getEstimatedPosition
(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 int
Minimum required number of positions and distances.abstract int
Gets number of dimensions of provided points.P[]
Gets known positions of static nodes.abstract LaterationSolverType
getType()
Gets lateration solver type.protected void
internalSetPositionsAndDistances
(P[] positions, double[] distances) Internally sets known positions and Euclidean distances.boolean
isLocked()
Returns boolean indicating if solver is locked because estimation is under progress.boolean
isReady()
Indicates whether solver is ready to find a solution.void
setListener
(LaterationSolverListener<P> listener) Sets listener to be notified of events raised by this instance.void
setPositionsAndDistances
(P[] positions, double[] distances) Sets known positions and Euclidean distances.abstract void
solve()
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).
-