Package com.irurueta.navigation.gnss
Class GNSSLeastSquaresPositionAndVelocityEstimator
java.lang.Object
com.irurueta.navigation.gnss.GNSSLeastSquaresPositionAndVelocityEstimator
Calculates position, velocity, clock offset and clock drift using
unweighted iterated least squares.
Separate calculations are implemented for position and clock offset and
for velocity and clock drift.
This implementation is based on the equations defined in "Principles of GNSS, Inertial, and Multi-sensor
Integrated Navigation Systems, Second Edition" and on the companion software available at:
https://github.com/ymjdz/MATLAB-Codes/blob/master/GNSS_LS_position_velocity.m
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.irurueta.algebra.MatrixInternal matrix to be reused containing frame rotation during signal transit time.static final doubleDefault threshold to determine when convergence has been reached.private doubleThreshold to determine when convergence has been reached.static final doubleEarth rotation rate expressed in radians per second (rad/s).private static final intNumber of elements of position, velocity, etc.private static final intNumber of elements of position minus one.private final com.irurueta.algebra.MatrixContains square representation of measurement or geometry matrix.private final com.irurueta.algebra.MatrixInverse of the square representation of measurement or geometry matrix.Listener to notify events raised by this instance.private final com.irurueta.algebra.MatrixMeasurement position to be reused.private Collection<GNSSMeasurement> GNSS measurements of a collection of satellites.private final com.irurueta.algebra.MatrixMeasurement velocity to be reused.static final intMinimum number of measurements required to obtain a solution.private final com.irurueta.algebra.MatrixSkew symmetric matrix of Earth rotation rate.private final com.irurueta.algebra.MatrixPredicted velocity to be reused.private ECEFPositionAndVelocityPreviously predicted ECEF user position and velocity.private final com.irurueta.algebra.MatrixResult position to be reused.private booleanIndicates whether estimation is currently running.static final doubleSpeed of light in the vacuum expressed in meters per second (m/s).private static final intNumber of components of predicted state.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixTemporal matrix to be reused.private final com.irurueta.algebra.MatrixEstimated state to be reused.private final com.irurueta.algebra.MatrixPredicted state to be reused. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.GNSSLeastSquaresPositionAndVelocityEstimator(GNSSLeastSquaresPositionAndVelocityEstimatorListener listener) Constructor.Constructor.GNSSLeastSquaresPositionAndVelocityEstimator(Collection<GNSSMeasurement> measurements, ECEFPositionAndVelocity priorPositionAndVelocity) Constructor.GNSSLeastSquaresPositionAndVelocityEstimator(Collection<GNSSMeasurement> measurements, ECEFPositionAndVelocity priorPositionAndVelocity, GNSSLeastSquaresPositionAndVelocityEstimatorListener listener) Constructor.GNSSLeastSquaresPositionAndVelocityEstimator(Collection<GNSSMeasurement> measurements, GNSSEstimation priorEstimation) Constructor.GNSSLeastSquaresPositionAndVelocityEstimator(Collection<GNSSMeasurement> measurements, GNSSEstimation priorEstimation, GNSSLeastSquaresPositionAndVelocityEstimatorListener listener) Constructor.GNSSLeastSquaresPositionAndVelocityEstimator(Collection<GNSSMeasurement> measurements, GNSSLeastSquaresPositionAndVelocityEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionestimate()Estimates new ECEF user position and velocity as well as clock offset and drift.voidestimate(GNSSEstimation result) Estimates new ECEF user position and velocity as well as clock offset and drift.doubleGets threshold to determine when convergence has been reached.Gets listener to notify events raised by this instance.Gets GNSS measurements of a collection of satellites.Gets previously predicted ECEF user position and velocity.private voidInitializes prior position and velocity if not set, assuming that user is located at the average latitude, longitude of all provided satellite measurements, at Earth's surface (height = 0) and with zero velocity.booleanisReady()Indicates whether this estimator is ready to start the estimation.booleanIndicates whether this estimator is currently running or not.static booleanisValidMeasurements(Collection<GNSSMeasurement> gnssMeasurements) Indicates whether provided measurements are valid or not.private static doublenorm(double x, double y, double z) Computes norm of provided coordinates.private doubleComputes norm of error between estimated state and predicted state.voidsetConvergenceThreshold(double convergenceThreshold) Sets threshold to determine when convergence has been reached.voidSets listener to notify events raised by this instance.voidsetMeasurements(Collection<GNSSMeasurement> measurements) Sets GNSS measurements of a collection of satellites.voidsetPriorPositionAndVelocity(ECEFPositionAndVelocity priorPositionAndVelocity) Sets previously predicted ECEF user position and velocity.voidsetPriorPositionAndVelocityFromEstimation(GNSSEstimation priorEstimation) Sets previously predicted ECEF user position and velocity from a previous predicted result.
-
Field Details
-
MIN_MEASUREMENTS
public static final int MIN_MEASUREMENTSMinimum number of measurements required to obtain a solution.- See Also:
-
CONVERGENCE_THRESHOLD
public static final double CONVERGENCE_THRESHOLDDefault threshold to determine when convergence has been reached.- See Also:
-
SPEED_OF_LIGHT
public static final double SPEED_OF_LIGHTSpeed of light in the vacuum expressed in meters per second (m/s).- See Also:
-
EARTH_ROTATION_RATE
public static final double EARTH_ROTATION_RATEEarth rotation rate expressed in radians per second (rad/s).- See Also:
-
STATE_COMPONENTS
private static final int STATE_COMPONENTSNumber of components of predicted state.- See Also:
-
ELEMS
private static final int ELEMSNumber of elements of position, velocity, etc.- See Also:
-
ELEMS_MINUS_ONE
private static final int ELEMS_MINUS_ONENumber of elements of position minus one.- See Also:
-
measurements
GNSS measurements of a collection of satellites. -
priorPositionAndVelocity
Previously predicted ECEF user position and velocity. -
listener
Listener to notify events raised by this instance. -
convergenceThreshold
private double convergenceThresholdThreshold to determine when convergence has been reached. -
running
private boolean runningIndicates whether estimation is currently running. -
cei
private final com.irurueta.algebra.Matrix ceiInternal matrix to be reused containing frame rotation during signal transit time. -
xPred
private final com.irurueta.algebra.Matrix xPredPredicted state to be reused. -
tmp1
private final com.irurueta.algebra.Matrix tmp1Temporal matrix to be reused. -
tmp2
private final com.irurueta.algebra.Matrix tmp2Temporal matrix to be reused. -
xEst
private final com.irurueta.algebra.Matrix xEstEstimated state to be reused. -
hSqr
private final com.irurueta.algebra.Matrix hSqrContains square representation of measurement or geometry matrix. -
invHSqr
private final com.irurueta.algebra.Matrix invHSqrInverse of the square representation of measurement or geometry matrix. -
tmp3
private final com.irurueta.algebra.Matrix tmp3Temporal matrix to be reused. -
omegaIe
private final com.irurueta.algebra.Matrix omegaIeSkew symmetric matrix of Earth rotation rate. -
tmp4
private final com.irurueta.algebra.Matrix tmp4Temporal matrix to be reused. -
tmp5
private final com.irurueta.algebra.Matrix tmp5Temporal matrix to be reused. -
tmp6
private final com.irurueta.algebra.Matrix tmp6Temporal matrix to be reused. -
tmp7
private final com.irurueta.algebra.Matrix tmp7Temporal matrix to be reused. -
tmp8
private final com.irurueta.algebra.Matrix tmp8Temporal matrix to be reused. -
tmp9
private final com.irurueta.algebra.Matrix tmp9Temporal matrix to be reused. -
tmp10
private final com.irurueta.algebra.Matrix tmp10Temporal matrix to be reused. -
measurementPosition
private final com.irurueta.algebra.Matrix measurementPositionMeasurement position to be reused. -
measurementVelocity
private final com.irurueta.algebra.Matrix measurementVelocityMeasurement velocity to be reused. -
predVelocity
private final com.irurueta.algebra.Matrix predVelocityPredicted velocity to be reused. -
resultPosition
private final com.irurueta.algebra.Matrix resultPositionResult position to be reused.
-
-
Constructor Details
-
GNSSLeastSquaresPositionAndVelocityEstimator
public GNSSLeastSquaresPositionAndVelocityEstimator()Constructor. -
GNSSLeastSquaresPositionAndVelocityEstimator
Constructor.- Parameters:
measurements- GNSS measurements of a collection of satellites.- Throws:
IllegalArgumentException- if less than 4 measurements are provided.
-
-
Method Details
-
getMeasurements
Gets GNSS measurements of a collection of satellites.- Returns:
- GNSS measurements of a collection of satellites.
-
setMeasurements
Sets GNSS measurements of a collection of satellites.- Parameters:
measurements- GNSS measurements of a collection of satellites.- Throws:
IllegalArgumentException- if less than 4 measurements are provided.LockedException- if this estimator is already running.
-
getPriorPositionAndVelocity
Gets previously predicted ECEF user position and velocity.- Returns:
- previously predicted ECEF user position and velocity.
-
getListener
Gets listener to notify events raised by this instance.- Returns:
- listener to notify events raised by this instance.
-
getConvergenceThreshold
public double getConvergenceThreshold()Gets threshold to determine when convergence has been reached.- Returns:
- threshold to determine when convergence has been reached.
-
setConvergenceThreshold
public void setConvergenceThreshold(double convergenceThreshold) throws LockedException, IllegalArgumentException Sets threshold to determine when convergence has been reached.- Parameters:
convergenceThreshold- threshold to determine when convergence has been reached.- Throws:
LockedException- if this estimator is already running.IllegalArgumentException- if provided threshold is zero or negative.
-
isReady
public boolean isReady()Indicates whether this estimator is ready to start the estimation.- Returns:
- true if estimator is ready, false otherwise.
-
isRunning
public boolean isRunning()Indicates whether this estimator is currently running or not.- Returns:
- true if estimator is running, false otherwise.
-
isValidMeasurements
Indicates whether provided measurements are valid or not.- Parameters:
gnssMeasurements- measurements to be checked.- Returns:
- true if at least 4 measurements are provided, false otherwise.
-
estimate
Estimates new ECEF user position and velocity as well as clock offset and drift.- Returns:
- new ECEF user position and velocity, and clock offset and drift.
- Throws:
NotReadyException- if estimator is not ready to start estimation.LockedException- if estimator is already running.GNSSException- if estimation fails due to numerical instabilities.
-
initializePriorPositionAndVelocityIfNeeded
private void initializePriorPositionAndVelocityIfNeeded()Initializes prior position and velocity if not set, assuming that user is located at the average latitude, longitude of all provided satellite measurements, at Earth's surface (height = 0) and with zero velocity. -
norm
private static double norm(double x, double y, double z) Computes norm of provided coordinates.- Parameters:
x- x coordinate.y- y coordinate.z- z coordinate.- Returns:
- computed norm.
-
predictionError
private double predictionError()Computes norm of error between estimated state and predicted state.- Returns:
- norm of error.
-