Search in sources :

Example 51 with TimeStampedPVCoordinates

use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.

the class NadirPointingTest method testVertical.

/**
 * Vertical test : check that Z satellite axis is collinear to local vertical axis,
 *        which direction is : (cos(lon)*cos(lat), sin(lon)*cos(lat), sin(lat)),
 *        where lon et lat stand for observed point coordinates
 *        (i.e satellite ones, since they are the same by construction,
 *        but that's what is to test.
 */
@Test
public void testVertical() throws OrekitException {
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create earth center pointing attitude provider
    NadirPointing nadirAttitudeLaw = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Satellite on any position
    CircularOrbit circ = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(50.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    // Vertical test
    // ***************
    // Get observed ground point position/velocity
    TimeStampedPVCoordinates pvTargetItrf = nadirAttitudeLaw.getTargetPV(circ, date, itrf);
    // Convert to geodetic coordinates
    GeodeticPoint geoTarget = earthShape.transform(pvTargetItrf.getPosition(), itrf, date);
    // Compute local vertical axis
    double xVert = FastMath.cos(geoTarget.getLongitude()) * FastMath.cos(geoTarget.getLatitude());
    double yVert = FastMath.sin(geoTarget.getLongitude()) * FastMath.cos(geoTarget.getLatitude());
    double zVert = FastMath.sin(geoTarget.getLatitude());
    Vector3D targetVertical = new Vector3D(xVert, yVert, zVert);
    // Get attitude rotation state
    Rotation rotSatEME2000 = nadirAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Get satellite Z axis in EME2000 frame
    Vector3D zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K);
    Vector3D zSatItrf = FramesFactory.getEME2000().getTransformTo(itrf, date).transformVector(zSatEME2000);
    // Check that satellite Z axis is collinear to local vertical axis
    double angle = Vector3D.angle(zSatItrf, targetVertical);
    Assert.assertEquals(0.0, FastMath.sin(angle), Utils.epsilonTest);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 52 with TimeStampedPVCoordinates

use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.

the class NadirPointingTest 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()), 2.0e-14);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 4.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()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 2.0e-8);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 3.0e-5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 53 with TimeStampedPVCoordinates

use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.

the class NadirPointingTest method testSlidingDerivatives.

/**
 * Test the derivatives of the sliding target
 */
@Test
public void testSlidingDerivatives() throws OrekitException {
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create earth center pointing attitude provider
    NadirPointing nadirAttitudeLaw = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Satellite on any position
    CircularOrbit circ = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(50.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
    for (double dt = -0.1; dt < 0.1; dt += 0.05) {
        Orbit o = circ.shiftedBy(dt);
        sample.add(nadirAttitudeLaw.getTargetPV(o, o.getDate(), o.getFrame()));
    }
    TimeStampedPVCoordinates reference = TimeStampedPVCoordinates.interpolate(circ.getDate(), CartesianDerivativesFilter.USE_P, sample);
    TimeStampedPVCoordinates target = nadirAttitudeLaw.getTargetPV(circ, circ.getDate(), circ.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()), 1.3e-5 * reference.getAcceleration().getNorm());
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) FieldOrbit(org.orekit.orbits.FieldOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) ArrayList(java.util.ArrayList) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Test(org.junit.Test)

Example 54 with TimeStampedPVCoordinates

use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.

the class BodyCenterPointingTest method testTarget.

/**
 * Test if target is on Earth surface
 */
@Test
public void testTarget() throws OrekitException {
    // Call get target method
    TimeStampedPVCoordinates target = earthCenterAttitudeLaw.getTargetPV(circ, date, circ.getFrame());
    // Check that target is on Earth surface
    GeodeticPoint gp = earth.transform(target.getPosition(), circ.getFrame(), date);
    Assert.assertEquals(0.0, gp.getAltitude(), 1.0e-10);
    Assert.assertEquals(date, target.getDate());
}
Also used : TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 55 with TimeStampedPVCoordinates

use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.

the class YawSteeringTest method testTarget.

@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
    YawSteering yawCompensLaw = new YawSteering(circOrbit.getFrame(), nadirLaw, CelestialBodyFactory.getSun(), Vector3D.MINUS_I);
    // Check observed ground point
    // *****************************
    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());
}
Also used : TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Test(org.junit.Test)

Aggregations

TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)103 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)64 Test (org.junit.Test)50 AbsoluteDate (org.orekit.time.AbsoluteDate)48 SpacecraftState (org.orekit.propagation.SpacecraftState)36 Frame (org.orekit.frames.Frame)27 ArrayList (java.util.ArrayList)24 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)23 Transform (org.orekit.frames.Transform)22 CartesianOrbit (org.orekit.orbits.CartesianOrbit)20 Orbit (org.orekit.orbits.Orbit)19 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)18 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)17 PVCoordinates (org.orekit.utils.PVCoordinates)17 OrekitException (org.orekit.errors.OrekitException)15 BoundedPropagator (org.orekit.propagation.BoundedPropagator)12 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)11 CircularOrbit (org.orekit.orbits.CircularOrbit)11 Propagator (org.orekit.propagation.Propagator)11 FieldTransform (org.orekit.frames.FieldTransform)10