1   /* Copyright 2022-2026 Romain Serra
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.measurements;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.orekit.bodies.BodyShape;
21  import org.orekit.bodies.FieldGeodeticPoint;
22  import org.orekit.bodies.GeodeticPoint;
23  import org.orekit.frames.TopocentricFrame;
24  import org.orekit.propagation.FieldSpacecraftState;
25  import org.orekit.propagation.SpacecraftState;
26  import org.orekit.time.AbsoluteDate;
27  import org.orekit.time.FieldAbsoluteDate;
28  import org.orekit.utils.FieldTrackingCoordinates;
29  import org.orekit.utils.TrackingCoordinates;
30  
31  /** Interface for ground-based observers, for which atmospheric corrections may be applied.
32   *
33   * @author Romain Serra
34   * @since 14.0
35   */
36  public interface GroundObserver extends Observer {
37  
38      /**
39       * Get the parent shape of the ground observer.
40       * @return shape
41       */
42      BodyShape getParentShape();
43  
44      /**
45       * Get the offset geodetic point at the given date.
46       * @param date date
47       * @return geodetic point
48       */
49      GeodeticPoint getOffsetGeodeticPoint(AbsoluteDate date);
50  
51      /**
52       * Get the offset geodetic point at the given date (Field).
53       * @param date date
54       * @return geodetic point
55       * @param <T> type of the field elements
56       */
57      <T extends CalculusFieldElement<T>> FieldGeodeticPoint<T> getOffsetGeodeticPoint(FieldAbsoluteDate<T> date);
58  
59      /**
60       * Get the tracking coordinates (elevation, azimuth and altitude) of a satellite at the given state.
61       * @param state spacecraft state
62       * @return tracking coordinates
63       */
64      default TrackingCoordinates getTrackingCoordinates(final SpacecraftState state) {
65          final TopocentricFrame topocentricFrame = getTopocentricFrame(state.getDate());
66          return topocentricFrame.getTrackingCoordinates(state.getPosition(), state.getFrame(), state.getDate());
67      }
68  
69      /**
70       * Get the tracking coordinates (elevation, azimuth and altitude) of a satellite at the given state (Field).
71       * @param state spacecraft state
72       * @return tracking coordinates
73       * @param <T> type of the field elements
74       */
75      default <T extends CalculusFieldElement<T>> FieldTrackingCoordinates<T> getTrackingCoordinates(final FieldSpacecraftState<T> state) {
76          final TopocentricFrame topocentricFrame = getTopocentricFrame(state.getDate().toAbsoluteDate());
77          return topocentricFrame.getTrackingCoordinates(state.getPosition(), state.getFrame(), state.getDate());
78      }
79  
80      private TopocentricFrame getTopocentricFrame(final AbsoluteDate date) {
81          return new TopocentricFrame(getParentShape(), getOffsetGeodeticPoint(date), "offset");
82      }
83  }