use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class YawSteeringTest method checkField.
private <T extends RealFieldElement<T>> void checkField(final Field<T> field, final GroundPointing provider, final Orbit orbit, final AbsoluteDate date, final Frame frame) throws OrekitException {
final Attitude attitudeD = provider.getAttitude(orbit, date, frame);
final FieldOrbit<T> orbitF = new FieldSpacecraftState<>(field, new SpacecraftState(orbit)).getOrbit();
final FieldAbsoluteDate<T> dateF = new FieldAbsoluteDate<>(field, date);
final FieldAttitude<T> attitudeF = provider.getAttitude(orbitF, dateF, frame);
Assert.assertEquals(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), 4.0e-14);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 3.0e-12);
final TimeStampedPVCoordinates pvD = provider.getTargetPV(orbit, date, frame);
final TimeStampedFieldPVCoordinates<T> pvF = provider.getTargetPV(orbitF, dateF, frame);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getPosition(), pvF.getPosition().toVector3D()), 2.0e-9);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 7.0e-8);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 4.0e-5);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class EllipseTest method testProjectionDerivatives.
@Test
public void testProjectionDerivatives() throws OrekitException {
Ellipse e = new Ellipse(Vector3D.ZERO, Vector3D.PLUS_I, Vector3D.PLUS_J, 6.4e6, 6.3e6, FramesFactory.getGCRF());
TimeStampedPVCoordinates linearMotion = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, new Vector3D(7.0e6, 5.0e6, 0.0), new Vector3D(3.0e3, 4.0e3, 0.0), Vector3D.ZERO);
TimeStampedPVCoordinates g0 = e.projectToEllipse(linearMotion);
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (double dt = -0.25; dt <= 0.25; dt += 0.125) {
sample.add(e.projectToEllipse(linearMotion.shiftedBy(dt)));
}
TimeStampedPVCoordinates ref = TimeStampedPVCoordinates.interpolate(g0.getDate(), CartesianDerivativesFilter.USE_P, sample);
Assert.assertEquals(0, Vector3D.distance(g0.getPosition(), ref.getPosition()) / ref.getPosition().getNorm(), 1.0e-15);
Assert.assertEquals(0, Vector3D.distance(g0.getVelocity(), ref.getVelocity()) / ref.getVelocity().getNorm(), 6.0e-12);
Assert.assertEquals(0, Vector3D.distance(g0.getAcceleration(), ref.getAcceleration()) / ref.getAcceleration().getNorm(), 8.0e-8);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class OneAxisEllipsoidTest method testGroundProjectionTaylor.
@Test
public void testGroundProjectionTaylor() throws OrekitException {
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.), new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);
TimeStampedPVCoordinates pv0 = orbit.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
PVCoordinatesProvider groundTaylor = model.projectToGround(pv0, model.getBodyFrame()).toTaylorProvider(model.getBodyFrame());
TimeStampedPVCoordinates g0 = groundTaylor.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
Vector3D zenith = pv0.getPosition().subtract(g0.getPosition()).normalize();
Vector3D acrossTrack = Vector3D.crossProduct(zenith, g0.getVelocity()).normalize();
Vector3D alongTrack = Vector3D.crossProduct(acrossTrack, zenith).normalize();
for (double dt = -1; dt < 1; dt += 0.01) {
AbsoluteDate date = orbit.getDate().shiftedBy(dt);
Vector3D taylorP = groundTaylor.getPVCoordinates(date, model.getBodyFrame()).getPosition();
Vector3D refP = model.projectToGround(orbit.getPVCoordinates(date, model.getBodyFrame()).getPosition(), date, model.getBodyFrame());
Vector3D delta = taylorP.subtract(refP);
Assert.assertEquals(0.0, Vector3D.dotProduct(delta, alongTrack), 0.0015);
Assert.assertEquals(0.0, Vector3D.dotProduct(delta, acrossTrack), 0.0007);
Assert.assertEquals(0.0, Vector3D.dotProduct(delta, zenith), 0.00002);
}
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class YawCompensationTest method testTarget.
/**
* Test that pointed target remains the same with or without yaw compensation
*/
@Test
public void testTarget() throws OrekitException {
// Attitude laws
// **************
// Target pointing attitude provider without yaw compensation
NadirPointing nadirLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
// Target pointing attitude provider with yaw compensation
YawCompensation yawCompensLaw = new YawCompensation(circOrbit.getFrame(), nadirLaw);
// Check target
// *************
// without yaw compensation
TimeStampedPVCoordinates noYawObserved = nadirLaw.getTargetPV(circOrbit, date, itrf);
// with yaw compensation
TimeStampedPVCoordinates yawObserved = yawCompensLaw.getTargetPV(circOrbit, date, itrf);
// Check difference
PVCoordinates observedDiff = new PVCoordinates(yawObserved, noYawObserved);
Assert.assertEquals(0.0, observedDiff.getPosition().getNorm(), Utils.epsilonTest);
Assert.assertEquals(0.0, observedDiff.getVelocity().getNorm(), Utils.epsilonTest);
Assert.assertEquals(0.0, observedDiff.getAcceleration().getNorm(), Utils.epsilonTest);
Assert.assertSame(nadirLaw, yawCompensLaw.getUnderlyingAttitudeProvider());
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class YawCompensationTest method testSlidingDerivatives.
/**
* Test the derivatives of the sliding target
*/
@Test
public void testSlidingDerivatives() throws OrekitException {
GroundPointing law = new YawCompensation(circOrbit.getFrame(), new NadirPointing(circOrbit.getFrame(), earthShape));
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (double dt = -0.1; dt < 0.1; dt += 0.01) {
Orbit o = circOrbit.shiftedBy(dt);
sample.add(law.getTargetPV(o, o.getDate(), o.getFrame()));
}
TimeStampedPVCoordinates reference = TimeStampedPVCoordinates.interpolate(circOrbit.getDate(), CartesianDerivativesFilter.USE_P, sample);
TimeStampedPVCoordinates target = law.getTargetPV(circOrbit, circOrbit.getDate(), circOrbit.getFrame());
Assert.assertEquals(0.0, Vector3D.distance(reference.getPosition(), target.getPosition()), 1.0e-15 * reference.getPosition().getNorm());
Assert.assertEquals(0.0, Vector3D.distance(reference.getVelocity(), target.getVelocity()), 3.0e-11 * reference.getVelocity().getNorm());
Assert.assertEquals(0.0, Vector3D.distance(reference.getAcceleration(), target.getAcceleration()), 7.0e-6 * reference.getAcceleration().getNorm());
}
Aggregations