AttitudeEphemerisFile.java

  1. /* Contributed in the public domain.
  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.files.general;

  18. import java.util.ArrayList;
  19. import java.util.List;
  20. import java.util.Map;

  21. import org.hipparchus.geometry.euclidean.threed.RotationOrder;
  22. import org.orekit.attitudes.AggregateBoundedAttitudeProvider;
  23. import org.orekit.attitudes.BoundedAttitudeProvider;
  24. import org.orekit.frames.Frame;
  25. import org.orekit.time.AbsoluteDate;
  26. import org.orekit.time.TimeScale;
  27. import org.orekit.utils.AngularDerivativesFilter;
  28. import org.orekit.utils.TimeStampedAngularCoordinates;

  29. /**
  30.  * An interface for accessing the data stored in an attitude ephemeris file.
  31.  *
  32.  * <p> An {@link AttitudeEphemerisFile} consists of one or more satellites each with a unique ID
  33.  * within the file. The ephemeris for each satellite consists of one or more segments.
  34.  *
  35.  * <p> Some attitude ephemeris file formats may supply additional information that is not available
  36.  * via this interface. In those cases it is recommended that the parser return a subclass
  37.  * of this interface to provide access to the additional information.
  38.  *
  39.  * @author Raphaël Fermé
  40.  * @see SatelliteAttitudeEphemeris
  41.  * @see AttitudeEphemerisSegment
  42.  * @since 10.3
  43.  */
  44. public interface AttitudeEphemerisFile {

  45.     /**
  46.      * Get the loaded ephemeris for each satellite in the file.
  47.      *
  48.      * @return a map from the satellite's ID to the information about that satellite
  49.      * contained in the file.
  50.      */
  51.     Map<String, ? extends SatelliteAttitudeEphemeris> getSatellites();

  52.     /**
  53.      * Contains the information about a single satellite from an {@link AttitudeEphemerisFile}.
  54.      *
  55.      * <p> A satellite ephemeris consists of one or more {@link AttitudeEphemerisSegment}.
  56.      * Segments are typically used to split up an ephemeris at discontinuous events.
  57.      *
  58.      * @author Raphaël Fermé
  59.      * @see AttitudeEphemerisFile
  60.      * @see AttitudeEphemerisSegment
  61.      * @since 10.3
  62.      */
  63.     interface SatelliteAttitudeEphemeris {

  64.         /**
  65.          * Get the satellite ID. The satellite ID is unique only within the same ephemeris
  66.          * file.
  67.          *
  68.          * @return the satellite's ID, never {@code null}.
  69.          */
  70.         String getId();

  71.         /**
  72.          * Get the segments of the attitude ephemeris.
  73.          *
  74.          * <p> Attitude ephemeris segments are typically used to split an ephemeris around
  75.          * discontinuous events.
  76.          *
  77.          * @return the segments contained in the attitude ephemeris file for this satellite.
  78.          */
  79.         List<? extends AttitudeEphemerisSegment> getSegments();

  80.         /**
  81.          * Get the start date of the ephemeris.
  82.          *
  83.          * @return ephemeris start date.
  84.          */
  85.         AbsoluteDate getStart();

  86.         /**
  87.          * Get the end date of the ephemeris.
  88.          *
  89.          * @return ephemeris end date.
  90.          */
  91.         AbsoluteDate getStop();

  92.         /**
  93.          * Get the attitude provider corresponding to this ephemeris, combining data from all {@link
  94.          * #getSegments() segments}.
  95.          *
  96.          * @return an attitude provider for all the data in this attitude ephemeris file.
  97.          */
  98.         default BoundedAttitudeProvider getAttitudeProvider() {
  99.             final List<BoundedAttitudeProvider> providers = new ArrayList<>();
  100.             for (final AttitudeEphemerisSegment attitudeSegment : this.getSegments()) {
  101.                 providers.add(attitudeSegment.getAttitudeProvider());
  102.             }
  103.             return new AggregateBoundedAttitudeProvider(providers);
  104.         }

  105.     }

  106.     /**
  107.      * A segment of an attitude ephemeris for a satellite.
  108.      *
  109.      * <p> Segments are typically used to split an ephemeris around discontinuous events
  110.      * such as maneuvers.
  111.      *
  112.      * @author Raphaël Fermé
  113.      * @see AttitudeEphemerisFile
  114.      * @see SatelliteAttitudeEphemeris
  115.      * @since 10.3
  116.      */
  117.     interface AttitudeEphemerisSegment {

  118.         /**
  119.          * Get an unmodifiable list of attitude data lines.
  120.          *
  121.          * @return a list of attitude data
  122.          */
  123.         List<? extends TimeStampedAngularCoordinates> getAngularCoordinates();

  124.         /**
  125.          * Get the name of the center of the coordinate system the ephemeris is provided
  126.          * in. This may be a natural origin, such as the center of the Earth, another
  127.          * satellite, etc.
  128.          *
  129.          * @return the name of the frame center
  130.          */
  131.         String getFrameCenterString();

  132.         /**
  133.          * Get the reference frame A specifier as it appeared in the file.
  134.          *
  135.          * @return the frame name as it appeared in the file (A).
  136.          */
  137.         String getRefFrameAString();

  138.         /**
  139.          * Get the reference frame B specifier as it appeared in the file.
  140.          *
  141.          * @return the frame name as it appeared in the file (B).
  142.          */
  143.         String getRefFrameBString();

  144.         /**
  145.          * Get the reference frame from which attitude is defined.
  146.          *
  147.          * @return the reference frame from which attitude is defined
  148.          */
  149.         Frame getReferenceFrame();

  150.         /**
  151.          * Get the rotation direction of the attitude.
  152.          *
  153.          * @return the rotation direction of the attitude
  154.          */
  155.         String getAttitudeDirection();

  156.         /**
  157.          * Get the format of the data lines in the message.
  158.          *
  159.          * @return the format of the data lines in the message
  160.          */
  161.         String getAttitudeType();

  162.         /**
  163.          * Get the flag for the placement of the quaternion QC in the attitude data.
  164.          *
  165.          * @return true if QC is the first element in the attitude data
  166.          */
  167.         boolean isFirst();

  168.         /**
  169.          * Get the rotation order for Euler angles.
  170.          *
  171.          * @return rotation order
  172.          */
  173.         RotationOrder getRotationOrder();

  174.         /**
  175.          * Get the time scale for this ephemeris segment.
  176.          *
  177.          * @return the time scale identifier, as specified in the ephemeris file, or
  178.          * {@code null} if the ephemeris file does not specify a time scale.
  179.          */
  180.         String getTimeScaleString();

  181.         /**
  182.          * Get the time scale for this ephemeris segment.
  183.          *
  184.          * @return the time scale for this segment. Never {@code null}.
  185.          */
  186.         TimeScale getTimeScale();

  187.         /**
  188.          * Get the start date of this ephemeris segment.
  189.          *
  190.          * @return ephemeris segment start date.
  191.          */
  192.         AbsoluteDate getStart();

  193.         /**
  194.          * Get the end date of this ephemeris segment.
  195.          *
  196.          * @return ephemeris segment end date.
  197.          */
  198.         AbsoluteDate getStop();

  199.         /**
  200.          * Get the interpolation method to be used.
  201.          *
  202.          * @return the interpolation method
  203.          */
  204.         String getInterpolationMethod();

  205.         /**
  206.          * Get the number of samples to use in interpolation.
  207.          *
  208.          * @return the number of points to use for interpolation.
  209.          */
  210.         int getInterpolationSamples();

  211.         /**
  212.          * Get which derivatives of angular data are available in this attitude ephemeris segment.
  213.          *
  214.          * @return a value indicating if the file contains rotation and/or rotation rate
  215.          *         and/or acceleration data.
  216.          */
  217.         AngularDerivativesFilter getAvailableDerivatives();

  218.         /**
  219.          * Get the attitude provider for this attitude ephemeris segment.
  220.          *
  221.          * @return the attitude provider for this attitude ephemeris segment.
  222.          */
  223.         default BoundedAttitudeProvider getAttitudeProvider() {
  224.             return new EphemerisSegmentAttitudeProvider(this);
  225.         }

  226.     }

  227. }