Search in sources :

Example 41 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class AlongTrackAimingTest method testAscending.

@Test
public void testAscending() throws OrekitException {
    final AlongTrackAiming tileAiming = new AlongTrackAiming(ellipsoid, orbit, true);
    for (double latitude = FastMath.toRadians(-50.21); latitude < FastMath.toRadians(50.21); latitude += 0.001) {
        final GeodeticPoint gp = new GeodeticPoint(latitude, 0.0, 0.0);
        final Vector3D aiming = tileAiming.alongTileDirection(ellipsoid.transform(gp), gp);
        Assert.assertEquals(1.0, aiming.getNorm(), 1.0e-12);
        final double elevation = 0.5 * FastMath.PI - Vector3D.angle(aiming, gp.getZenith());
        final double azimuth = FastMath.atan2(Vector3D.dotProduct(aiming, gp.getEast()), Vector3D.dotProduct(aiming, gp.getNorth()));
        Assert.assertEquals(0.0, FastMath.toDegrees(elevation), 1.0e-6);
        if (FastMath.abs(FastMath.toDegrees(latitude)) > 49.6) {
            Assert.assertTrue(FastMath.toDegrees(azimuth) > 80.0);
        }
        if (FastMath.abs(FastMath.toDegrees(latitude)) < 5.0) {
            Assert.assertTrue(FastMath.toDegrees(azimuth) < 37.0);
        }
        Assert.assertTrue(FastMath.toDegrees(azimuth) > 36.7);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 42 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class TileTest method testCenteredSquare.

@Test
public void testCenteredSquare() {
    double angle = 0.25;
    GeodeticPoint v0 = new GeodeticPoint(-angle, -angle, 100.0);
    GeodeticPoint v1 = new GeodeticPoint(-angle, +angle, 100.0);
    GeodeticPoint v2 = new GeodeticPoint(+angle, -angle, 100.0);
    GeodeticPoint v3 = new GeodeticPoint(+angle, +angle, 100.0);
    Tile tile = new Tile(v0, v1, v2, v3);
    assertThat(tile.getVertices()[0], geodeticPointCloseTo(v0, 1.0e-9));
    assertThat(tile.getVertices()[1], geodeticPointCloseTo(v1, 1.0e-9));
    assertThat(tile.getVertices()[2], geodeticPointCloseTo(v2, 1.0e-9));
    assertThat(tile.getVertices()[3], geodeticPointCloseTo(v3, 1.0e-9));
    assertThat(tile.getVertices()[3], geodeticPointCloseTo(v3, 1.0e-9));
    assertThat(tile.getInterpolatedPoint(0, 0), geodeticPointCloseTo(v0, 1.0e-9));
    assertThat(tile.getInterpolatedPoint(1, 0), geodeticPointCloseTo(v1, 1.0e-9));
    assertThat(tile.getInterpolatedPoint(1, 1), geodeticPointCloseTo(v2, 1.0e-9));
    assertThat(tile.getInterpolatedPoint(0, 1), geodeticPointCloseTo(v3, 1.0e-9));
    assertThat(tile.getCenter(), geodeticPointCloseTo(new GeodeticPoint(0.0, 0.0, 100.0), 1.0e-9));
}
Also used : Tile(org.orekit.models.earth.tessellation.Tile) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 43 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class GroundStation method getOffsetToInertial.

/**
 * Get the transform between offset frame and inertial frame.
 * <p>
 * The offset frame takes the <em>current</em> position offset,
 * polar motion and the meridian shift into account. The frame
 * returned is disconnected from later changes in the parameters.
 * When the {@link ParameterDriver parameters} managing these
 * offsets are changed, the method must be called again to retrieve
 * a new offset frame.
 * </p>
 * @param inertial inertial frame to transform to
 * @param date date of the transform
 * @return offset frame defining vectors
 * @exception OrekitException if offset frame cannot be computed for current offset values
 */
public Transform getOffsetToInertial(final Frame inertial, final AbsoluteDate date) throws OrekitException {
    // take Earth offsets into account
    final Transform intermediateToBody = estimatedEarthFrameProvider.getTransform(date).getInverse();
    // take station offset into account
    final double x = parametricModel(eastOffsetDriver);
    final double y = parametricModel(northOffsetDriver);
    final double z = parametricModel(zenithOffsetDriver);
    final BodyShape baseShape = baseFrame.getParentShape();
    final Transform baseToBody = baseFrame.getTransformTo(baseShape.getBodyFrame(), date);
    Vector3D origin = baseToBody.transformPosition(new Vector3D(x, y, z));
    origin = origin.add(computeDisplacement(date, origin));
    final GeodeticPoint originGP = baseShape.transform(origin, baseShape.getBodyFrame(), date);
    final Transform offsetToIntermediate = new Transform(date, new Transform(date, new Rotation(Vector3D.PLUS_I, Vector3D.PLUS_K, originGP.getEast(), originGP.getZenith()), Vector3D.ZERO), new Transform(date, origin));
    // combine all transforms together
    final Transform bodyToInert = baseFrame.getParent().getTransformTo(inertial, date);
    return new Transform(date, offsetToIntermediate, new Transform(date, intermediateToBody, bodyToInert));
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) BodyShape(org.orekit.bodies.BodyShape) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation)

Example 44 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class ElevationDetectorTest method testIssue110.

@Test
public void testIssue110() throws OrekitException {
    // KEPLERIAN PROPAGATOR
    final Frame eme2000Frame = FramesFactory.getEME2000();
    final AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH;
    final double a = 7000000.0;
    final Orbit initialOrbit = new KeplerianOrbit(a, 0.0, FastMath.PI / 2.2, 0.0, FastMath.PI / 2., 0.0, PositionAngle.TRUE, eme2000Frame, initDate, Constants.EGM96_EARTH_MU);
    final KeplerianPropagator kProp = new KeplerianPropagator(initialOrbit);
    // earth shape
    final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    // Ground station
    final GeodeticPoint stat = new GeodeticPoint(FastMath.toRadians(35.), FastMath.toRadians(149.8), 0.);
    final TopocentricFrame station = new TopocentricFrame(earthShape, stat, "GSTATION");
    // detector creation
    // =================
    final double maxCheck = 600.;
    final double threshold = 1.0e-3;
    final EventDetector rawEvent = new ElevationDetector(maxCheck, threshold, station).withConstantElevation(FastMath.toRadians(5.0)).withHandler(new ContinueOnEvent<ElevationDetector>());
    final EventsLogger logger = new EventsLogger();
    kProp.addEventDetector(logger.monitorDetector(rawEvent));
    // PROPAGATION with DETECTION
    final AbsoluteDate finalDate = initDate.shiftedBy(30 * 60.);
    kProp.propagate(finalDate);
    Assert.assertEquals(2, logger.getLoggedEvents().size());
    Assert.assertTrue(logger.getLoggedEvents().get(0).isIncreasing());
    Assert.assertEquals(478.945, logger.getLoggedEvents().get(0).getState().getDate().durationFrom(initDate), 1.0e-3);
    Assert.assertFalse(logger.getLoggedEvents().get(1).isIncreasing());
    Assert.assertEquals(665.721, logger.getLoggedEvents().get(1).getState().getDate().durationFrom(initDate), 1.0e-3);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TopocentricFrame(org.orekit.frames.TopocentricFrame) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 45 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class ElevationDetectorTest method testIssue136.

@Test
public void testIssue136() throws OrekitException {
    // Initial state definition : date, orbit
    AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
    // inertial frame for orbit definition
    Frame inertialFrame = FramesFactory.getEME2000();
    Orbit initialOrbit = new KeplerianOrbit(6828137.005, 7.322641382145889e-10, 1.6967079057368113, 0.0, 1.658054062748353, 0.0001223149429077902, PositionAngle.MEAN, inertialFrame, initialDate, Constants.EIGEN5C_EARTH_MU);
    // Propagator : consider a simple Keplerian motion (could be more elaborate)
    Propagator kepler = new EcksteinHechlerPropagator(initialOrbit, Constants.EGM96_EARTH_EQUATORIAL_RADIUS, Constants.EGM96_EARTH_MU, Constants.EGM96_EARTH_C20, 0.0, 0.0, 0.0, 0.0);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    // Station
    final double longitude = FastMath.toRadians(-147.5);
    final double latitude = FastMath.toRadians(64);
    final double altitude = 160;
    final GeodeticPoint station1 = new GeodeticPoint(latitude, longitude, altitude);
    final TopocentricFrame sta1Frame = new TopocentricFrame(earth, station1, "station1");
    // Event definition
    final double maxcheck = 120.0;
    final double elevation = FastMath.toRadians(5.);
    final double threshold = 10.0;
    final EventDetector rawEvent = new ElevationDetector(maxcheck, threshold, sta1Frame).withConstantElevation(elevation).withHandler(new ContinueOnEvent<ElevationDetector>());
    final EventsLogger logger = new EventsLogger();
    kepler.addEventDetector(logger.monitorDetector(rawEvent));
    // Propagate from the initial date to the first raising or for the fixed duration
    kepler.propagate(initialDate.shiftedBy(60 * 60 * 24.0 * 40));
    int countIncreasing = 0;
    int countDecreasing = 0;
    for (LoggedEvent le : logger.getLoggedEvents()) {
        if (le.isIncreasing()) {
            ++countIncreasing;
        } else {
            ++countDecreasing;
        }
    }
    Assert.assertEquals(314, countIncreasing);
    Assert.assertEquals(314, countDecreasing);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Aggregations

GeodeticPoint (org.orekit.bodies.GeodeticPoint)133 Test (org.junit.Test)78 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)67 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)61 AbsoluteDate (org.orekit.time.AbsoluteDate)45 TopocentricFrame (org.orekit.frames.TopocentricFrame)35 Frame (org.orekit.frames.Frame)34 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)27 SpacecraftState (org.orekit.propagation.SpacecraftState)26 Propagator (org.orekit.propagation.Propagator)24 OrekitException (org.orekit.errors.OrekitException)23 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)23 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)22 PVCoordinates (org.orekit.utils.PVCoordinates)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 BodyShape (org.orekit.bodies.BodyShape)17 Orbit (org.orekit.orbits.Orbit)15 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)13 ArrayList (java.util.ArrayList)12 FieldGeodeticPoint (org.orekit.bodies.FieldGeodeticPoint)12