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;
}
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);
}
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);
}
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());
}
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);
}
Aggregations