use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class KeplerianOrbit method initPVCoordinates.
/**
* {@inheritDoc}
*/
protected TimeStampedPVCoordinates initPVCoordinates() {
// position and velocity
computePVWithoutA();
// acceleration
final double r2 = partialPV.getPosition().getNormSq();
final Vector3D keplerianAcceleration = new Vector3D(-getMu() / (r2 * FastMath.sqrt(r2)), partialPV.getPosition());
final Vector3D acceleration = hasDerivatives() ? keplerianAcceleration.add(nonKeplerianAcceleration()) : keplerianAcceleration;
return new TimeStampedPVCoordinates(getDate(), partialPV.getPosition(), partialPV.getVelocity(), acceleration);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class TargetPointingTest 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()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 1.0e-15);
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()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 1.0e-15);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class YawSteeringTest method testSlidingDerivatives.
/**
* Test the derivatives of the sliding target
*/
@Test
public void testSlidingDerivatives() throws OrekitException {
GroundPointing law = new YawSteering(circOrbit.getFrame(), new NadirPointing(circOrbit.getFrame(), earthShape), CelestialBodyFactory.getSun(), Vector3D.MINUS_I);
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (double dt = -0.1; dt < 0.1; dt += 0.05) {
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()), 4.0e-11 * reference.getVelocity().getNorm());
Assert.assertEquals(0.0, Vector3D.distance(reference.getAcceleration(), target.getAcceleration()), 8.0e-6 * reference.getAcceleration().getNorm());
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class OneAxisEllipsoidTest method testGroundProjectionDerivatives.
@Test
public void testGroundProjectionDerivatives() 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);
double[] errors = derivativesErrors(orbit, orbit.getDate(), eme2000, model);
Assert.assertEquals(0, errors[0], 1.0e-16);
Assert.assertEquals(0, errors[1], 2.0e-12);
Assert.assertEquals(0, errors[2], 2.0e-4);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class OneAxisEllipsoidTest method derivativesErrors.
private double[] derivativesErrors(PVCoordinatesProvider provider, AbsoluteDate date, Frame frame, OneAxisEllipsoid model) throws OrekitException {
List<TimeStampedPVCoordinates> pvList = new ArrayList<TimeStampedPVCoordinates>();
List<TimeStampedPVCoordinates> groundPVList = new ArrayList<TimeStampedPVCoordinates>();
for (double dt = -0.25; dt <= 0.25; dt += 0.125) {
TimeStampedPVCoordinates shiftedPV = provider.getPVCoordinates(date.shiftedBy(dt), frame);
Vector3D p = model.projectToGround(shiftedPV.getPosition(), shiftedPV.getDate(), frame);
pvList.add(shiftedPV);
groundPVList.add(new TimeStampedPVCoordinates(shiftedPV.getDate(), p, Vector3D.ZERO, Vector3D.ZERO));
}
TimeStampedPVCoordinates computed = model.projectToGround(TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, pvList), frame);
TimeStampedPVCoordinates reference = TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, groundPVList);
TimeStampedPVCoordinates pv0 = provider.getPVCoordinates(date, frame);
Vector3D p0 = pv0.getPosition();
Vector3D v0 = pv0.getVelocity();
Vector3D a0 = pv0.getAcceleration();
return new double[] { Vector3D.distance(computed.getPosition(), reference.getPosition()) / p0.getNorm(), Vector3D.distance(computed.getVelocity(), reference.getVelocity()) / v0.getNorm(), Vector3D.distance(computed.getAcceleration(), reference.getAcceleration()) / a0.getNorm() };
}
Aggregations