Search in sources :

Example 6 with TimeStampedAngularCoordinates

use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.

the class TabulatedProviderTest method createSample.

private List<TimeStampedAngularCoordinates> createSample(double samplingRate, AttitudeProvider referenceProvider) throws OrekitException {
    // reference propagator, using a yaw compensation law
    final KeplerianPropagator referencePropagator = new KeplerianPropagator(circOrbit);
    referencePropagator.setAttitudeProvider(referenceProvider);
    // create sample
    final List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    referencePropagator.setMasterMode(samplingRate, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) {
            sample.add(currentState.getAttitude().getOrientation());
        }
    });
    referencePropagator.propagate(circOrbit.getDate().shiftedBy(2 * circOrbit.getKeplerianPeriod()));
    return sample;
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) ArrayList(java.util.ArrayList) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates)

Example 7 with TimeStampedAngularCoordinates

use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.

the class TabulatedProviderTest method testWithoutRate.

@Test
public void testWithoutRate() throws OrekitException {
    double samplingRate = 10.0;
    double checkingRate = 1.0;
    int n = 8;
    AttitudeProvider referenceProvider = new NadirPointing(circOrbit.getFrame(), earthShape);
    List<TimeStampedAngularCoordinates> sample = createSample(samplingRate, referenceProvider);
    final double margin = samplingRate * n / 2;
    final AbsoluteDate start = sample.get(0).getDate().shiftedBy(margin);
    final AbsoluteDate end = sample.get(sample.size() - 1).getDate().shiftedBy(-margin);
    TabulatedProvider provider = new TabulatedProvider(circOrbit.getFrame(), sample, n, AngularDerivativesFilter.USE_R);
    Assert.assertEquals(0.0, checkError(start, end, checkingRate, referenceProvider, provider), 2.2e-14);
}
Also used : TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 8 with TimeStampedAngularCoordinates

use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.

the class TabulatedProviderTest method testSerialization.

@Test
public void testSerialization() throws OrekitException, IOException, ClassNotFoundException {
    double samplingRate = 60.0;
    double checkingRate = 10.0;
    int n = 8;
    AttitudeProvider referenceProvider = new NadirPointing(circOrbit.getFrame(), earthShape);
    List<TimeStampedAngularCoordinates> sample = createSample(samplingRate, referenceProvider);
    final double margin = samplingRate * n / 2;
    final AbsoluteDate start = sample.get(0).getDate().shiftedBy(margin);
    final AbsoluteDate end = sample.get(sample.size() - 1).getDate().shiftedBy(-margin);
    TabulatedProvider provider = new TabulatedProvider(circOrbit.getFrame(), sample, n, AngularDerivativesFilter.USE_RR);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(provider);
    Assert.assertTrue(bos.size() > 26000);
    Assert.assertTrue(bos.size() < 27000);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    TabulatedProvider deserialized = (TabulatedProvider) ois.readObject();
    Assert.assertEquals(0.0, checkError(start, end, checkingRate, provider, deserialized), 1.0e-20);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Example 9 with TimeStampedAngularCoordinates

use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.

the class TabulatedProviderTest method testWithAcceleration.

@Test
public void testWithAcceleration() throws OrekitException {
    double samplingRate = 10.0;
    double checkingRate = 1.0;
    int n = 8;
    AttitudeProvider referenceProvider = new NadirPointing(circOrbit.getFrame(), earthShape);
    List<TimeStampedAngularCoordinates> sample = createSample(samplingRate, referenceProvider);
    final double margin = samplingRate * n / 2;
    final AbsoluteDate start = sample.get(0).getDate().shiftedBy(margin);
    final AbsoluteDate end = sample.get(sample.size() - 1).getDate().shiftedBy(-margin);
    TabulatedProvider provider = new TabulatedProvider(circOrbit.getFrame(), sample, n, AngularDerivativesFilter.USE_RRA);
    Assert.assertEquals(0.0, checkError(start, end, checkingRate, referenceProvider, provider), 4.3e-9);
    checkField(Decimal64Field.getInstance(), provider, circOrbit, circOrbit.getDate(), circOrbit.getFrame());
}
Also used : TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 10 with TimeStampedAngularCoordinates

use of org.orekit.utils.TimeStampedAngularCoordinates in project Orekit by CS-SI.

the class TabulatedProvider method getAttitude.

/**
 * {@inheritDoc}
 */
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    // get attitudes sample on which interpolation will be performed
    final List<TimeStampedAngularCoordinates> sample = table.getNeighbors(date).collect(Collectors.toList());
    // interpolate
    final TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates.interpolate(date, filter, sample);
    // build the attitude
    return new Attitude(referenceFrame, interpolated);
}
Also used : TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates)

Aggregations

TimeStampedAngularCoordinates (org.orekit.utils.TimeStampedAngularCoordinates)14 Test (org.junit.Test)7 AbsoluteDate (org.orekit.time.AbsoluteDate)5 ArrayList (java.util.ArrayList)4 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)4 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)4 OrekitException (org.orekit.errors.OrekitException)3 LOFType (org.orekit.frames.LOFType)3 Transform (org.orekit.frames.Transform)3 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)3 SpacecraftState (org.orekit.propagation.SpacecraftState)3 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)3 OrekitFixedStepHandler (org.orekit.propagation.sampling.OrekitFixedStepHandler)3 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)3 PVCoordinates (org.orekit.utils.PVCoordinates)3 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectInputStream (java.io.ObjectInputStream)2 ObjectOutputStream (java.io.ObjectOutputStream)2