Search in sources :

Example 31 with TimeStampedPVCoordinates

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

the class NadirPointing method nadirRef.

/**
 * Compute ground point in nadir direction, in reference frame.
 * @param scRef spacecraft coordinates in reference frame
 * @param refToBody transform from reference frame to body frame
 * @return intersection point in body frame (only the position is set!)
 * @exception OrekitException if line of sight does not intersect body
 */
private TimeStampedPVCoordinates nadirRef(final TimeStampedPVCoordinates scRef, final Transform refToBody) throws OrekitException {
    final Vector3D satInBodyFrame = refToBody.transformPosition(scRef.getPosition());
    // satellite position in geodetic coordinates
    final GeodeticPoint gpSat = shape.transform(satInBodyFrame, getBodyFrame(), scRef.getDate());
    // nadir position in geodetic coordinates
    final GeodeticPoint gpNadir = new GeodeticPoint(gpSat.getLatitude(), gpSat.getLongitude(), 0.0);
    // nadir point position in body frame
    final Vector3D pNadirBody = shape.transform(gpNadir);
    // nadir point position in reference frame
    final Vector3D pNadirRef = refToBody.getInverse().transformPosition(pNadirBody);
    return new TimeStampedPVCoordinates(scRef.getDate(), pNadirRef, Vector3D.ZERO, Vector3D.ZERO);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Example 32 with TimeStampedPVCoordinates

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

the class NadirPointing method getTargetPV.

/**
 * {@inheritDoc}
 */
public TimeStampedPVCoordinates getTargetPV(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException {
    // transform from specified reference frame to body frame
    final Transform refToBody = frame.getTransformTo(shape.getBodyFrame(), date);
    // sample intersection points in current date neighborhood
    final double h = 0.01;
    final List<TimeStampedPVCoordinates> sample = new ArrayList<>();
    sample.add(nadirRef(pvProv.getPVCoordinates(date.shiftedBy(-2 * h), frame), refToBody.shiftedBy(-2 * h)));
    sample.add(nadirRef(pvProv.getPVCoordinates(date.shiftedBy(-h), frame), refToBody.shiftedBy(-h)));
    sample.add(nadirRef(pvProv.getPVCoordinates(date, frame), refToBody));
    sample.add(nadirRef(pvProv.getPVCoordinates(date.shiftedBy(+h), frame), refToBody.shiftedBy(+h)));
    sample.add(nadirRef(pvProv.getPVCoordinates(date.shiftedBy(+2 * h), frame), refToBody.shiftedBy(+2 * h)));
    // use interpolation to compute properly the time-derivatives
    return TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, sample);
}
Also used : ArrayList(java.util.ArrayList) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Example 33 with TimeStampedPVCoordinates

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

the class CartesianOrbitTest method testNonKeplerianDerivatives.

@Test
public void testNonKeplerianDerivatives() throws OrekitException {
    final AbsoluteDate date = new AbsoluteDate("2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final Vector3D position = new Vector3D(6896874.444705, 1956581.072644, -147476.245054);
    final Vector3D velocity = new Vector3D(166.816407662, -1106.783301861, -7372.745712770);
    final Vector3D acceleration = new Vector3D(-7.466182457944, -2.118153357345, 0.160004048437);
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(date, position, velocity, acceleration);
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final CartesianOrbit orbit = new CartesianOrbit(pv, frame, mu);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getA()), orbit.getADot(), 4.3e-8);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEx()), orbit.getEquinoctialExDot(), 2.1e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEy()), orbit.getEquinoctialEyDot(), 5.3e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHx()), orbit.getHxDot(), 4.4e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHy()), orbit.getHyDot(), 8.0e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLv()), orbit.getLvDot(), 1.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLE()), orbit.getLEDot(), 7.8e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLM()), orbit.getLMDot(), 8.8e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getE()), orbit.getEDot(), 7.0e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot(), 5.7e-16);
}
Also used : TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Frame(org.orekit.frames.Frame) ObjectInputStream(java.io.ObjectInputStream) RealMatrixPreservingVisitor(org.hipparchus.linear.RealMatrixPreservingVisitor) Function(java.util.function.Function) PVCoordinates(org.orekit.utils.PVCoordinates) ArrayList(java.util.ArrayList) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) ByteArrayInputStream(java.io.ByteArrayInputStream) After(org.junit.After) ObjectOutputStream(java.io.ObjectOutputStream) FastMath(org.hipparchus.util.FastMath) Method(java.lang.reflect.Method) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) FramesFactory(org.orekit.frames.FramesFactory) IOException(java.io.IOException) Test(org.junit.Test) InvocationTargetException(java.lang.reflect.InvocationTargetException) MathUtils(org.hipparchus.util.MathUtils) List(java.util.List) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator) OrekitException(org.orekit.errors.OrekitException) TimeScalesFactory(org.orekit.time.TimeScalesFactory) MatrixUtils(org.hipparchus.linear.MatrixUtils) Transform(org.orekit.frames.Transform) Assert(org.junit.Assert) AbsoluteDate(org.orekit.time.AbsoluteDate) Frame(org.orekit.frames.Frame) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 34 with TimeStampedPVCoordinates

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

the class EquinoctialOrbitTest method testPositionAngleDerivatives.

