SemiAnalyticalKalmanEstimatorBuilder.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.orekit.errors.OrekitException;
  21. import org.orekit.errors.OrekitMessages;
  22. import org.orekit.propagation.conversion.DSSTPropagatorBuilder;
  23. import org.orekit.utils.ParameterDriversList;

  24. /** Builder for a Semi-analytical Kalman Filter.
  25.  * @author Julie Bayard
  26.  * @author Bryan Cazabonne
  27.  * @author Maxime Journot
  28.  * @since 11.1
  29.  */
  30. public class SemiAnalyticalKalmanEstimatorBuilder {

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

  33.     /** Builder for propagator. */
  34.     private DSSTPropagatorBuilder dsstPropagatorBuilder;

  35.     /** Process noise matrix provider. */
  36.     private CovarianceMatrixProvider processNoiseMatrixProvider;

  37.     /** Estimated measurements parameters. */
  38.     private ParameterDriversList estimatedMeasurementsParameters;

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

  41.     /** Default constructor.
  42.      *  Set an Extended Semi-analytical Kalman Filter.
  43.      */
  44.     public SemiAnalyticalKalmanEstimatorBuilder() {
  45.         this.decomposer                      = new QRDecomposer(1.0e-15);
  46.         this.dsstPropagatorBuilder           = null;
  47.         this.processNoiseMatrixProvider      = null;
  48.         this.estimatedMeasurementsParameters = new ParameterDriversList();
  49.         this.measurementProcessNoiseMatrix   = null;
  50.     }

  51.     /** Construct a {@link KalmanEstimator} from the data in this builder.
  52.      * <p>
  53.      * Before this method is called, {@link #addPropagationConfiguration(DSSTPropagatorBuilder,
  54.      * CovarianceMatrixProvider) addPropagationConfiguration()} must have been called
  55.      * at least once, otherwise configuration is incomplete and an exception will be raised.
  56.      * </p>
  57.      * @return a new {@link KalmanEstimator}.
  58.      */
  59.     public SemiAnalyticalKalmanEstimator build() {
  60.         if (dsstPropagatorBuilder == null) {
  61.             throw new OrekitException(OrekitMessages.NO_PROPAGATOR_CONFIGURED);
  62.         }
  63.         return new SemiAnalyticalKalmanEstimator(decomposer, dsstPropagatorBuilder, processNoiseMatrixProvider,
  64.                                                  estimatedMeasurementsParameters, measurementProcessNoiseMatrix);
  65.     }

  66.     /** Configure the matrix decomposer.
  67.      * @param matrixDecomposer decomposer to use for the correction phase
  68.      * @return this object.
  69.      */
  70.     public SemiAnalyticalKalmanEstimatorBuilder decomposer(final MatrixDecomposer matrixDecomposer) {
  71.         decomposer = matrixDecomposer;
  72.         return this;
  73.     }

  74.     /** Add a propagation configuration.
  75.      * <p>
  76.      * This method must be called once initialize the propagator builder
  77.      * used by the Kalman Filter.
  78.      * </p>
  79.      * @param builder The propagator builder to use in the Kalman filter.
  80.      * @param provider The process noise matrices provider to use, consistent with the builder.
  81.      * @return this object.
  82.      */
  83.     public SemiAnalyticalKalmanEstimatorBuilder addPropagationConfiguration(final DSSTPropagatorBuilder builder,
  84.                                                                             final CovarianceMatrixProvider provider) {
  85.         dsstPropagatorBuilder      = builder;
  86.         processNoiseMatrixProvider = provider;
  87.         return this;
  88.     }

  89.     /** Configure the estimated measurement parameters.
  90.      * <p>
  91.      * If this method is not called, no measurement parameters will be estimated.
  92.      * </p>
  93.      * @param estimatedMeasurementsParams The estimated measurements' parameters list.
  94.      * @param provider covariance matrix provider for the estimated measurement parameters
  95.      * @return this object.
  96.      */
  97.     public SemiAnalyticalKalmanEstimatorBuilder estimatedMeasurementsParameters(final ParameterDriversList estimatedMeasurementsParams,
  98.                                                                                 final CovarianceMatrixProvider provider) {
  99.         estimatedMeasurementsParameters = estimatedMeasurementsParams;
  100.         measurementProcessNoiseMatrix   = provider;
  101.         return this;
  102.     }

  103. }