1 /* Copyright 2002-2026 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 java.util.List;
20
21 import org.hipparchus.filtering.kalman.KalmanFilter;
22 import org.hipparchus.linear.MatrixDecomposer;
23 import org.hipparchus.linear.RealMatrix;
24 import org.hipparchus.linear.RealVector;
25 import org.orekit.estimation.ParameterEstimator;
26 import org.orekit.propagation.conversion.PropagatorBuilder;
27 import org.orekit.time.AbsoluteDate;
28 import org.orekit.utils.ParameterDriversList;
29
30 /**
31 * Base class for Kalman estimators.
32 * @author Romain Gerbaud
33 * @author Maxime Journot
34 * @author Luc Maisonobe
35 * @since 11.3
36 */
37 public abstract class AbstractKalmanEstimator implements ParameterEstimator {
38
39 /** List of propagator builder. */
40 private final List<? extends PropagatorBuilder> builders;
41
42 /** Reference date. */
43 private final AbsoluteDate referenceDate;
44
45 /** Observer to retrieve current estimation info. */
46 private KalmanObserver observer;
47
48 /** Matrix decomposer for filter. */
49 private final MatrixDecomposer decomposer;
50
51 /**
52 * Constructor.
53 * @param decomposer matrix decomposer for filter
54 * @param builders list of propagator builders
55 */
56 protected AbstractKalmanEstimator(final MatrixDecomposer decomposer,
57 final List<? extends PropagatorBuilder> builders) {
58 this.builders = builders;
59 this.referenceDate = builders.getFirst().getInitialOrbitDate();
60 this.decomposer = decomposer;
61 this.observer = null;
62 }
63
64 /** Get the current measurement number.
65 * @return current measurement number
66 */
67 public int getCurrentMeasurementNumber() {
68 return getKalmanEstimation().getCurrentMeasurementNumber();
69 }
70
71 /** Get the current date.
72 * @return current date
73 */
74 public AbsoluteDate getCurrentDate() {
75 return getKalmanEstimation().getCurrentDate();
76 }
77
78 /** Set the observer.
79 * @param observer the observer
80 */
81 public void setObserver(final KalmanObserver observer) {
82 this.observer = observer;
83 observer.init(getKalmanEstimation());
84 }
85
86 /** Get the observer.
87 * @return the observer
88 */
89 public KalmanObserver getObserver() {
90 return observer;
91 }
92
93 /** Get the "physical" estimated state (i.e. not normalized)
94 * <p>
95 * For the Semi-analytical Kalman Filters
96 * it corresponds to the corrected filter correction.
97 * In other words, it doesn't represent an orbital state.
98 * </p>
99 * @return the "physical" estimated state
100 */
101 public RealVector getPhysicalEstimatedState() {
102 return getKalmanEstimation().getPhysicalEstimatedState();
103 }
104
105 /** Get the "physical" estimated covariance matrix (i.e. not normalized)
106 * @return the "physical" estimated covariance matrix
107 */
108 public RealMatrix getPhysicalEstimatedCovarianceMatrix() {
109 return getKalmanEstimation().getPhysicalEstimatedCovarianceMatrix();
110 }
111
112 /** Get the list of estimated measurements parameters.
113 * @return the list of estimated measurements parameters
114 */
115 public ParameterDriversList getEstimatedMeasurementsParameters() {
116 return getKalmanEstimation().getEstimatedMeasurementsParameters();
117 }
118
119 /** Get the list of propagator builders.
120 * @return the list of propagator builders
121 */
122 protected List<? extends PropagatorBuilder> getBuilders() {
123 return builders;
124 }
125
126 @Override
127 public PropagatorBuilder[] getPropagatorBuilders() {
128 return getBuilders().toArray(new PropagatorBuilder[0]);
129 }
130
131 /** Get the provider for kalman filter estimations.
132 * @return the provider for Kalman filter estimations
133 */
134 protected abstract KalmanEstimation getKalmanEstimation();
135
136 /** Get the matrix decomposer.
137 * @return the decomposer
138 */
139 protected MatrixDecomposer getMatrixDecomposer() {
140 return decomposer;
141 }
142
143 /** Get the reference date.
144 * @return the date
145 */
146 protected AbsoluteDate getReferenceDate() {
147 return referenceDate;
148 }
149
150 /** Get the Hipparchus filter.
151 * @return the filter
152 */
153 protected abstract KalmanFilter<MeasurementDecorator> getKalmanFilter();
154
155 /** Get the parameter scaling factors.
156 * @return the parameters scale
157 */
158 protected abstract double[] getScale();
159
160 }