Search in sources :

Example 46 with GeodeticPoint

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

the class FieldOfViewTest method testFOVPartiallyTruncatedAtLimb.

@Test
public void testFOVPartiallyTruncatedAtLimb() throws OrekitException {
    Utils.setDataRoot("regular-data");
    FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, FastMath.toRadians(40.0), 6, 0.0);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new KeplerianPropagator(orbit);
    propagator.setAttitudeProvider(new NadirPointing(orbit.getFrame(), earth));
    SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
    Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
    Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
    List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(1.0));
    Vector3D subSat = earth.projectToGround(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), state.getDate(), earth.getBodyFrame());
    Assert.assertEquals(1, footprint.size());
    List<GeodeticPoint> loop = footprint.get(0);
    Assert.assertEquals(246, loop.size());
    double minEl = Double.POSITIVE_INFINITY;
    double maxEl = 0;
    double minDist = Double.POSITIVE_INFINITY;
    double maxDist = 0;
    for (int i = 0; i < loop.size(); ++i) {
        Assert.assertEquals(0.0, loop.get(i).getAltitude(), 3.0e-7);
        TopocentricFrame topo = new TopocentricFrame(earth, loop.get(i), "atLimb");
        final double elevation = topo.getElevation(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
        minEl = FastMath.min(minEl, elevation);
        maxEl = FastMath.max(maxEl, elevation);
        final double dist = Vector3D.distance(subSat, earth.transform(loop.get(i)));
        minDist = FastMath.min(minDist, dist);
        maxDist = FastMath.max(maxDist, dist);
    }
    Assert.assertEquals(0.0, FastMath.toDegrees(minEl), 2.0e-12);
    Assert.assertEquals(7.8897, FastMath.toDegrees(maxEl), 0.001);
    Assert.assertEquals(4584829.6, minDist, 1.0);
    Assert.assertEquals(5347029.8, maxDist, 1.0);
}
Also used : NadirPointing(org.orekit.attitudes.NadirPointing) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) S2Point(org.hipparchus.geometry.spherical.twod.S2Point) GeodeticPoint(org.orekit.bodies.GeodeticPoint) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) List(java.util.List) Transform(org.orekit.frames.Transform) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 47 with GeodeticPoint

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

the class FootprintOverlapDetectorTest method checkEventPair.

private void checkEventPair(final LoggedEvent start, final LoggedEvent end, final double expectedStart, final double expectedDuration, final double spacecraftLatitude, final double spacecraftLongitude, final double fovCenterLatitude, final double fovCenterLongitude) throws OrekitException {
    Assert.assertFalse(start.isIncreasing());
    Assert.assertTrue(end.isIncreasing());
    Assert.assertEquals(expectedStart, start.getState().getDate().durationFrom(initialOrbit.getDate()), 0.001);
    Assert.assertEquals(expectedDuration, end.getState().getDate().durationFrom(start.getState().getDate()), 0.001);
    SpacecraftState middle = start.getState().shiftedBy(0.5 * expectedDuration);
    // sub-satellite point
    Vector3D p = middle.getPVCoordinates().getPosition();
    GeodeticPoint gpSat = earth.transform(p, middle.getFrame(), middle.getDate());
    Assert.assertEquals(spacecraftLatitude, FastMath.toDegrees(gpSat.getLatitude()), 0.001);
    Assert.assertEquals(spacecraftLongitude, FastMath.toDegrees(gpSat.getLongitude()), 0.001);
    // point at center of Field Of View
    final Transform scToInert = middle.toTransform().getInverse();
    GeodeticPoint gpFOV = earth.getIntersectionPoint(new Line(p, scToInert.transformPosition(Vector3D.PLUS_K), 1.0e-6), middle.getPVCoordinates().getPosition(), middle.getFrame(), middle.getDate());
    Assert.assertEquals(fovCenterLatitude, FastMath.toDegrees(gpFOV.getLatitude()), 0.001);
    Assert.assertEquals(fovCenterLongitude, FastMath.toDegrees(gpFOV.getLongitude()), 0.001);
}
Also used : Line(org.hipparchus.geometry.euclidean.threed.Line) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Transform(org.orekit.frames.Transform)

Example 48 with GeodeticPoint

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

the class BackAndForthDetectorTest method testBackAndForth.

@Test
public void testBackAndForth() throws OrekitException {
    final TimeScale utc = TimeScalesFactory.getUTC();
    final AbsoluteDate date0 = new AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc);
    final AbsoluteDate date1 = new AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc);
    final AbsoluteDate date2 = new AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc);
    // Orbit
    final double a = 7274000.;
    final double e = 0.00127;
    final double i = FastMath.toRadians(90.);
    final double w = FastMath.toRadians(0.);
    final double raan = FastMath.toRadians(12.5);
    final double lM = FastMath.toRadians(60.);
    Orbit iniOrb = new KeplerianOrbit(a, e, i, w, raan, lM, PositionAngle.MEAN, FramesFactory.getEME2000(), date0, Constants.WGS84_EARTH_MU);
    // Propagator
    KeplerianPropagator propagator = new KeplerianPropagator(iniOrb);
    // Station
    final GeodeticPoint stationPosition = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(100.), 110.);
    final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final TopocentricFrame stationFrame = new TopocentricFrame(earth, stationPosition, "");
    // Detector
    final Visibility visi = new Visibility();
    propagator.addEventDetector(new ElevationDetector(stationFrame).withConstantElevation(FastMath.toRadians(10.)).withHandler(visi));
    // Forward propagation (AOS + LOS)
    propagator.propagate(date1);
    propagator.propagate(date2);
    // Backward propagation (AOS + LOS)
    propagator.propagate(date1);
    propagator.propagate(date0);
    Assert.assertEquals(4, visi.getVisiNb());
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) TopocentricFrame(org.orekit.frames.TopocentricFrame) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 49 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint 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 50 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint 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)

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