Search in sources :

Example 1 with OnBoardAntennaRangeModifier

use of org.orekit.estimation.measurements.modifiers.OnBoardAntennaRangeModifier in project Orekit by CS-SI.

the class KalmanEstimatorTest method testKeplerianRangeWithOnBoardAntennaOffset.

/**
 * Perfect range measurements with a biased start and an on-board antenna range offset
 * Keplerian formalism
 * @throws OrekitException
 */
@Test
public void testKeplerianRangeWithOnBoardAntennaOffset() throws OrekitException {
    // Create context
    Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    // Create initial orbit and propagator builder
    final OrbitType orbitType = OrbitType.KEPLERIAN;
    final PositionAngle positionAngle = PositionAngle.TRUE;
    final boolean perfectStart = true;
    final double minStep = 1.e-6;
    final double maxStep = 60.;
    final double dP = 1.;
    final NumericalPropagatorBuilder propagatorBuilder = context.createBuilder(orbitType, positionAngle, perfectStart, minStep, maxStep, dP);
    propagatorBuilder.setAttitudeProvider(new LofOffset(propagatorBuilder.getFrame(), LOFType.LVLH));
    // Antenna phase center definition
    final Vector3D antennaPhaseCenter = new Vector3D(-1.2, 2.3, -0.7);
    // Create perfect range measurements with antenna offset
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeMeasurementCreator(context, antennaPhaseCenter), 1.0, 3.0, 300.0);
    // Add antenna offset to the measurements
    final OnBoardAntennaRangeModifier obaModifier = new OnBoardAntennaRangeModifier(antennaPhaseCenter);
    for (final ObservedMeasurement<?> range : measurements) {
        ((Range) range).addModifier(obaModifier);
    }
    // Reference propagator for estimation performances
    final NumericalPropagator referencePropagator = propagatorBuilder.buildPropagator(propagatorBuilder.getSelectedNormalizedParameters());
    // Reference position/velocity at last measurement date
    final Orbit refOrbit = referencePropagator.propagate(measurements.get(measurements.size() - 1).getDate()).getOrbit();
    // Change semi-major axis of 1.2m as in the batch test
    ParameterDriver aDriver = propagatorBuilder.getOrbitalParametersDrivers().getDrivers().get(0);
    aDriver.setValue(aDriver.getValue() + 1.2);
    aDriver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    // Cartesian covariance matrix initialization
    // 100m on position / 1e-2m/s on velocity
    final RealMatrix cartesianP = MatrixUtils.createRealDiagonalMatrix(new double[] { 10., 10., 10., 1e-3, 1e-3, 1e-3 });
    // Jacobian of the orbital parameters w/r to Cartesian
    final Orbit initialOrbit = OrbitType.KEPLERIAN.convertType(context.initialOrbit);
    final double[][] dYdC = new double[6][6];
    initialOrbit.getJacobianWrtCartesian(PositionAngle.TRUE, dYdC);
    final RealMatrix Jac = MatrixUtils.createRealMatrix(dYdC);
    // Keplerian initial covariance matrix
    final RealMatrix initialP = Jac.multiply(cartesianP.multiply(Jac.transpose()));
    // Process noise matrix is set to 0 here
    RealMatrix Q = MatrixUtils.createRealMatrix(6, 6);
    // Build the Kalman filter
    final KalmanEstimatorBuilder kalmanBuilder = new KalmanEstimatorBuilder();
    kalmanBuilder.builder(propagatorBuilder);
    kalmanBuilder.estimatedMeasurementsParameters(new ParameterDriversList());
    kalmanBuilder.initialCovarianceMatrix(initialP);
    kalmanBuilder.processNoiseMatrixProvider(new ConstantProcessNoise(Q));
    final KalmanEstimator kalman = kalmanBuilder.build();
    // Filter the measurements and check the results
    final double expectedDeltaPos = 0.;
    final double posEps = 4.57e-3;
    final double expectedDeltaVel = 0.;
    final double velEps = 7.29e-6;
    final double[] expectedSigmasPos = { 1.105194, 0.930785, 1.254579 };
    final double sigmaPosEps = 1e-6;
    final double[] expectedSigmasVel = { 6.193718e-4, 4.088774e-4, 3.299135e-4 };
    final double sigmaVelEps = 1e-10;
    EstimationTestUtils.checkKalmanFit(context, kalman, measurements, refOrbit, positionAngle, expectedDeltaPos, posEps, expectedDeltaVel, velEps, expectedSigmasPos, sigmaPosEps, expectedSigmasVel, sigmaVelEps);
}
Also used : PositionAngle(org.orekit.orbits.PositionAngle) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) ParameterDriversList(org.orekit.utils.ParameterDriversList) Propagator(org.orekit.propagation.Propagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) LofOffset(org.orekit.attitudes.LofOffset) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) Context(org.orekit.estimation.Context) Orbit(org.orekit.orbits.Orbit) Range(org.orekit.estimation.measurements.Range) ParameterDriver(org.orekit.utils.ParameterDriver) OnBoardAntennaRangeModifier(org.orekit.estimation.measurements.modifiers.OnBoardAntennaRangeModifier) RealMatrix(org.hipparchus.linear.RealMatrix) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) OrbitType(org.orekit.orbits.OrbitType) RangeMeasurementCreator(org.orekit.estimation.measurements.RangeMeasurementCreator) Test(org.junit.Test)

