TimeStampedFieldAngularCoordinates.java

  1. /* Copyright 2002-2022 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.utils;

  18. import java.util.Collection;

  19. import org.hipparchus.Field;
  20. import org.hipparchus.CalculusFieldElement;
  21. import org.hipparchus.analysis.differentiation.FieldDerivative;
  22. import org.hipparchus.analysis.differentiation.FieldDerivativeStructure;
  23. import org.hipparchus.analysis.interpolation.FieldHermiteInterpolator;
  24. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  25. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  26. import org.hipparchus.geometry.euclidean.threed.RotationConvention;
  27. import org.hipparchus.util.FastMath;
  28. import org.orekit.errors.OrekitException;
  29. import org.orekit.errors.OrekitInternalError;
  30. import org.orekit.errors.OrekitMessages;
  31. import org.orekit.time.AbsoluteDate;
  32. import org.orekit.time.FieldAbsoluteDate;
  33. import org.orekit.time.FieldTimeStamped;
  34. import org.orekit.time.TimeStamped;

  35. /** {@link TimeStamped time-stamped} version of {@link FieldAngularCoordinates}.
  36.  * <p>Instances of this class are guaranteed to be immutable.</p>
  37.  * @param <T> the type of the field elements
  38.  * @author Luc Maisonobe
  39.  * @since 7.0
  40.  */
  41. public class TimeStampedFieldAngularCoordinates<T extends CalculusFieldElement<T>>
  42.     extends FieldAngularCoordinates<T> implements FieldTimeStamped<T> {

  43.     /** The date. */
  44.     private final FieldAbsoluteDate<T> date;

  45.     /** Build the rotation that transforms a pair of pv coordinates into another pair.

  46.      * <p><em>WARNING</em>! This method requires much more stringent assumptions on
  47.      * its parameters than the similar {@link org.hipparchus.geometry.euclidean.threed.Rotation#Rotation(
  48.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D,
  49.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D)
  50.      * constructor} from the {@link org.hipparchus.geometry.euclidean.threed.Rotation Rotation} class.
  51.      * As far as the Rotation constructor is concerned, the {@code v₂} vector from
  52.      * the second pair can be slightly misaligned. The Rotation constructor will
  53.      * compensate for this misalignment and create a rotation that ensure {@code
  54.      * v₁ = r(u₁)} and {@code v₂ ∈ plane (r(u₁), r(u₂))}. <em>THIS IS NOT
  55.      * TRUE ANYMORE IN THIS CLASS</em>! As derivatives are involved and must be
  56.      * preserved, this constructor works <em>only</em> if the two pairs are fully
  57.      * consistent, i.e. if a rotation exists that fulfill all the requirements: {@code
  58.      * v₁ = r(u₁)}, {@code v₂ = r(u₂)}, {@code dv₁/dt = dr(u₁)/dt}, {@code dv₂/dt
  59.      * = dr(u₂)/dt}, {@code d²v₁/dt² = d²r(u₁)/dt²}, {@code d²v₂/dt² = d²r(u₂)/dt²}.</p>

  60.      * @param date coordinates date
  61.      * @param u1 first vector of the origin pair
  62.      * @param u2 second vector of the origin pair
  63.      * @param v1 desired image of u1 by the rotation
  64.      * @param v2 desired image of u2 by the rotation
  65.      * @param tolerance relative tolerance factor used to check singularities
  66.      */
  67.     public TimeStampedFieldAngularCoordinates (final AbsoluteDate date,
  68.                                                final FieldPVCoordinates<T> u1, final FieldPVCoordinates<T> u2,
  69.                                                final FieldPVCoordinates<T> v1, final FieldPVCoordinates<T> v2,
  70.                                                final double tolerance) {
  71.         this(new FieldAbsoluteDate<>(u1.getPosition().getX().getField(), date),
  72.              u1, u2, v1, v2, tolerance);
  73.     }

  74.     /** Build the rotation that transforms a pair of pv coordinates into another pair.

  75.      * <p><em>WARNING</em>! This method requires much more stringent assumptions on
  76.      * its parameters than the similar {@link org.hipparchus.geometry.euclidean.threed.Rotation#Rotation(
  77.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D,
  78.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D)
  79.      * constructor} from the {@link org.hipparchus.geometry.euclidean.threed.Rotation Rotation} class.
  80.      * As far as the Rotation constructor is concerned, the {@code v₂} vector from
  81.      * the second pair can be slightly misaligned. The Rotation constructor will
  82.      * compensate for this misalignment and create a rotation that ensure {@code
  83.      * v₁ = r(u₁)} and {@code v₂ ∈ plane (r(u₁), r(u₂))}. <em>THIS IS NOT
  84.      * TRUE ANYMORE IN THIS CLASS</em>! As derivatives are involved and must be
  85.      * preserved, this constructor works <em>only</em> if the two pairs are fully
  86.      * consistent, i.e. if a rotation exists that fulfill all the requirements: {@code
  87.      * v₁ = r(u₁)}, {@code v₂ = r(u₂)}, {@code dv₁/dt = dr(u₁)/dt}, {@code dv₂/dt
  88.      * = dr(u₂)/dt}, {@code d²v₁/dt² = d²r(u₁)/dt²}, {@code d²v₂/dt² = d²r(u₂)/dt²}.</p>

  89.      * @param date coordinates date
  90.      * @param u1 first vector of the origin pair
  91.      * @param u2 second vector of the origin pair
  92.      * @param v1 desired image of u1 by the rotation
  93.      * @param v2 desired image of u2 by the rotation
  94.      * @param tolerance relative tolerance factor used to check singularities
  95.      */
  96.     public TimeStampedFieldAngularCoordinates (final FieldAbsoluteDate<T> date,
  97.                                                final FieldPVCoordinates<T> u1, final FieldPVCoordinates<T> u2,
  98.                                                final FieldPVCoordinates<T> v1, final FieldPVCoordinates<T> v2,
  99.                                                final double tolerance) {
  100.         super(u1, u2, v1, v2, tolerance);
  101.         this.date = date;
  102.     }

  103.     /** Builds a rotation/rotation rate pair.
  104.      * @param date coordinates date
  105.      * @param rotation rotation
  106.      * @param rotationRate rotation rate Ω (rad/s)
  107.      * @param rotationAcceleration rotation acceleration dΩ/dt (rad²/s²)
  108.      */
  109.     public TimeStampedFieldAngularCoordinates(final AbsoluteDate date,
  110.                                               final FieldRotation<T> rotation,
  111.                                               final FieldVector3D<T> rotationRate,
  112.                                               final FieldVector3D<T> rotationAcceleration) {
  113.         this(new FieldAbsoluteDate<>(rotation.getQ0().getField(), date),
  114.              rotation, rotationRate, rotationAcceleration);
  115.     }

  116.     /** Builds a rotation/rotation rate pair.
  117.      * @param date coordinates date
  118.      * @param rotation rotation
  119.      * @param rotationRate rotation rate Ω (rad/s)
  120.      * @param rotationAcceleration rotation acceleration dΩ/dt (rad²/s²)
  121.      */
  122.     public TimeStampedFieldAngularCoordinates(final FieldAbsoluteDate<T> date,
  123.                                               final FieldRotation<T> rotation,
  124.                                               final FieldVector3D<T> rotationRate,
  125.                                               final FieldVector3D<T> rotationAcceleration) {
  126.         super(rotation, rotationRate, rotationAcceleration);
  127.         this.date = date;
  128.     }

  129.     /** Builds an instance for a regular {@link TimeStampedAngularCoordinates}.
  130.      * @param field fields to which the elements belong
  131.      * @param ac coordinates to convert
  132.      * @since 9.0
  133.      */
  134.     public TimeStampedFieldAngularCoordinates(final Field<T> field,
  135.                                               final TimeStampedAngularCoordinates ac) {
  136.         this(new FieldAbsoluteDate<>(field, ac.getDate()),
  137.              new FieldRotation<>(field, ac.getRotation()),
  138.              new FieldVector3D<>(field, ac.getRotationRate()),
  139.              new FieldVector3D<>(field, ac.getRotationAcceleration()));
  140.     }

  141.     /** Builds a TimeStampedFieldAngularCoordinates from  a {@link FieldRotation}&lt;{@link FieldDerivativeStructure}&gt;.
  142.      * <p>
  143.      * The rotation components must have time as their only derivation parameter and
  144.      * have consistent derivation orders.
  145.      * </p>
  146.      * @param date coordinates date
  147.      * @param r rotation with time-derivatives embedded within the coordinates
  148.      * @param <U> type of the derivative
  149.      * @since 9.2
  150.      */
  151.     public <U extends FieldDerivative<T, U>> TimeStampedFieldAngularCoordinates(final FieldAbsoluteDate<T> date,
  152.                                                                                 final FieldRotation<U> r) {
  153.         super(r);
  154.         this.date = date;
  155.     }

  156.     /** Revert a rotation/rotation rate pair.
  157.      * Build a pair which reverse the effect of another pair.
  158.      * @return a new pair whose effect is the reverse of the effect
  159.      * of the instance
  160.      */
  161.     public TimeStampedFieldAngularCoordinates<T> revert() {
  162.         return new TimeStampedFieldAngularCoordinates<>(date,
  163.                                                         getRotation().revert(),
  164.                                                         getRotation().applyInverseTo(getRotationRate().negate()),
  165.                                                         getRotation().applyInverseTo(getRotationAcceleration().negate()));
  166.     }

  167.     /** {@inheritDoc} */
  168.     @Override
  169.     public FieldAbsoluteDate<T> getDate() {
  170.         return date;
  171.     }

  172.     /** Get a time-shifted state.
  173.      * <p>
  174.      * The state can be slightly shifted to close dates. This shift is based on
  175.      * a simple linear model. It is <em>not</em> intended as a replacement for
  176.      * proper attitude propagation but should be sufficient for either small
  177.      * time shifts or coarse accuracy.
  178.      * </p>
  179.      * @param dt time shift in seconds
  180.      * @return a new state, shifted with respect to the instance (which is immutable)
  181.      */
  182.     public TimeStampedFieldAngularCoordinates<T> shiftedBy(final double dt) {
  183.         return shiftedBy(getDate().getField().getZero().add(dt));
  184.     }

  185.     /** Get a time-shifted state.
  186.      * <p>
  187.      * The state can be slightly shifted to close dates. This shift is based on
  188.      * a simple linear model. It is <em>not</em> intended as a replacement for
  189.      * proper attitude propagation but should be sufficient for either small
  190.      * time shifts or coarse accuracy.
  191.      * </p>
  192.      * @param dt time shift in seconds
  193.      * @return a new state, shifted with respect to the instance (which is immutable)
  194.      */
  195.     public TimeStampedFieldAngularCoordinates<T> shiftedBy(final T dt) {
  196.         final FieldAngularCoordinates<T> sac = super.shiftedBy(dt);
  197.         return new TimeStampedFieldAngularCoordinates<>(date.shiftedBy(dt),
  198.                                                         sac.getRotation(), sac.getRotationRate(), sac.getRotationAcceleration());

  199.     }

  200.     /** Add an offset from the instance.
  201.      * <p>
  202.      * We consider here that the offset rotation is applied first and the
  203.      * instance is applied afterward. Note that angular coordinates do <em>not</em>
  204.      * commute under this operation, i.e. {@code a.addOffset(b)} and {@code
  205.      * b.addOffset(a)} lead to <em>different</em> results in most cases.
  206.      * </p>
  207.      * <p>
  208.      * The two methods {@link #addOffset(FieldAngularCoordinates) addOffset} and
  209.      * {@link #subtractOffset(FieldAngularCoordinates) subtractOffset} are designed
  210.      * so that round trip applications are possible. This means that both {@code
  211.      * ac1.subtractOffset(ac2).addOffset(ac2)} and {@code
  212.      * ac1.addOffset(ac2).subtractOffset(ac2)} return angular coordinates equal to ac1.
  213.      * </p>
  214.      * @param offset offset to subtract
  215.      * @return new instance, with offset subtracted
  216.      * @see #subtractOffset(FieldAngularCoordinates)
  217.      */
  218.     public TimeStampedFieldAngularCoordinates<T> addOffset(final FieldAngularCoordinates<T> offset) {
  219.         final FieldVector3D<T> rOmega    = getRotation().applyTo(offset.getRotationRate());
  220.         final FieldVector3D<T> rOmegaDot = getRotation().applyTo(offset.getRotationAcceleration());
  221.         return new TimeStampedFieldAngularCoordinates<>(date,
  222.                                                         getRotation().compose(offset.getRotation(), RotationConvention.VECTOR_OPERATOR),
  223.                                                         getRotationRate().add(rOmega),
  224.                                                         new FieldVector3D<>( 1.0, getRotationAcceleration(),
  225.                                                                               1.0, rOmegaDot,
  226.                                                                              -1.0, FieldVector3D.crossProduct(getRotationRate(), rOmega)));
  227.     }

  228.     /** Subtract an offset from the instance.
  229.      * <p>
  230.      * We consider here that the offset Rotation is applied first and the
  231.      * instance is applied afterward. Note that angular coordinates do <em>not</em>
  232.      * commute under this operation, i.e. {@code a.subtractOffset(b)} and {@code
  233.      * b.subtractOffset(a)} lead to <em>different</em> results in most cases.
  234.      * </p>
  235.      * <p>
  236.      * The two methods {@link #addOffset(FieldAngularCoordinates) addOffset} and
  237.      * {@link #subtractOffset(FieldAngularCoordinates) subtractOffset} are designed
  238.      * so that round trip applications are possible. This means that both {@code
  239.      * ac1.subtractOffset(ac2).addOffset(ac2)} and {@code
  240.      * ac1.addOffset(ac2).subtractOffset(ac2)} return angular coordinates equal to ac1.
  241.      * </p>
  242.      * @param offset offset to subtract
  243.      * @return new instance, with offset subtracted
  244.      * @see #addOffset(FieldAngularCoordinates)
  245.      */
  246.     public TimeStampedFieldAngularCoordinates<T> subtractOffset(final FieldAngularCoordinates<T> offset) {
  247.         return addOffset(offset.revert());
  248.     }

  249.     /** Interpolate angular coordinates.
  250.      * <p>
  251.      * The interpolated instance is created by polynomial Hermite interpolation
  252.      * on Rodrigues vector ensuring rotation rate remains the exact derivative of rotation.
  253.      * </p>
  254.      * <p>
  255.      * This method is based on Sergei Tanygin's paper <a
  256.      * href="http://www.agi.com/resources/white-papers/attitude-interpolation">Attitude
  257.      * Interpolation</a>, changing the norm of the vector to match the modified Rodrigues
  258.      * vector as described in Malcolm D. Shuster's paper <a
  259.      * href="http://www.ladispe.polito.it/corsi/Meccatronica/02JHCOR/2011-12/Slides/Shuster_Pub_1993h_J_Repsurv_scan.pdf">A
  260.      * Survey of Attitude Representations</a>. This change avoids the singularity at π.
  261.      * There is still a singularity at 2π, which is handled by slightly offsetting all rotations
  262.      * when this singularity is detected.
  263.      * </p>
  264.      * <p>
  265.      * Note that even if first time derivatives (rotation rates)
  266.      * from sample can be ignored, the interpolated instance always includes
  267.      * interpolated derivatives. This feature can be used explicitly to
  268.      * compute these derivatives when it would be too complex to compute them
  269.      * from an analytical formula: just compute a few sample points from the
  270.      * explicit formula and set the derivatives to zero in these sample points,
  271.      * then use interpolation to add derivatives consistent with the rotations.
  272.      * </p>
  273.      * @param date interpolation date
  274.      * @param filter filter for derivatives from the sample to use in interpolation
  275.      * @param sample sample points on which interpolation should be done
  276.      * @param <T> the type of the field elements
  277.      * @return a new position-velocity, interpolated at specified date
  278.      */
  279.     public static <T extends CalculusFieldElement<T>>
  280.         TimeStampedFieldAngularCoordinates<T> interpolate(final AbsoluteDate date,
  281.                                                           final AngularDerivativesFilter filter,
  282.                                                           final Collection<TimeStampedFieldAngularCoordinates<T>> sample) {
  283.         return interpolate(new FieldAbsoluteDate<>(sample.iterator().next().getRotation().getQ0().getField(), date),
  284.                            filter, sample);
  285.     }

  286.     /** Interpolate angular coordinates.
  287.      * <p>
  288.      * The interpolated instance is created by polynomial Hermite interpolation
  289.      * on Rodrigues vector ensuring rotation rate remains the exact derivative of rotation.
  290.      * </p>
  291.      * <p>
  292.      * This method is based on Sergei Tanygin's paper <a
  293.      * href="http://www.agi.com/downloads/resources/white-papers/Attitude-interpolation.pdf">Attitude
  294.      * Interpolation</a>, changing the norm of the vector to match the modified Rodrigues
  295.      * vector as described in Malcolm D. Shuster's paper <a
  296.      * href="http://www.ladispe.polito.it/corsi/Meccatronica/02JHCOR/2011-12/Slides/Shuster_Pub_1993h_J_Repsurv_scan.pdf">A
  297.      * Survey of Attitude Representations</a>. This change avoids the singularity at π.
  298.      * There is still a singularity at 2π, which is handled by slightly offsetting all rotations
  299.      * when this singularity is detected.
  300.      * </p>
  301.      * <p>
  302.      * Note that even if first time derivatives (rotation rates)
  303.      * from sample can be ignored, the interpolated instance always includes
  304.      * interpolated derivatives. This feature can be used explicitly to
  305.      * compute these derivatives when it would be too complex to compute them
  306.      * from an analytical formula: just compute a few sample points from the
  307.      * explicit formula and set the derivatives to zero in these sample points,
  308.      * then use interpolation to add derivatives consistent with the rotations.
  309.      * </p>
  310.      * @param date interpolation date
  311.      * @param filter filter for derivatives from the sample to use in interpolation
  312.      * @param sample sample points on which interpolation should be done
  313.      * @param <T> the type of the field elements
  314.      * @return a new position-velocity, interpolated at specified date
  315.      */
  316.     public static <T extends CalculusFieldElement<T>>
  317.         TimeStampedFieldAngularCoordinates<T> interpolate(final FieldAbsoluteDate<T> date,
  318.                                                           final AngularDerivativesFilter filter,
  319.                                                           final Collection<TimeStampedFieldAngularCoordinates<T>> sample) {

  320.         // get field properties
  321.         final Field<T> field = sample.iterator().next().getRotation().getQ0().getField();

  322.         // set up safety elements for 2π singularity avoidance
  323.         final double epsilon   = 2 * FastMath.PI / sample.size();
  324.         final double threshold = FastMath.min(-(1.0 - 1.0e-4), -FastMath.cos(epsilon / 4));

  325.         // set up a linear model canceling mean rotation rate
  326.         final FieldVector3D<T> meanRate;
  327.         if (filter != AngularDerivativesFilter.USE_R) {
  328.             FieldVector3D<T> sum = FieldVector3D.getZero(field);
  329.             for (final TimeStampedFieldAngularCoordinates<T> datedAC : sample) {
  330.                 sum = sum.add(datedAC.getRotationRate());
  331.             }
  332.             meanRate = new FieldVector3D<>(1.0 / sample.size(), sum);
  333.         } else {
  334.             if (sample.size() < 2) {
  335.                 throw new OrekitException(OrekitMessages.NOT_ENOUGH_DATA_FOR_INTERPOLATION,
  336.                                           sample.size());
  337.             }
  338.             FieldVector3D<T> sum = FieldVector3D.getZero(field);
  339.             TimeStampedFieldAngularCoordinates<T> previous = null;
  340.             for (final TimeStampedFieldAngularCoordinates<T> datedAC : sample) {
  341.                 if (previous != null) {
  342.                     sum = sum.add(estimateRate(previous.getRotation(), datedAC.getRotation(),
  343.                                                datedAC.date.durationFrom(previous.getDate())));
  344.                 }
  345.                 previous = datedAC;
  346.             }
  347.             meanRate = new FieldVector3D<>(1.0 / (sample.size() - 1), sum);
  348.         }
  349.         TimeStampedFieldAngularCoordinates<T> offset =
  350.                 new TimeStampedFieldAngularCoordinates<>(date, FieldRotation.getIdentity(field),
  351.                                                          meanRate, FieldVector3D.getZero(field));

  352.         boolean restart = true;
  353.         for (int i = 0; restart && i < sample.size() + 2; ++i) {

  354.             // offset adaptation parameters
  355.             restart = false;

  356.             // set up an interpolator taking derivatives into account
  357.             final FieldHermiteInterpolator<T> interpolator = new FieldHermiteInterpolator<>();

  358.             // add sample points
  359.             double sign = +1.0;
  360.             FieldRotation<T> previous = FieldRotation.getIdentity(field);

  361.             for (final TimeStampedFieldAngularCoordinates<T> ac : sample) {

  362.                 // remove linear offset from the current coordinates
  363.                 final T dt = ac.date.durationFrom(date);
  364.                 final TimeStampedFieldAngularCoordinates<T> fixed = ac.subtractOffset(offset.shiftedBy(dt));

  365.                 // make sure all interpolated points will be on the same branch
  366.                 final T dot = dt.linearCombination(fixed.getRotation().getQ0(), previous.getQ0(),
  367.                                                    fixed.getRotation().getQ1(), previous.getQ1(),
  368.                                                    fixed.getRotation().getQ2(), previous.getQ2(),
  369.                                                    fixed.getRotation().getQ3(), previous.getQ3());
  370.                 sign = FastMath.copySign(1.0, dot.getReal() * sign);
  371.                 previous = fixed.getRotation();

  372.                 // check modified Rodrigues vector singularity
  373.                 if (fixed.getRotation().getQ0().getReal() * sign < threshold) {
  374.                     // the sample point is close to a modified Rodrigues vector singularity
  375.                     // we need to change the linear offset model to avoid this
  376.                     restart = true;
  377.                     break;
  378.                 }

  379.                 final T[][] rodrigues = fixed.getModifiedRodrigues(sign);
  380.                 switch (filter) {
  381.                     case USE_RRA:
  382.                         // populate sample with rotation, rotation rate and acceleration data
  383.                         interpolator.addSamplePoint(dt, rodrigues[0], rodrigues[1], rodrigues[2]);
  384.                         break;
  385.                     case USE_RR:
  386.                         // populate sample with rotation and rotation rate data
  387.                         interpolator.addSamplePoint(dt, rodrigues[0], rodrigues[1]);
  388.                         break;
  389.                     case USE_R:
  390.                         // populate sample with rotation data only
  391.                         interpolator.addSamplePoint(dt, rodrigues[0]);
  392.                         break;
  393.                     default :
  394.                         // this should never happen
  395.                         throw new OrekitInternalError(null);
  396.                 }
  397.             }

  398.             if (restart) {
  399.                 // interpolation failed, some intermediate rotation was too close to 2π
  400.                 // we need to offset all rotations to avoid the singularity
  401.                 offset = offset.addOffset(new FieldAngularCoordinates<>(new FieldRotation<>(FieldVector3D.getPlusI(field),
  402.                                                                                             field.getZero().add(epsilon),
  403.                                                                                             RotationConvention.VECTOR_OPERATOR),
  404.                                                                         FieldVector3D.getZero(field),
  405.                                                                         FieldVector3D.getZero(field)));
  406.             } else {
  407.                 // interpolation succeeded with the current offset
  408.                 final T[][] p = interpolator.derivatives(field.getZero(), 2);
  409.                 final FieldAngularCoordinates<T> ac = createFromModifiedRodrigues(p);
  410.                 return new TimeStampedFieldAngularCoordinates<>(offset.getDate(),
  411.                                                                 ac.getRotation(),
  412.                                                                 ac.getRotationRate(),
  413.                                                                 ac.getRotationAcceleration()).addOffset(offset);
  414.             }

  415.         }

  416.         // this should never happen
  417.         throw new OrekitInternalError(null);

  418.     }

  419. }