Search in sources :

Example 66 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class BodyCenterPointingTest method doTestBodyCenterInPointingDirection.

private <T extends RealFieldElement<T>> void doTestBodyCenterInPointingDirection(final Field<T> field) throws OrekitException {
    double mu = 3.9860047e14;
    T zero = field.getZero();
    // Satellite position as circular parameters
    final T raan = zero.add(FastMath.toRadians(270.));
    final T a = zero.add(7178000.0);
    final T e = zero.add(7E-5);
    final T i = zero.add(FastMath.toRadians(50.));
    final T pa = zero.add(FastMath.toRadians(45.));
    final T m = zero.add(FastMath.toRadians(5.300 - 270.));
    // Computation date
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
    // Orbit
    FieldKeplerianOrbit<T> circ = new FieldKeplerianOrbit<>(a, e, i, pa, raan, m, PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    // WGS84 Earth model
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    // Transform from EME2000 to ITRF2008
    Transform eme2000ToItrf = FramesFactory.getEME2000().getTransformTo(earth.getBodyFrame(), date.toAbsoluteDate());
    // Earth center pointing attitude provider
    BodyCenterPointing earthCenterAttitudeLaw = new BodyCenterPointing(circ.getFrame(), earth);
    // Transform satellite position to position/velocity parameters in EME2000 frame
    FieldPVCoordinates<T> pvSatEME2000 = circ.getPVCoordinates();
    // Pointing direction
    // ********************
    // Get satellite attitude rotation, i.e rotation from EME2000 frame to satellite frame
    FieldRotation<T> rotSatEME2000 = earthCenterAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // checked this values with the bodycenterpointing test values
    // Transform Z axis from satellite frame to EME2000
    FieldVector3D<T> zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K);
    // Transform Z axis from EME2000 to ITRF2008
    FieldVector3D<T> zSatITRF2008C = eme2000ToItrf.transformVector(zSatEME2000);
    // Transform satellite position/velocity from EME2000 to ITRF2008
    FieldPVCoordinates<T> pvSatITRF2008C = eme2000ToItrf.transformPVCoordinates(pvSatEME2000);
    // Line containing satellite point and following pointing direction
    Line pointingLine = new Line(pvSatITRF2008C.getPosition().toVector3D(), pvSatITRF2008C.getPosition().toVector3D().add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, zSatITRF2008C.toVector3D()), 2.0e-8);
    // Check that the line contains Earth center
    Assert.assertTrue(pointingLine.contains(Vector3D.ZERO));
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) DateComponents(org.orekit.time.DateComponents) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) Line(org.hipparchus.geometry.euclidean.threed.Line) Transform(org.orekit.frames.Transform) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 67 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class TimeStampedPVCoordinates method toTaylorProvider.

/**
 * Create a local provider using simply Taylor expansion through {@link #shiftedBy(double)}.
 * <p>
 * The time evolution is based on a simple Taylor expansion. It is <em>not</em> intended as a
 * replacement for proper orbit propagation (it is not even Keplerian!) but should be sufficient
 * for either small time shifts or coarse accuracy.
 * </p>
 * @param instanceFrame frame in which the instance is defined
 * @return provider based on Taylor expansion, for small time shifts around instance date
 */
public PVCoordinatesProvider toTaylorProvider(final Frame instanceFrame) {
    return new PVCoordinatesProvider() {

        /**
         * {@inheritDoc}
         */
        public TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate d, final Frame f) throws OrekitException {
            final TimeStampedPVCoordinates shifted = shiftedBy(d.durationFrom(date));
            final Transform transform = instanceFrame.getTransformTo(f, d);
            return transform.transformPVCoordinates(shifted);
        }
    };
}
Also used : Frame(org.orekit.frames.Frame) Transform(org.orekit.frames.Transform) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 68 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class YawCompensationTest method toSpacecraft.

