use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class TransformTest method testAccelerationComposition.
@Test
public void testAccelerationComposition() {
RandomGenerator random = new Well19937a(0x41fdd07d6c9e9f65l);
Vector3D p1 = randomVector(1.0e3, random);
Vector3D v1 = randomVector(1.0, random);
Vector3D a1 = randomVector(1.0e-3, random);
Rotation r1 = randomRotation(random);
Vector3D o1 = randomVector(0.1, random);
Vector3D p2 = randomVector(1.0e3, random);
Vector3D v2 = randomVector(1.0, random);
Vector3D a2 = randomVector(1.0e-3, random);
Rotation r2 = randomRotation(random);
Vector3D o2 = randomVector(0.1, random);
Transform t1 = new Transform(AbsoluteDate.J2000_EPOCH, new Transform(AbsoluteDate.J2000_EPOCH, p1, v1, a1), new Transform(AbsoluteDate.J2000_EPOCH, r1, o1));
Transform t2 = new Transform(AbsoluteDate.J2000_EPOCH, new Transform(AbsoluteDate.J2000_EPOCH, p2, v2, a2), new Transform(AbsoluteDate.J2000_EPOCH, r2, o2));
Transform t12 = new Transform(AbsoluteDate.J2000_EPOCH, t1, t2);
Vector3D q = randomVector(1.0e3, random);
Vector3D qDot = randomVector(1.0, random);
Vector3D qDotDot = randomVector(1.0e-3, random);
PVCoordinates pva0 = new PVCoordinates(q, qDot, qDotDot);
PVCoordinates pva1 = t1.transformPVCoordinates(pva0);
PVCoordinates pva2 = t2.transformPVCoordinates(pva1);
PVCoordinates pvac = t12.transformPVCoordinates(pva0);
checkVector(pva2.getPosition(), pvac.getPosition(), 1.0e-15);
checkVector(pva2.getVelocity(), pvac.getVelocity(), 1.0e-15);
checkVector(pva2.getAcceleration(), pvac.getAcceleration(), 1.0e-15);
// despite neither raw transforms have angular acceleration,
// the combination does have an angular acceleration,
// it is due to the cross product Ω₁ ⨯ Ω₂
Assert.assertEquals(0.0, t1.getAngular().getRotationAcceleration().getNorm(), 1.0e-15);
Assert.assertEquals(0.0, t2.getAngular().getRotationAcceleration().getNorm(), 1.0e-15);
Assert.assertTrue(t12.getAngular().getRotationAcceleration().getNorm() > 0.01);
Assert.assertEquals(0.0, t12.freeze().getCartesian().getVelocity().getNorm(), 1.0e-15);
Assert.assertEquals(0.0, t12.freeze().getCartesian().getAcceleration().getNorm(), 1.0e-15);
Assert.assertEquals(0.0, t12.freeze().getAngular().getRotationRate().getNorm(), 1.0e-15);
Assert.assertEquals(0.0, t12.freeze().getAngular().getRotationAcceleration().getNorm(), 1.0e-15);
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class L2TransformProviderTest method testTransformationOrientationForEarthMoon.
@Test
public void testTransformationOrientationForEarthMoon() throws OrekitException {
// Load Bodies
final CelestialBody earth = CelestialBodyFactory.getEarth();
final CelestialBody moon = CelestialBodyFactory.getMoon();
// Set framesd
final Frame eme2000 = FramesFactory.getEME2000();
final Frame l2Frame = new L2Frame(earth, moon);
// Time settings
final AbsoluteDate date = new AbsoluteDate(2000, 01, 01, 0, 0, 00.000, TimeScalesFactory.getUTC());
// Compute Moon position in EME2000
PVCoordinates pvMoon = moon.getPVCoordinates(date, eme2000);
Vector3D posMoon = pvMoon.getPosition();
// Compute L2 position in EME2000
// (it is important to use transformPosition(Vector3D.ZERO) and *not* getTranslation()
// because the test should avoid doing wrong interpretation of the meaning and
// particularly on the sign of the translation)
Vector3D posL2 = l2Frame.getTransformTo(eme2000, date).transformPosition(Vector3D.ZERO);
// check L2 and Moon are aligned as seen from Earth
Assert.assertEquals(0.0, Vector3D.angle(posMoon, posL2), 1.0e-10);
// check L2 if at least 60 000km farther than Moon
Assert.assertTrue(posL2.getNorm() > posMoon.getNorm() + 6.0e7);
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class L2TransformProviderTest method testSunJupiter.
@Test
public void testSunJupiter() throws OrekitException {
// Load Bodies
final CelestialBody sun = CelestialBodyFactory.getSun();
final CelestialBody jupiter = CelestialBodyFactory.getJupiter();
// Set frames
final Frame sunFrame = sun.getInertiallyOrientedFrame();
final Frame l2Frame = new L2Frame(sun, jupiter);
// Time settings
final AbsoluteDate date = new AbsoluteDate(2000, 01, 01, 0, 0, 00.000, TimeScalesFactory.getUTC());
// Compute Jupiter position in Sun centered frame
PVCoordinates pvJupiter = jupiter.getPVCoordinates(date, sunFrame);
Vector3D posJupiter = pvJupiter.getPosition();
// Compute L2 position in Sun centered frame
// (it is important to use transformPosition(Vector3D.ZERO) and *not* getTranslation()
// because the test should avoid doing wrong interpretation of the meaning and
// particularly on the sign of the translation)
Vector3D posL2 = l2Frame.getTransformTo(sunFrame, date).transformPosition(Vector3D.ZERO);
// check L2 and Jupiter are aligned as seen from Sun
Assert.assertEquals(0.0, Vector3D.angle(posJupiter, posL2), 1.0e-10);
// check L2 if at least 50 000 000km farther than Jupiter
Assert.assertTrue(posL2.getNorm() > posJupiter.getNorm() + 5.0e10);
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class LocalOrbitalFrameTest method checkFrame.
private void checkFrame(LOFType type, AbsoluteDate date, Vector3D expectedXDirection, Vector3D expectedYDirection, Vector3D expectedZDirection, Vector3D expectedRotationDirection) throws OrekitException {
LocalOrbitalFrame lof = new LocalOrbitalFrame(FramesFactory.getGCRF(), type, provider, type.name());
Transform t = lof.getTransformTo(FramesFactory.getGCRF(), date);
PVCoordinates pv1 = t.transformPVCoordinates(PVCoordinates.ZERO);
Vector3D p1 = pv1.getPosition();
Vector3D v1 = pv1.getVelocity();
PVCoordinates pv2 = provider.getPVCoordinates(date, FramesFactory.getGCRF());
Vector3D p2 = pv2.getPosition();
Vector3D v2 = pv2.getVelocity();
Assert.assertEquals(0, p1.subtract(p2).getNorm(), 1.0e-14 * p1.getNorm());
Assert.assertEquals(0, v1.subtract(v2).getNorm(), 1.0e-14 * v1.getNorm());
Vector3D xDirection = t.transformVector(Vector3D.PLUS_I);
Vector3D yDirection = t.transformVector(Vector3D.PLUS_J);
Vector3D zDirection = t.transformVector(Vector3D.PLUS_K);
Assert.assertEquals(0, Vector3D.angle(expectedXDirection, xDirection), 2.0e-15);
Assert.assertEquals(0, Vector3D.angle(expectedYDirection, yDirection), 1.0e-15);
Assert.assertEquals(0, Vector3D.angle(expectedZDirection, zDirection), 1.0e-15);
Assert.assertEquals(0, Vector3D.angle(expectedRotationDirection, t.getRotationRate()), 1.0e-15);
Assert.assertEquals(initialOrbit.getKeplerianMeanMotion(), t.getRotationRate().getNorm(), 1.0e-7);
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class LocalOrbitalFrameTest method testVNC.
@Test
public void testVNC() throws OrekitException {
AbsoluteDate date = initDate.shiftedBy(400);
PVCoordinates pv = provider.getPVCoordinates(date, inertialFrame);
checkFrame(LOFType.VNC, date, pv.getVelocity(), pv.getMomentum(), Vector3D.crossProduct(pv.getVelocity(), pv.getMomentum()), pv.getMomentum().negate());
}
Aggregations