Search in sources :

Example 81 with PVCoordinates

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);
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) Well19937a(org.hipparchus.random.Well19937a) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) RandomGenerator(org.hipparchus.random.RandomGenerator) Test(org.junit.Test)

Example 82 with PVCoordinates

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);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) PVCoordinates(org.orekit.utils.PVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 83 with PVCoordinates

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);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) PVCoordinates(org.orekit.utils.PVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 84 with PVCoordinates

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);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates)

Example 85 with PVCoordinates

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());
}
Also used : PVCoordinates(org.orekit.utils.PVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

PVCoordinates (org.orekit.utils.PVCoordinates)341 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)271 Test (org.junit.Test)242 AbsoluteDate (org.orekit.time.AbsoluteDate)189 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)159 SpacecraftState (org.orekit.propagation.SpacecraftState)95 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)76 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)73 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)71 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)67 Orbit (org.orekit.orbits.Orbit)65 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)57 Frame (org.orekit.frames.Frame)53 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)44 CartesianOrbit (org.orekit.orbits.CartesianOrbit)43 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)42 DateComponents (org.orekit.time.DateComponents)40 CircularOrbit (org.orekit.orbits.CircularOrbit)37 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)30 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)30