SemiAnalyticalUnscentedKalmanEstimator.java

  1. /* Copyright 2002-2024 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.filtering.kalman.unscented.UnscentedKalmanFilter;
  21. import org.hipparchus.linear.MatrixDecomposer;
  22. import org.hipparchus.util.UnscentedTransformProvider;
  23. import org.orekit.estimation.measurements.ObservedMeasurement;
  24. import org.orekit.propagation.conversion.DSSTPropagatorBuilder;
  25. import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
  26. import org.orekit.utils.ParameterDriver;
  27. import org.orekit.utils.ParameterDriversList;

  28. /**
  29.  * Implementation of an Unscented Semi-analytical Kalman filter (USKF) to perform orbit determination.
  30.  * <p>
  31.  * The filter uses a {@link DSSTPropagatorBuilder}.
  32.  * </p>
  33.  * <p>
  34.  * The estimated parameters are driven by {@link ParameterDriver} objects. They are of 3 different types:<ol>
  35.  *   <li><b>Orbital parameters</b>:The position and velocity of the spacecraft, or, more generally, its orbit.<br>
  36.  *       These parameters are retrieved from the reference trajectory propagator builder when the filter is initialized.</li>
  37.  *   <li><b>Propagation parameters</b>: Some parameters modeling physical processes (SRP or drag coefficients etc...).<br>
  38.  *       They are also retrieved from the propagator builder during the initialization phase.</li>
  39.  *   <li><b>Measurements parameters</b>: Parameters related to measurements (station biases, positions etc...).<br>
  40.  *       They are passed down to the filter in its constructor.</li>
  41.  * </ol>
  42.  * <p>
  43.  * The Kalman filter implementation used is provided by the underlying mathematical library Hipparchus.
  44.  * All the variables seen by Hipparchus (states, covariances...) are normalized
  45.  * using a specific scale for each estimated parameters or standard deviation noise for each measurement components.
  46.  * </p>
  47.  *
  48.  * <p>An {@link SemiAnalyticalUnscentedKalmanEstimator} object is built using the {@link SemiAnalyticalUnscentedKalmanEstimatorBuilder#build() build}
  49.  * method of a {@link SemiAnalyticalUnscentedKalmanEstimatorBuilder}.</p>
  50.  *
  51.  * @author GaĆ«tan Pierre
  52.  * @author Bryan Cazabonne
  53.  * @since 11.3
  54.  */
  55. public class SemiAnalyticalUnscentedKalmanEstimator extends AbstractKalmanEstimator {

  56.     /** Unscented Kalman filter process model. */
  57.     private final SemiAnalyticalUnscentedKalmanModel processModel;

  58.     /** Filter. */
  59.     private final UnscentedKalmanFilter<MeasurementDecorator> filter;

  60.     /** Unscented Kalman filter estimator constructor (package private).
  61.      * @param decomposer decomposer to use for the correction phase
  62.      * @param propagatorBuilder propagator builder used to evaluate the orbit.
  63.      * @param processNoiseMatricesProvider provider for process noise matrix
  64.      * @param estimatedMeasurementParameters measurement parameters to estimate
  65.      * @param measurementProcessNoiseMatrix provider for measurement process noise matrix
  66.      * @param utProvider provider for the unscented transform
  67.      */
  68.     SemiAnalyticalUnscentedKalmanEstimator(final MatrixDecomposer decomposer,
  69.                                            final DSSTPropagatorBuilder propagatorBuilder,
  70.                                            final CovarianceMatrixProvider processNoiseMatricesProvider,
  71.                                            final ParameterDriversList estimatedMeasurementParameters,
  72.                                            final CovarianceMatrixProvider measurementProcessNoiseMatrix,
  73.                                            final UnscentedTransformProvider utProvider) {
  74.         super(Collections.singletonList(propagatorBuilder));
  75.         // Build the process model and measurement model
  76.         this.processModel = new SemiAnalyticalUnscentedKalmanModel(propagatorBuilder, processNoiseMatricesProvider,
  77.                                                                    estimatedMeasurementParameters, measurementProcessNoiseMatrix);

  78.         // Unscented Kalman Filter of Hipparchus
  79.         this.filter = new UnscentedKalmanFilter<>(decomposer, processModel, processModel.getEstimate(), utProvider);

  80.     }

  81.     /** {@inheritDoc}. */
  82.     @Override
  83.     protected KalmanEstimation getKalmanEstimation() {
  84.         return processModel;
  85.     }

  86.     /** Set the observer.
  87.      * @param observer the observer
  88.      */
  89.     public void setObserver(final KalmanObserver observer) {
  90.         this.processModel.setObserver(observer);
  91.     }

  92.     /** Process a single measurement.
  93.      * <p>
  94.      * Update the filter with the new measurement by calling the estimate method.
  95.      * </p>
  96.      * @param observedMeasurements the list of measurements to process
  97.      * @return estimated propagators
  98.      */
  99.     public DSSTPropagator processMeasurements(final List<ObservedMeasurement<?>> observedMeasurements) {
  100.         return processModel.processMeasurements(observedMeasurements, filter);
  101.     }

  102. }