SemiAnalyticalKalmanEstimator.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.estimation.sequential;

  18. import java.util.Collections;
  19. import java.util.List;

  20. import org.hipparchus.exception.MathRuntimeException;
  21. import org.hipparchus.filtering.kalman.KalmanFilter;
  22. import org.hipparchus.filtering.kalman.extended.ExtendedKalmanFilter;
  23. import org.hipparchus.linear.MatrixDecomposer;
  24. import org.orekit.errors.OrekitException;
  25. import org.orekit.estimation.measurements.ObservedMeasurement;
  26. import org.orekit.propagation.conversion.DSSTPropagatorBuilder;
  27. import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
  28. import org.orekit.utils.ParameterDriver;
  29. import org.orekit.utils.ParameterDriversList;

  30. /**
  31.  * Implementation of an Extended Semi-analytical Kalman Filter (ESKF) to perform orbit determination.
  32.  * <p>
  33.  * The filter uses a {@link DSSTPropagatorBuilder}.
  34.  * </p>
  35.  * <p>
  36.  * The estimated parameters are driven by {@link ParameterDriver} objects. They are of 3 different types:<ol>
  37.  *   <li><b>Orbital parameters</b>:The position and velocity of the spacecraft, or, more generally, its orbit.<br>
  38.  *       These parameters are retrieved from the reference trajectory propagator builder when the filter is initialized.</li>
  39.  *   <li><b>Propagation parameters</b>: Some parameters modelling physical processes (SRP or drag coefficients).<br>
  40.  *       They are also retrieved from the propagator builder during the initialization phase.</li>
  41.  *   <li><b>Measurements parameters</b>: Parameters related to measurements (station biases, positions etc...).<br>
  42.  *       They are passed down to the filter in its constructor.</li>
  43.  * </ol>
  44.  * <p>
  45.  * The Kalman filter implementation used is provided by the underlying mathematical library Hipparchus.
  46.  * All the variables seen by Hipparchus (states, covariances, measurement matrices...) are normalized
  47.  * using a specific scale for each estimated parameters or standard deviation noise for each measurement components.
  48.  * </p>
  49.  *
  50.  * @see "Folcik Z., Orbit Determination Using Modern Filters/Smoothers and Continuous Thrust Modeling,
  51.  *       Master of Science Thesis, Department of Aeronautics and Astronautics, MIT, June, 2008."
  52.  *
  53.  * @see "Cazabonne B., Bayard J., Journot M., and Cefola P. J., A Semi-analytical Approach for Orbit
  54.  *       Determination based on Extended Kalman Filter, AAS Paper 21-614, AAS/AIAA Astrodynamics
  55.  *       Specialist Conference, Big Sky, August 2021."
  56.  *
  57.  * @author Julie Bayard
  58.  * @author Bryan Cazabonne
  59.  * @author Maxime Journot
  60.  * @since 11.1
  61.  */
  62. public class SemiAnalyticalKalmanEstimator extends AbstractKalmanEstimator {

  63.     /** Kalman filter process model. */
  64.     private final SemiAnalyticalKalmanModel processModel;

  65.     /** Filter. */
  66.     private final ExtendedKalmanFilter<MeasurementDecorator> filter;

  67.     /** Kalman filter estimator constructor (package private).
  68.      * @param decomposer decomposer to use for the correction phase
  69.      * @param propagatorBuilder propagator builder used to evaluate the orbit.
  70.      * @param covarianceMatrixProvider provider for process noise matrix
  71.      * @param estimatedMeasurementParameters measurement parameters to estimate
  72.      * @param measurementProcessNoiseMatrix provider for measurement process noise matrix
  73.      */
  74.     public SemiAnalyticalKalmanEstimator(final MatrixDecomposer decomposer,
  75.                                          final DSSTPropagatorBuilder propagatorBuilder,
  76.                                          final CovarianceMatrixProvider covarianceMatrixProvider,
  77.                                          final ParameterDriversList estimatedMeasurementParameters,
  78.                                          final CovarianceMatrixProvider measurementProcessNoiseMatrix) {
  79.         super(decomposer, Collections.singletonList(propagatorBuilder));
  80.         // Build the process model and measurement model
  81.         this.processModel = new SemiAnalyticalKalmanModel(propagatorBuilder, covarianceMatrixProvider,
  82.                                                           estimatedMeasurementParameters,  measurementProcessNoiseMatrix);

  83.         // Extended Kalman Filter of Hipparchus
  84.         this.filter = new ExtendedKalmanFilter<>(decomposer, processModel, processModel.getEstimate());

  85.     }

  86.     /** {@inheritDoc}. */
  87.     @Override
  88.     protected KalmanEstimation getKalmanEstimation() {
  89.         return processModel;
  90.     }

  91.     /** {@inheritDoc}. */
  92.     @Override
  93.     protected KalmanFilter<MeasurementDecorator> getKalmanFilter() {
  94.         return filter;
  95.     }

  96.     /** {@inheritDoc}. */
  97.     @Override
  98.     protected double[] getScale() {
  99.         return processModel.getScale();
  100.     }

  101.     /** {@inheritDoc}. */
  102.     @Override
  103.     public void setObserver(final KalmanObserver observer) {
  104.         processModel.setObserver(observer);
  105.         observer.init(getKalmanEstimation());
  106.     }

  107.     /** {@inheritDoc}. */
  108.     @Override
  109.     public KalmanObserver getObserver() {
  110.         return processModel.getObserver();
  111.     }

  112.     /** Process a single measurement.
  113.      * <p>
  114.      * Update the filter with the new measurement by calling the estimate method.
  115.      * </p>
  116.      * @param observedMeasurements the list of measurements to process
  117.      * @return estimated propagators
  118.      */
  119.     public DSSTPropagator processMeasurements(final List<ObservedMeasurement<?>> observedMeasurements) {
  120.         try {
  121.             return processModel.processMeasurements(observedMeasurements, filter);
  122.         } catch (MathRuntimeException mrte) {
  123.             throw new OrekitException(mrte);
  124.         }
  125.     }

  126. }