Example 2 with OnBoardAntennaRangeModifier

use of org.orekit.estimation.measurements.modifiers.OnBoardAntennaRangeModifier in project Orekit by CS-SI.

the class BatchLSEstimatorTest method testKeplerRangeWithOnBoardAntennaOffset.

/**
 * Perfect range measurements with a biased start and an on-board antenna range offset
 * @throws OrekitException
 */
@Test
public void testKeplerRangeWithOnBoardAntennaOffset() throws OrekitException {
    Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0);
    propagatorBuilder.setAttitudeProvider(new LofOffset(propagatorBuilder.getFrame(), LOFType.LVLH));
    final Vector3D antennaPhaseCenter = new Vector3D(-1.2, 2.3, -0.7);
    // create perfect range measurements with antenna offset
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeMeasurementCreator(context, antennaPhaseCenter), 1.0, 3.0, 300.0);
    // create orbit estimator
    final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder);
    final OnBoardAntennaRangeModifier obaModifier = new OnBoardAntennaRangeModifier(antennaPhaseCenter);
    for (final ObservedMeasurement<?> range : measurements) {
        ((Range) range).addModifier(obaModifier);
        estimator.addMeasurement(range);
    }
    estimator.setParametersConvergenceThreshold(1.0e-2);
    estimator.setMaxIterations(10);
    estimator.setMaxEvaluations(20);
    estimator.setObserver(new BatchLSObserver() {

        int lastIter = 0;

        int lastEval = 0;

        /**
         * {@inheritDoc}
         */
        @Override
        public void evaluationPerformed(int iterationsCount, int evaluationscount, Orbit[] orbits, ParameterDriversList estimatedOrbitalParameters, ParameterDriversList estimatedPropagatorParameters, ParameterDriversList estimatedMeasurementsParameters, EstimationsProvider evaluationsProvider, Evaluation lspEvaluation) throws OrekitException {
            if (iterationsCount == lastIter) {
                Assert.assertEquals(lastEval + 1, evaluationscount);
            } else {
                Assert.assertEquals(lastIter + 1, iterationsCount);
            }
            lastIter = iterationsCount;
            lastEval = evaluationscount;
            Assert.assertEquals(measurements.size(), evaluationsProvider.getNumber());
            try {
                evaluationsProvider.getEstimatedMeasurement(-1);
                Assert.fail("an exception should have been thrown");
            } catch (OrekitException oe) {
                Assert.assertEquals(LocalizedCoreFormats.OUT_OF_RANGE_SIMPLE, oe.getSpecifier());
            }
            try {
                evaluationsProvider.getEstimatedMeasurement(measurements.size());
                Assert.fail("an exception should have been thrown");
            } catch (OrekitException oe) {
                Assert.assertEquals(LocalizedCoreFormats.OUT_OF_RANGE_SIMPLE, oe.getSpecifier());
            }
            AbsoluteDate previous = AbsoluteDate.PAST_INFINITY;
            for (int i = 0; i < evaluationsProvider.getNumber(); ++i) {
                AbsoluteDate current = evaluationsProvider.getEstimatedMeasurement(i).getDate();
                Assert.assertTrue(current.compareTo(previous) >= 0);
                previous = current;
            }
        }
    });
    ParameterDriver aDriver = estimator.getOrbitalParametersDrivers(true).getDrivers().get(0);
    Assert.assertEquals("a", aDriver.getName());
    aDriver.setValue(aDriver.getValue() + 1.2);
    aDriver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    EstimationTestUtils.checkFit(context, estimator, 2, 3, 0.0, 2.0e-5, 0.0, 5.2e-5, 0.0, 2.7e-5, 0.0, 1.1e-8);
    // got a default one
    for (final ParameterDriver driver : estimator.getOrbitalParametersDrivers(true).getDrivers()) {
        if ("a".equals(driver.getName())) {
            // user-specified reference date
            Assert.assertEquals(0, driver.getReferenceDate().durationFrom(AbsoluteDate.GALILEO_EPOCH), 1.0e-15);
        } else {
            // default reference date
            Assert.assertEquals(0, driver.getReferenceDate().durationFrom(propagatorBuilder.getInitialOrbitDate()), 1.0e-15);
        }
    }
}
Also used : Context(org.orekit.estimation.Context) Evaluation(org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem.Evaluation) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Range(org.orekit.estimation.measurements.Range) ParameterDriver(org.orekit.utils.ParameterDriver) AbsoluteDate(org.orekit.time.AbsoluteDate) LevenbergMarquardtOptimizer(org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer) OnBoardAntennaRangeModifier(org.orekit.estimation.measurements.modifiers.OnBoardAntennaRangeModifier) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ParameterDriversList(org.orekit.utils.ParameterDriversList) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Propagator(org.orekit.propagation.Propagator) OrekitException(org.orekit.errors.OrekitException) RangeMeasurementCreator(org.orekit.estimation.measurements.RangeMeasurementCreator) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) LofOffset(org.orekit.attitudes.LofOffset) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) EstimationsProvider(org.orekit.estimation.measurements.EstimationsProvider) Test(org.junit.Test)

Aggregations

Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)2 Test (org.junit.Test)2 LofOffset (org.orekit.attitudes.LofOffset)2 Context (org.orekit.estimation.Context)2 ObservedMeasurement (org.orekit.estimation.measurements.ObservedMeasurement)2 Range (org.orekit.estimation.measurements.Range)2 RangeMeasurementCreator (org.orekit.estimation.measurements.RangeMeasurementCreator)2 OnBoardAntennaRangeModifier (org.orekit.estimation.measurements.modifiers.OnBoardAntennaRangeModifier)2 Orbit (org.orekit.orbits.Orbit)2 Propagator (org.orekit.propagation.Propagator)2 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)2 ParameterDriver (org.orekit.utils.ParameterDriver)2 ParameterDriversList (org.orekit.utils.ParameterDriversList)2 RealMatrix (org.hipparchus.linear.RealMatrix)1 Evaluation (org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem.Evaluation)1 LevenbergMarquardtOptimizer (org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer)1 OrekitException (org.orekit.errors.OrekitException)1 EstimationsProvider (org.orekit.estimation.measurements.EstimationsProvider)1 InterSatellitesRangeMeasurementCreator (org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator)1 CartesianOrbit (org.orekit.orbits.CartesianOrbit)1