PVCoordinates toSpacecraft(PVCoordinates groundPoint, Orbit orbit, AttitudeProvider attitudeProvider) throws OrekitException {
    SpacecraftState state = new SpacecraftState(orbit, attitudeProvider.getAttitude(orbit, orbit.getDate(), orbit.getFrame()));
    Transform earthToSc = new Transform(orbit.getDate(), earthShape.getBodyFrame().getTransformTo(orbit.getFrame(), orbit.getDate()), state.toTransform());
    return earthToSc.transformPVCoordinates(groundPoint);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Transform(org.orekit.frames.Transform)

Example 69 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method testNonSerializableStateProvider.

@Test
public void testNonSerializableStateProvider() throws OrekitException, IOException {
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, provider);
    // this serialization should work
    new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(propagator);
    propagator.addAdditionalStateProvider(new AdditionalStateProvider() {

        public String getName() {
            return "not serializable";
        }

        public double[] getAdditionalState(SpacecraftState state) {
            return new double[] { 0 };
        }
    });
    try {
        // this serialization should not work
        new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(propagator);
        Assert.fail("an exception should have been thrown");
    } catch (NotSerializableException nse) {
    // expected
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) NotSerializableException(java.io.NotSerializableException) CircularOrbit(org.orekit.orbits.CircularOrbit) AdditionalStateProvider(org.orekit.propagation.AdditionalStateProvider) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Transform(org.orekit.frames.Transform) Test(org.junit.Test)

Example 70 with Transform

use of org.orekit.frames.Transform in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method testIssue224Backward.

@Test
public void testIssue224Backward() throws OrekitException, IOException, ClassNotFoundException {
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, new LofOffset(poleAligned, LOFType.VVLH), 1000.0, provider);
    propagator.addAdditionalStateProvider(new SevenProvider());
    propagator.setEphemerisMode();
    // Impulsive burns
    final AbsoluteDate burn1Date = initial.getDate().shiftedBy(-200);
    ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(0.0, 500.0, 0.0), 320);
    propagator.addEventDetector(impulsiveBurn1);
    final AbsoluteDate burn2Date = initial.getDate().shiftedBy(-300);
    ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(0.0, 500.0, 0.0), 320);
    propagator.addEventDetector(impulsiveBurn2);
    propagator.propagate(initial.getDate().shiftedBy(-400));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(propagator.getGeneratedEphemeris());
    Assert.assertTrue(bos.size() > 2950);
    Assert.assertTrue(bos.size() < 3050);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
    ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) {
            if (currentState.getDate().durationFrom(burn1Date) > 0.001) {
                Assert.assertEquals(97.402, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn1Date) < -0.001 && currentState.getDate().durationFrom(burn2Date) > 0.001) {
                Assert.assertEquals(98.164, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn2Date) < -0.001) {
                Assert.assertEquals(99.273, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            }
        }
    });
    ephemeris.propagate(ephemeris.getMinDate());
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) ImpulseManeuver(org.orekit.forces.maneuvers.ImpulseManeuver) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ByteArrayInputStream(java.io.ByteArrayInputStream) Transform(org.orekit.frames.Transform) LofOffset(org.orekit.attitudes.LofOffset) BoundedPropagator(org.orekit.propagation.BoundedPropagator) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Aggregations

Transform (org.orekit.frames.Transform)75 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)56 AbsoluteDate (org.orekit.time.AbsoluteDate)33 Frame (org.orekit.frames.Frame)28 FieldTransform (org.orekit.frames.FieldTransform)26 SpacecraftState (org.orekit.propagation.SpacecraftState)26 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)25 PVCoordinates (org.orekit.utils.PVCoordinates)23 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)21 Test (org.junit.Test)20 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)18 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)17 GeodeticPoint (org.orekit.bodies.GeodeticPoint)13 TopocentricFrame (org.orekit.frames.TopocentricFrame)12 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)11 OrekitException (org.orekit.errors.OrekitException)11 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)10 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)10 FieldRotation (org.hipparchus.geometry.euclidean.threed.FieldRotation)8 CircularOrbit (org.orekit.orbits.CircularOrbit)8