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
19 import org.hipparchus.linear.MatrixDecomposer;
20 import org.hipparchus.linear.QRDecomposer;
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
26 /** Builder for a Semi-analytical Kalman Filter.
27 * @author Julie Bayard
28 * @author Bryan Cazabonne
29 * @author Maxime Journot
30 * @since 11.1
31 */
32 public class SemiAnalyticalKalmanEstimatorBuilder {
33
34 /** Decomposer to use for the correction phase. */
35 private MatrixDecomposer decomposer;
36
37 /** Builder for propagator. */
38 private DSSTPropagatorBuilder dsstPropagatorBuilder;
39
40 /** Process noise matrix provider. */
41 private CovarianceMatrixProvider processNoiseMatrixProvider;
42
43 /** Estimated measurements parameters. */
44 private ParameterDriversList estimatedMeasurementsParameters;
45
46 /** Process noise matrix provider for measurement parameters. */
47 private CovarianceMatrixProvider measurementProcessNoiseMatrix;
48
49 /** Default constructor.
50 * Set an Extended Semi-analytical Kalman Filter.
51 */
52 public SemiAnalyticalKalmanEstimatorBuilder() {
53 this.decomposer = new QRDecomposer(1.0e-15);
54 this.dsstPropagatorBuilder = null;
55 this.processNoiseMatrixProvider = null;
56 this.estimatedMeasurementsParameters = new ParameterDriversList();
57 this.measurementProcessNoiseMatrix = null;
58 }
59
60 /** Construct a {@link KalmanEstimator} from the data in this builder.
61 * <p>
62 * Before this method is called, {@link #addPropagationConfiguration(DSSTPropagatorBuilder,
63 * CovarianceMatrixProvider) addPropagationConfiguration()} must have been called
64 * at least once, otherwise configuration is incomplete and an exception will be raised.
65 * </p>
66 * @return a new {@link KalmanEstimator}.
67 */
68 public SemiAnalyticalKalmanEstimator build() {
69 if (dsstPropagatorBuilder == null) {
70 throw new OrekitException(OrekitMessages.NO_PROPAGATOR_CONFIGURED);
71 }
72 return new SemiAnalyticalKalmanEstimator(decomposer, dsstPropagatorBuilder, processNoiseMatrixProvider,
73 estimatedMeasurementsParameters, measurementProcessNoiseMatrix);
74 }
75
76 /** Configure the matrix decomposer.
77 * @param matrixDecomposer decomposer to use for the correction phase
78 * @return this object.
79 */
80 public SemiAnalyticalKalmanEstimatorBuilder decomposer(final MatrixDecomposer matrixDecomposer) {
81 decomposer = matrixDecomposer;
82 return this;
83 }
84
85 /** Add a propagation configuration.
86 * <p>
87 * This method must be called once initialize the propagator builder
88 * used by the Kalman Filter.
89 * </p>
90 * @param builder The propagator builder to use in the Kalman filter.
91 * @param provider The process noise matrices provider to use, consistent with the builder.
92 * @return this object.
93 */
94 public SemiAnalyticalKalmanEstimatorBuilder addPropagationConfiguration(final DSSTPropagatorBuilder builder,
95 final CovarianceMatrixProvider provider) {
96 dsstPropagatorBuilder = builder;
97 processNoiseMatrixProvider = provider;
98 return this;
99 }
100
101 /** Configure the estimated measurement parameters.
102 * <p>
103 * If this method is not called, no measurement parameters will be estimated.
104 * </p>
105 * @param estimatedMeasurementsParams The estimated measurements' parameters list.
106 * @param provider covariance matrix provider for the estimated measurement parameters
107 * @return this object.
108 */
109 public SemiAnalyticalKalmanEstimatorBuilder estimatedMeasurementsParameters(final ParameterDriversList estimatedMeasurementsParams,
110 final CovarianceMatrixProvider provider) {
111 estimatedMeasurementsParameters = estimatedMeasurementsParams;
112 measurementProcessNoiseMatrix = provider;
113 return this;
114 }
115
116 }