@Test
public void testPositionAngleDerivatives() throws OrekitException {
    final AbsoluteDate date = new AbsoluteDate("2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final Vector3D position = new Vector3D(6896874.444705, 1956581.072644, -147476.245054);
    final Vector3D velocity = new Vector3D(166.816407662, -1106.783301861, -7372.745712770);
    final Vector3D acceleration = new Vector3D(-7.466182457944, -2.118153357345, 0.160004048437);
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(date, position, velocity, acceleration);
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final EquinoctialOrbit orbit = new EquinoctialOrbit(pv, frame, mu);
    for (PositionAngle type : PositionAngle.values()) {
        final EquinoctialOrbit rebuilt = new EquinoctialOrbit(orbit.getA(), orbit.getEquinoctialEx(), orbit.getEquinoctialEy(), orbit.getHx(), orbit.getHy(), orbit.getL(type), orbit.getADot(), orbit.getEquinoctialExDot(), orbit.getEquinoctialEyDot(), orbit.getHxDot(), orbit.getHyDot(), orbit.getLDot(type), type, orbit.getFrame(), orbit.getDate(), orbit.getMu());
        Assert.assertThat(rebuilt.getA(), relativelyCloseTo(orbit.getA(), 1));
        Assert.assertThat(rebuilt.getEquinoctialEx(), relativelyCloseTo(orbit.getEquinoctialEx(), 1));
        Assert.assertThat(rebuilt.getEquinoctialEy(), relativelyCloseTo(orbit.getEquinoctialEy(), 1));
        Assert.assertThat(rebuilt.getHx(), relativelyCloseTo(orbit.getHx(), 1));
        Assert.assertThat(rebuilt.getHy(), relativelyCloseTo(orbit.getHy(), 1));
        Assert.assertThat(rebuilt.getADot(), relativelyCloseTo(orbit.getADot(), 1));
        Assert.assertThat(rebuilt.getEquinoctialExDot(), relativelyCloseTo(orbit.getEquinoctialExDot(), 1));
        Assert.assertThat(rebuilt.getEquinoctialEyDot(), relativelyCloseTo(orbit.getEquinoctialEyDot(), 1));
        Assert.assertThat(rebuilt.getHxDot(), relativelyCloseTo(orbit.getHxDot(), 1));
        Assert.assertThat(rebuilt.getHyDot(), relativelyCloseTo(orbit.getHyDot(), 1));
        for (PositionAngle type2 : PositionAngle.values()) {
            Assert.assertThat(rebuilt.getL(type2), relativelyCloseTo(orbit.getL(type2), 1));
            Assert.assertThat(rebuilt.getLDot(type2), relativelyCloseTo(orbit.getLDot(type2), 1));
        }
    }
}
Also used : Frame(org.orekit.frames.Frame) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 35 with TimeStampedPVCoordinates

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

the class CircularOrbitTest method testNonKeplerianDerivatives.

@Test
public void testNonKeplerianDerivatives() throws OrekitException {
    final AbsoluteDate date = new AbsoluteDate("2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final Vector3D position = new Vector3D(6896874.444705, 1956581.072644, -147476.245054);
    final Vector3D velocity = new Vector3D(166.816407662, -1106.783301861, -7372.745712770);
    final Vector3D acceleration = new Vector3D(-7.466182457944, -2.118153357345, 0.160004048437);
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(date, position, velocity, acceleration);
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final CircularOrbit orbit = new CircularOrbit(pv, frame, mu);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getA()), orbit.getADot(), 4.3e-8);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEx()), orbit.getEquinoctialExDot(), 2.1e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEy()), orbit.getEquinoctialEyDot(), 5.4e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHx()), orbit.getHxDot(), 1.6e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHy()), orbit.getHyDot(), 7.3e-17);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLv()), orbit.getLvDot(), 3.4e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLE()), orbit.getLEDot(), 3.5e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLM()), orbit.getLMDot(), 5.3e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getE()), orbit.getEDot(), 6.8e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot(), 5.7e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getCircularEx()), orbit.getCircularExDot(), 2.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getCircularEy()), orbit.getCircularEyDot(), 5.3e-17);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAlphaV()), orbit.getAlphaVDot(), 4.3e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAlphaE()), orbit.getAlphaEDot(), 1.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAlphaM()), orbit.getAlphaMDot(), 3.7e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAlpha(PositionAngle.TRUE)), orbit.getAlphaDot(PositionAngle.TRUE), 4.3e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAlpha(PositionAngle.ECCENTRIC)), orbit.getAlphaDot(PositionAngle.ECCENTRIC), 1.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAlpha(PositionAngle.MEAN)), orbit.getAlphaDot(PositionAngle.MEAN), 3.7e-15);
}
Also used : TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Frame(org.orekit.frames.Frame) ObjectInputStream(java.io.ObjectInputStream) RealMatrixPreservingVisitor(org.hipparchus.linear.RealMatrixPreservingVisitor) Function(java.util.function.Function) PVCoordinates(org.orekit.utils.PVCoordinates) ArrayList(java.util.ArrayList) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) ByteArrayInputStream(java.io.ByteArrayInputStream) After(org.junit.After) ObjectOutputStream(java.io.ObjectOutputStream) FastMath(org.hipparchus.util.FastMath) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) OrekitMatchers.relativelyCloseTo(org.orekit.OrekitMatchers.relativelyCloseTo) FramesFactory(org.orekit.frames.FramesFactory) IOException(java.io.IOException) Test(org.junit.Test) OrekitIllegalArgumentException(org.orekit.errors.OrekitIllegalArgumentException) MathUtils(org.hipparchus.util.MathUtils) OrekitMessages(org.orekit.errors.OrekitMessages) List(java.util.List) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator) OrekitException(org.orekit.errors.OrekitException) TimeScalesFactory(org.orekit.time.TimeScalesFactory) MatrixUtils(org.hipparchus.linear.MatrixUtils) Transform(org.orekit.frames.Transform) Assert(org.junit.Assert) AbsoluteDate(org.orekit.time.AbsoluteDate) Frame(org.orekit.frames.Frame) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) 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