Class PROSACRobustLateration2DSolver

java.lang.Object
com.irurueta.navigation.lateration.RobustLaterationSolver<com.irurueta.geometry.Point2D>
com.irurueta.navigation.lateration.RobustLateration2DSolver
com.irurueta.navigation.lateration.PROSACRobustLateration2DSolver

public class PROSACRobustLateration2DSolver extends RobustLateration2DSolver
Robustly solves the lateration problem by finding the best pairs of 2D positions and distances among the provided ones using PROSAC algorithm to discard outliers.
  • Field Details

    • DEFAULT_THRESHOLD

      public static final double DEFAULT_THRESHOLD
      Constant defining default threshold to determine whether samples are inliers or not.
      See Also:
    • MIN_THRESHOLD

      public static final double MIN_THRESHOLD
      Minimum value that can be set as threshold. Threshold must be strictly greater than 0.0.
      See Also:
    • DEFAULT_COMPUTE_AND_KEEP_INLIERS

      public static final boolean DEFAULT_COMPUTE_AND_KEEP_INLIERS
      Indicates that by default inliers will only be computed but not kept.
      See Also:
    • DEFAULT_COMPUTE_AND_KEEP_RESIDUALS

      public static final boolean DEFAULT_COMPUTE_AND_KEEP_RESIDUALS
      Indicates that by default residuals will only be computed but not kept.
      See Also:
    • threshold

      private double threshold
      Threshold to determine whether samples are inliers or not when testing possible solutions. The threshold refers to the amount of error on distance between estimated position and distances provided for each sample.
    • computeAndKeepInliers

      private boolean computeAndKeepInliers
      Indicates whether inliers must be computed and kept.
    • computeAndKeepResiduals

      private boolean computeAndKeepResiduals
      Indicates whether residuals must be computed and kept.
    • qualityScores

      private double[] qualityScores
      Quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
  • Constructor Details

    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver()
      Constructor.
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Point2D[] positions, double[] distances)
      Constructor.
      Parameters:
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node to be estimated.
      Throws:
      IllegalArgumentException - if either positions or distances are null, don't have the same length of their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Point2D[] positions, double[] distances, double[] distanceStandardDeviations)
      Constructor.
      Parameters:
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node to be estimated.
      distanceStandardDeviations - standard deviations of provided measured distances.
      Throws:
      IllegalArgumentException - if either positions or distances are null, don't have the same length or their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Point2D[] positions, double[] distances, double[] distanceStandardDeviations, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node.
      distanceStandardDeviations - standard deviations of provided measured distances.
      listener - listener to be notified of events such as when estimation stats, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if either positions, distances or standard deviations are null, don't have the same length or their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Point2D[] positions, double[] distances, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node.
      listener - listener to be notified of events such as when estimation stats, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if either positions or distances are null, don't have the same length or their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Circle[] circles)
      Constructor.
      Parameters:
      circles - circles defining positions and distances.
      Throws:
      IllegalArgumentException - if circles is null or if length or circles array is less than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Circle[] circles, double[] distanceStandardDeviations)
      Constructor.
      Parameters:
      circles - circles defining positions and distances.
      distanceStandardDeviations - standard deviations of provided measured distances.
      Throws:
      IllegalArgumentException - if circles is null, length of circles array is less than required (3 points) or don't have the same length.
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Circle[] circles, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      circles - circles defining positions and distances.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if circles is null or if length of circles array is less than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(com.irurueta.geometry.Circle[] circles, double[] distanceStandardDeviations, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      circles - circles defining positions and distances.
      distanceStandardDeviations - standard deviations of provided measured distances.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if circles is null, length of circles array is less than required (3 points) or don't have the same length.
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      Throws:
      IllegalArgumentException - if quality scores is null, length of quality scores is less than required minimum (3 samples).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if quality scores is null, length of quality scores is less than required minimum (3 samples).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Point2D[] positions, double[] distances)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node to be estimated.
      Throws:
      IllegalArgumentException - if either positions, distances or quality scores are null, don't have the same length of their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Point2D[] positions, double[] distances, double[] distanceStandardDeviations)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node to be estimated.
      distanceStandardDeviations - standard deviations of provided measured distances.
      Throws:
      IllegalArgumentException - if either positions, distances, quality scores or standard deviations are null, don't have the same length or their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Point2D[] positions, double[] distances, double[] distanceStandardDeviations, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node.
      distanceStandardDeviations - standard deviations of provided measured distances.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if either positions, distances or standard deviations are null, don't have the same length or their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Point2D[] positions, double[] distances, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      positions - known positions of static nodes.
      distances - euclidean distances from static nodes to mobile node.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if either positions, distances, quality scores or standard deviations are null, don't have the same length or their length is smaller than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Circle[] circles)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      circles - circles defining positions and distances.
      Throws:
      IllegalArgumentException - if either circles or quality scores are null don't have the same length or their length is less than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Circle[] circles, double[] distanceStandardDeviations)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      circles - circles defining positions and distances.
      distanceStandardDeviations - standard deviations of provided measured distances.
      Throws:
      IllegalArgumentException - if either circles, quality scores or standard deviations are null, don't have the same length or their length is less than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Circle[] circles, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      circles - circles defining positions and distances.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if either circles or quality scores are null, don't have the same length or their length is less than required (3 points).
    • PROSACRobustLateration2DSolver

      public PROSACRobustLateration2DSolver(double[] qualityScores, com.irurueta.geometry.Circle[] circles, double[] distanceStandardDeviations, RobustLaterationSolverListener<com.irurueta.geometry.Point2D> listener)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided sample. The larger the score value the better the quality of the sample.
      circles - circles defining positions and distances.
      distanceStandardDeviations - standard deviations of provided measured distances.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if either circles, quality scores or standard deviations are null, don't have the same length or their length is less than required (3 points).
  • Method Details

    • getThreshold

      public double getThreshold()
      Gets threshold to determine whether samples are inliers or not when testing possible solutions. The threshold refers to the amount of error on distance between estimated position and distances provided for each sample.
      Returns:
      threshold to determine whether samples are inliers or not.
    • setThreshold

      public void setThreshold(double threshold) throws LockedException
      Sets threshold to determine whether samples are inliers or not when testing possible solutions. The threshold refers to the amount of error on distance between estimated position and distances provided for each sample.
      Parameters:
      threshold - threshold to determine whether samples are inliers or not.
      Throws:
      IllegalArgumentException - if provided value is equal or less than zero.
      LockedException - if this solver is locked.
    • getQualityScores

      public double[] getQualityScores()
      Returns quality scores corresponding to each pair of positions and distances (i.e. sample). The larger the score value the better the quality of the sample.
      Overrides:
      getQualityScores in class RobustLaterationSolver<com.irurueta.geometry.Point2D>
      Returns:
      quality scores corresponding to each sample.
    • setQualityScores

      public void setQualityScores(double[] qualityScores) throws LockedException
      Sets quality scores corresponding to each pair of positions and distances (i.e. sample). The larger the score value the better the quality of the sample.
      Overrides:
      setQualityScores in class RobustLaterationSolver<com.irurueta.geometry.Point2D>
      Parameters:
      qualityScores - quality scores corresponding to each pair of matched points.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than minimum required samples.
      LockedException - if robust solver is locked because an estimation is already in progress.
    • isReady

      public boolean isReady()
      Indicates whether solver is ready to find a solution.
      Overrides:
      isReady in class RobustLaterationSolver<com.irurueta.geometry.Point2D>
      Returns:
      true if solver is ready, false otherwise.
    • isComputeAndKeepInliersEnabled

      public boolean isComputeAndKeepInliersEnabled()
      Indicates whether inliers must be computed and kept.
      Returns:
      true if inliers must be computed and kept, false if inliers only need to be computed but not kept.
    • setComputeAndKeepInliersEnabled

      public void setComputeAndKeepInliersEnabled(boolean computeAndKeepInliers) throws LockedException
      Specifies whether inliers must be computed and kept.
      Parameters:
      computeAndKeepInliers - true if inliers must be computed and kept, false if inliers only need to be computed but not kept.
      Throws:
      LockedException - if this solver is locked.
    • isComputeAndKeepResiduals

      public boolean isComputeAndKeepResiduals()
      Indicates whether residuals must be computed and kept.
      Returns:
      true if residuals must be computed and kept, false if residuals only need to be computed but not kept.
    • setComputeAndKeepResidualsEnabled

      public void setComputeAndKeepResidualsEnabled(boolean computeAndKeepResiduals) throws LockedException
      Specifies whether residuals must be computed and kept.
      Parameters:
      computeAndKeepResiduals - true if residuals must be computed and kept, false if residuals only need to be computed but not kept.
      Throws:
      LockedException - if this solver is locked.
    • solve

      public com.irurueta.geometry.Point2D solve() throws LockedException, NotReadyException, com.irurueta.numerical.robust.RobustEstimatorException
      Solves the lateration problem.
      Specified by:
      solve in class RobustLaterationSolver<com.irurueta.geometry.Point2D>
      Returns:
      estimated position.
      Throws:
      LockedException - if instance is busy solving the lateration problem.
      NotReadyException - is solver is not ready.
      com.irurueta.numerical.robust.RobustEstimatorException - if estimation fails for any reason (i.e. numerical instability, no solution available, etc).
    • getMethod

      public com.irurueta.numerical.robust.RobustEstimatorMethod getMethod()
      Returns method being used for robust estimation.
      Specified by:
      getMethod in class RobustLaterationSolver<com.irurueta.geometry.Point2D>
      Returns:
      method being used for robust estimation.
    • internalSetQualityScores

      private void internalSetQualityScores(double[] qualityScores)
      Sets quality scores corresponding to each provided sample. This method is used internally and does not check whether instance is locked or not.
      Parameters:
      qualityScores - quality scores to be set.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than 3 samples.