GroundPointingAttitudeModifier.java

  1. /* Copyright 2022-2025 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.attitudes;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.time.AbsoluteDate;
  23. import org.orekit.time.FieldAbsoluteDate;
  24. import org.orekit.utils.FieldPVCoordinatesProvider;
  25. import org.orekit.utils.PVCoordinatesProvider;
  26. import org.orekit.utils.TimeStampedFieldPVCoordinates;
  27. import org.orekit.utils.TimeStampedPVCoordinates;

  28. /**
  29.  * Abstract class for attitude provider modifiers using an underlying ground pointing law.
  30.  *
  31.  * @see GroundPointing
  32.  * @see AttitudeProviderModifier
  33.  * @author Romain Serra
  34.  * @since 12.1
  35.  */
  36. public abstract class GroundPointingAttitudeModifier extends GroundPointing implements AttitudeProviderModifier {

  37.     /**
  38.      * Underlying ground pointing law.
  39.      */
  40.     private final GroundPointing groundPointingLaw;

  41.     /** Constructor.
  42.      * @param inertialFrame frame in which orbital velocities are computed
  43.      * @param bodyFrame the frame that rotates with the body
  44.      * @param groundPointingLaw underlying ground pointing attitude law
  45.      */
  46.     protected GroundPointingAttitudeModifier(final Frame inertialFrame, final Frame bodyFrame,
  47.                                              final GroundPointing groundPointingLaw) {
  48.         super(inertialFrame, bodyFrame);
  49.         this.groundPointingLaw = groundPointingLaw;
  50.     }

  51.     /**
  52.      * Getter for underlying ground pointing law.
  53.      * @return underlying attitude provider, which in this case is a {@link GroundPointing} instance
  54.      */
  55.     @Override
  56.     public GroundPointing getUnderlyingAttitudeProvider() {
  57.         return groundPointingLaw;
  58.     }

  59.     /** Compute the base system state at given date, without modifications.
  60.      * @param pvProv provider for PV coordinates
  61.      * @param date date at which state is requested
  62.      * @param frame reference frame from which attitude is computed
  63.      * @return satellite base attitude state.
  64.      */
  65.     public Attitude getBaseState(final PVCoordinatesProvider pvProv,
  66.                                  final AbsoluteDate date, final Frame frame) {
  67.         return getUnderlyingAttitudeProvider().getAttitude(pvProv, date, frame);
  68.     }

  69.     /** Compute the base system state at given date, without modifications.
  70.      * @param pvProv provider for PV coordinates
  71.      * @param date date at which state is requested
  72.      * @param frame reference frame from which attitude is computed
  73.      * @param <T> type of the field elements
  74.      * @return satellite base attitude state.
  75.      */
  76.     public <T extends CalculusFieldElement<T>> FieldAttitude<T> getBaseState(final FieldPVCoordinatesProvider<T> pvProv,
  77.                                                                              final FieldAbsoluteDate<T> date, final Frame frame) {
  78.         return getUnderlyingAttitudeProvider().getAttitude(pvProv, date, frame);
  79.     }

  80.     /** {@inheritDoc} */
  81.     @Override
  82.     public TimeStampedPVCoordinates getTargetPV(final PVCoordinatesProvider pvProv,
  83.                                                 final AbsoluteDate date, final Frame frame) {
  84.         return groundPointingLaw.getTargetPV(pvProv, date, frame);
  85.     }

  86.     /** {@inheritDoc} */
  87.     @Override
  88.     protected Vector3D getTargetPosition(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) {
  89.         return groundPointingLaw.getTargetPosition(pvProv, date, frame);
  90.     }

  91.     /** {@inheritDoc} */
  92.     @Override
  93.     public <T extends CalculusFieldElement<T>> TimeStampedFieldPVCoordinates<T> getTargetPV(final FieldPVCoordinatesProvider<T> pvProv,
  94.                                                                                             final FieldAbsoluteDate<T> date,
  95.                                                                                             final Frame frame) {
  96.         return groundPointingLaw.getTargetPV(pvProv, date, frame);
  97.     }

  98.     /** {@inheritDoc} */
  99.     @Override
  100.     protected <T extends CalculusFieldElement<T>> FieldVector3D<T> getTargetPosition(final FieldPVCoordinatesProvider<T> pvProv,
  101.                                                                                      final FieldAbsoluteDate<T> date,
  102.                                                                                      final Frame frame) {
  103.         return groundPointingLaw.getTargetPosition(pvProv, date, frame);
  104.     }
  105. }