SemiAnalyticalUnscentedKalmanEstimatorBuilder.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 org.hipparchus.linear.MatrixDecomposer;
  19. import org.hipparchus.linear.QRDecomposer;
  20. import org.hipparchus.util.UnscentedTransformProvider;
  21. import org.orekit.errors.OrekitException;
  22. import org.orekit.errors.OrekitMessages;
  23. import org.orekit.propagation.conversion.DSSTPropagatorBuilder;
  24. import org.orekit.utils.ParameterDriversList;

  25. /** Builder for an Unscented Semi-analytical Kalman filter estimator.
  26.  * @author GaĆ«tan Pierre
  27.  * @author Bryan Cazabonne
  28.  * @since 11.3
  29.  */
  30. public class SemiAnalyticalUnscentedKalmanEstimatorBuilder {

  31.     /** Decomposer to use for the correction phase. */
  32.     private MatrixDecomposer decomposer;

  33.     /** Builders for propagator. */
  34.     private DSSTPropagatorBuilder propagatorBuilder;

  35.     /** Estimated measurements parameters. */
  36.     private ParameterDriversList estimatedMeasurementsParameters;

  37.     /** Process noise matrix provider. */
  38.     private CovarianceMatrixProvider processNoiseMatrixProvider;

  39.     /** Process noise matrix provider for measurement parameters. */
  40.     private CovarianceMatrixProvider measurementProcessNoiseMatrix;

  41.     /** Unscend transform provider. */
  42.     private UnscentedTransformProvider utProvider;

  43.     /** Default constructor.
  44.      *  Set an Unscented Semi-analytical Kalman filter.
  45.      */
  46.     public SemiAnalyticalUnscentedKalmanEstimatorBuilder() {
  47.         this.decomposer                      = new QRDecomposer(1.0e-15);
  48.         this.propagatorBuilder               = null;
  49.         this.estimatedMeasurementsParameters = new ParameterDriversList();
  50.         this.processNoiseMatrixProvider      = null;
  51.         this.measurementProcessNoiseMatrix   = null;
  52.         this.utProvider                      = null;
  53.     }

  54.     /** Construct a {@link SemiAnalyticalUnscentedKalmanEstimator} from the data in this builder.
  55.      * <p>
  56.      * Before this method is called, {@link #addPropagationConfiguration(DSSTPropagatorBuilder,
  57.      * CovarianceMatrixProvider) addPropagationConfiguration()} must have been called
  58.      * at least once, otherwise configuration is incomplete and an exception will be raised.
  59.      * <p>
  60.      * In addition, the {@link #unscentedTransformProvider(UnscentedTransformProvider)
  61.      * unscentedTransformProvider()} must be called to configure the unscented transform
  62.      * provider use during the estimation process, otherwise configuration is
  63.      * incomplete and an exception will be raised.
  64.      * </p>
  65.      * @return a new {@link SemiAnalyticalUnscentedKalmanEstimator}.
  66.      */
  67.     public SemiAnalyticalUnscentedKalmanEstimator build() {
  68.         if (propagatorBuilder == null) {
  69.             throw new OrekitException(OrekitMessages.NO_PROPAGATOR_CONFIGURED);
  70.         }
  71.         if (utProvider == null) {
  72.             throw new OrekitException(OrekitMessages.NO_UNSCENTED_TRANSFORM_CONFIGURED);
  73.         }
  74.         return new SemiAnalyticalUnscentedKalmanEstimator(decomposer, propagatorBuilder, processNoiseMatrixProvider,
  75.                                                           estimatedMeasurementsParameters, measurementProcessNoiseMatrix,
  76.                                                           utProvider);
  77.     }

  78.     /** Configure the matrix decomposer.
  79.      * @param matrixDecomposer decomposer to use for the correction phase
  80.      * @return this object.
  81.      */
  82.     public SemiAnalyticalUnscentedKalmanEstimatorBuilder decomposer(final MatrixDecomposer matrixDecomposer) {
  83.         decomposer = matrixDecomposer;
  84.         return this;
  85.     }

  86.     /** Configure the unscented transform provider.
  87.      * @param transformProvider unscented transform to use for the prediction phase
  88.      * @return this object.
  89.      */
  90.     public SemiAnalyticalUnscentedKalmanEstimatorBuilder unscentedTransformProvider(final UnscentedTransformProvider transformProvider) {
  91.         this.utProvider = transformProvider;
  92.         return this;
  93.     }

  94.     /** Add a propagation configuration.
  95.      * <p>
  96.      * This method must be called once initialize the propagator builder
  97.      * used by the Semi-Analytical Unscented Kalman Filter.
  98.      * </p>
  99.      * @param builder The propagator builder to use in the Kalman filter.
  100.      * @param provider The process noise matrices provider to use, consistent with the builder.
  101.      * @return this object.
  102.      */
  103.     public SemiAnalyticalUnscentedKalmanEstimatorBuilder addPropagationConfiguration(final DSSTPropagatorBuilder builder,
  104.                                                                                      final CovarianceMatrixProvider provider) {
  105.         propagatorBuilder          = builder;
  106.         processNoiseMatrixProvider = provider;
  107.         return this;
  108.     }

  109.     /** Configure the estimated measurement parameters.
  110.      * <p>
  111.      * If this method is not called, no measurement parameters will be estimated.
  112.      * </p>
  113.      * @param estimatedMeasurementsParams The estimated measurements' parameters list.
  114.      * @param provider covariance matrix provider for the estimated measurement parameters
  115.      * @return this object.
  116.      */
  117.     public SemiAnalyticalUnscentedKalmanEstimatorBuilder estimatedMeasurementsParameters(final ParameterDriversList estimatedMeasurementsParams,
  118.                                                                                          final CovarianceMatrixProvider provider) {
  119.         estimatedMeasurementsParameters = estimatedMeasurementsParams;
  120.         measurementProcessNoiseMatrix   = provider;
  121.         return this;
  122.     }

  123. }