Commit 3d875f28 authored by Maxime Journot's avatar Maxime Journot
Browse files

Added method to get the measurement type.

Added default method `getMeasurementType` in `ObservedMeasurement` that returns the name of the class
Added a constant String `MEASUREMENT_TYPE` in each measurement class to get the class name as a String
Used both additions to improve measurements type checks in tests
Fixes #955
parent 170233b0
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.3" date="TBD" description="TBD">
<action dev="maxime" type="update" issue="955">
Added method to get measurement types.
</action>
<action dev="bryan" type="add" issue="901">
Added additional state provider for covariance matrix propagation.
</action>
......
......@@ -44,6 +44,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class AngularAzEl extends AbstractMeasurement<AngularAzEl> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "AngularAzEl";
/** Ground station from which measurement is performed. */
private final GroundStation station;
......
......@@ -46,6 +46,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class AngularRaDec extends AbstractMeasurement<AngularRaDec> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "AngularRaDec";
/** Ground station from which measurement is performed. */
private final GroundStation station;
......
......@@ -53,6 +53,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class BistaticRange extends AbstractMeasurement<BistaticRange> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "BistaticRange";
/**
* Ground station from which transmission is made.
*/
......
......@@ -56,6 +56,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class BistaticRangeRate extends AbstractMeasurement<BistaticRangeRate> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "BistaticRangeRate";
/** Emitter ground station. */
private final GroundStation emitter;
......
......@@ -68,6 +68,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class InterSatellitesRange extends AbstractMeasurement<InterSatellitesRange> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "InterSatellitesRange";
/** Flag indicating whether it is a two-way measurement. */
private final boolean twoway;
......
......@@ -38,6 +38,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class MultiplexedMeasurement extends AbstractMeasurement<MultiplexedMeasurement> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "MultiplexedMeasurement";
/** Multiplexed measurements. */
private final List<ObservedMeasurement<?>> observedMeasurements;
......
......@@ -136,4 +136,13 @@ public interface ObservedMeasurement<T extends ObservedMeasurement<T>> extends C
*/
EstimatedMeasurement<T> estimate(int iteration, int evaluation, SpacecraftState[] states);
/**
* Get the type of measurement.
* <p>
* Default behavior is to return the class simple name as a String.
* @return type of measurement
*/
default String getMeasurementType() {
return this.getClass().getSimpleName();
}
}
......@@ -36,6 +36,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class PV extends AbstractMeasurement<PV> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "PV";
/** Identity matrix, for states derivatives. */
private static final double[][] IDENTITY = new double[][] {
{
......
......@@ -36,6 +36,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class Position extends AbstractMeasurement<Position> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "Position";
/** Identity matrix, for states derivatives. */
private static final double[][] IDENTITY = new double[][] {
{
......
......@@ -77,6 +77,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class Range extends AbstractMeasurement<Range> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "Range";
/** Ground station from which measurement is performed. */
private final GroundStation station;
......
......@@ -49,6 +49,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class RangeRate extends AbstractMeasurement<RangeRate> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "RangeRate";
/** Ground station from which measurement is performed. */
private final GroundStation station;
......
......@@ -52,6 +52,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class TDOA extends AbstractMeasurement<TDOA> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "TDOA";
/** Prime ground station, the one that gives the date of the measurement. */
private final GroundStation primeStation;
......
......@@ -59,6 +59,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class TurnAroundRange extends AbstractMeasurement<TurnAroundRange> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "TurnAroundRange";
/** Primary ground station from which measurement is performed. */
private final GroundStation primaryStation;
......
......@@ -46,6 +46,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class InterSatellitesPhase extends AbstractMeasurement<InterSatellitesPhase> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "InterSatellitesPhase";
/** Name for ambiguity driver. */
public static final String AMBIGUITY_NAME = "ambiguity";
......
......@@ -55,6 +55,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class OneWayGNSSPhase extends AbstractMeasurement<OneWayGNSSPhase> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "OneWayGNSSPhase";
/** Name for ambiguity driver. */
public static final String AMBIGUITY_NAME = "ambiguity";
......
......@@ -56,6 +56,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class OneWayGNSSRange extends AbstractMeasurement<OneWayGNSSRange> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "OneWayGNSSRange";
/** Emitting satellite. */
private final PVCoordinatesProvider remote;
......
......@@ -54,6 +54,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class Phase extends AbstractMeasurement<Phase> {
/** Type of the measurement. */
public static final String MEASUREMENT_TYPE = "Phase";
/** Name for ambiguity driver. */
public static final String AMBIGUITY_NAME = "ambiguity";
......
......@@ -145,11 +145,11 @@ public class EskfMeasurementHandler implements OrekitStepHandler {
// Indeed, the "physical" measurement noise matrix is the covariance matrix of the measurement
// Normalizing it leaves us with the matrix of the correlation coefficients
final RealMatrix covariance;
if (observedMeasurement instanceof PV) {
if (observedMeasurement.getMeasurementType().equals(PV.MEASUREMENT_TYPE)) {
// For PV measurements we do have a covariance matrix and thus a correlation coefficients matrix
final PV pv = (PV) observedMeasurement;
covariance = MatrixUtils.createRealMatrix(pv.getCorrelationCoefficientsMatrix());
} else if (observedMeasurement instanceof Position) {
} else if (observedMeasurement.getMeasurementType().equals(Position.MEASUREMENT_TYPE)) {
// For Position measurements we do have a covariance matrix and thus a correlation coefficients matrix
final Position position = (Position) observedMeasurement;
covariance = MatrixUtils.createRealMatrix(position.getCorrelationCoefficientsMatrix());
......
......@@ -258,11 +258,11 @@ public class KalmanEstimator {
// Indeed, the "physical" measurement noise matrix is the covariance matrix of the measurement
// Normalizing it leaves us with the matrix of the correlation coefficients
final RealMatrix covariance;
if (observedMeasurement instanceof PV) {
if (observedMeasurement.getMeasurementType().equals(PV.MEASUREMENT_TYPE)) {
// For PV measurements we do have a covariance matrix and thus a correlation coefficients matrix
final PV pv = (PV) observedMeasurement;
covariance = MatrixUtils.createRealMatrix(pv.getCorrelationCoefficientsMatrix());
} else if (observedMeasurement instanceof Position) {
} else if (observedMeasurement.getMeasurementType().equals(Position.MEASUREMENT_TYPE)) {
// For Position measurements we do have a covariance matrix and thus a correlation coefficients matrix
final Position position = (Position) observedMeasurement;
covariance = MatrixUtils.createRealMatrix(position.getCorrelationCoefficientsMatrix());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment