Search in sources :

Example 96 with GeodeticPoint

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

the class LongitudeExtremumDetectorTest method testZigZag.

@Test
public void testZigZag() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LongitudeExtremumDetector d = new LongitudeExtremumDetector(600.0, 1.e-6, earth).withHandler(new ContinueOnEvent<LongitudeExtremumDetector>());
    Assert.assertEquals(600.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    KeplerianOrbit orbit = new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681, 0.048363, PositionAngle.MEAN, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new KeplerianPropagator(orbit);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(orbit.getDate().shiftedBy(Constants.JULIAN_DAY));
    double[] expectedLongitudes = new double[] { 74.85115958654778, 39.51032449280883, -84.25729072475329, -119.598124966418, 116.63425894645886 };
    double[] expectedLatitudes = new double[] { -3.8404256460679336, 3.4237236065561536, -3.840419828222964, 3.4237214483413734, -3.840413360572555 };
    Assert.assertEquals(5, logger.getLoggedEvents().size());
    for (int i = 0; i < 5; ++i) {
        SpacecraftState state = logger.getLoggedEvents().get(i).getState();
        GeodeticPoint gp = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null);
        Assert.assertEquals(expectedLongitudes[i], FastMath.toDegrees(gp.getLongitude()), 1.0e-10);
        Assert.assertEquals(expectedLatitudes[i], FastMath.toDegrees(gp.getLatitude()), 1.0e-10);
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) 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) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 97 with GeodeticPoint

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

the class GeographicZoneDetector method g.

/**
 * Compute the value of the detection function.
 * <p>
 * The value is the signed distance to boundary, minus the margin. It is
 * positive if the spacecraft is outside of the zone and negative if it is inside.
 * </p>
 * @param s the current state information: date, kinematics, attitude
 * @return signed distance to boundary minus the margin
 * @exception OrekitException if some specific error occurs
 */
public double g(final SpacecraftState s) throws OrekitException {
    // convert state to geodetic coordinates
    final GeodeticPoint gp = body.transform(s.getPVCoordinates().getPosition(), s.getFrame(), s.getDate());
    // map the point to a sphere (geodetic coordinates have already taken care of ellipsoid flatness)
    final S2Point s2p = new S2Point(gp.getLongitude(), 0.5 * FastMath.PI - gp.getLatitude());
    // for faster computation, we start using only the surrounding cap, to filter out
    // far away points (which correspond to most of the points if the zone is small)
    final double crudeDistance = cap.getCenter().distance(s2p) - cap.getRadius();
    if (crudeDistance - margin > FastMath.max(FastMath.abs(margin), 0.01)) {
        // use the crude distance to compute the (positive) return value
        return crudeDistance - margin;
    }
    // project the point to the closest zone boundary
    return zone.projectToBoundary(s2p).getOffset() - margin;
}
Also used : S2Point(org.hipparchus.geometry.spherical.twod.S2Point) GeodeticPoint(org.orekit.bodies.GeodeticPoint)

Example 98 with GeodeticPoint

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

the class TargetPointingTest method testConstructors.

/**
 * Test if both constructors are equivalent
 */
@Test
public void testConstructors() throws OrekitException {
    // Satellite position
    // ********************
    CircularOrbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.), FastMath.toRadians(270.), FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    // Attitude laws
    // ***************
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Target definition as a geodetic point AND as a position/velocity vector
    GeodeticPoint geoTargetITRF = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
    Vector3D pTargetITRF = earthShape.transform(geoTargetITRF);
    // Attitude law definition from geodetic point target
    TargetPointing geoTargetAttitudeLaw = new TargetPointing(circ.getFrame(), geoTargetITRF, earthShape);
    // Attitude law definition from position/velocity target
    TargetPointing pvTargetAttitudeLaw = new TargetPointing(circ.getFrame(), itrf, pTargetITRF);
    // Check that both attitude are the same
    // Get satellite rotation for target pointing law
    Rotation rotPv = pvTargetAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Get satellite rotation for nadir pointing law
    Rotation rotGeo = geoTargetAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Rotations composition
    Rotation rotCompo = rotGeo.composeInverse(rotPv, RotationConvention.VECTOR_OPERATOR);
    double angle = rotCompo.getAngle();
    Assert.assertEquals(angle, 0.0, Utils.epsilonAngle);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 99 with GeodeticPoint

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

the class TargetPointingTest method testTargetInPointingDirection.

/**
 * Test if defined target belongs to the direction pointed by the satellite
 */
@Test
public void testTargetInPointingDirection() throws OrekitException {
    // Create computation date
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
    // Reference frame = ITRF
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create target pointing attitude provider
    GeodeticPoint geoTarget = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
    TargetPointing targetAttitudeLaw = new TargetPointing(FramesFactory.getEME2000(), geoTarget, earthShape);
    // Satellite position
    // ********************
    // Create satellite position as circular parameters
    CircularOrbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.), FastMath.toRadians(270.), FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    // Transform satellite position to position/velocity parameters in EME2000 frame
    PVCoordinates pvSatEME2000 = circ.getPVCoordinates();
    // Pointing direction
    // ********************
    // Get satellite attitude rotation, i.e rotation from EME2000 frame to satellite frame
    Rotation rotSatEME2000 = targetAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation();
    // Transform Z axis from satellite frame to EME2000
    Vector3D zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K);
    // Line containing satellite point and following pointing direction
    Vector3D p = eme2000ToItrf.transformPosition(pvSatEME2000.getPosition());
    Line pointingLine = new Line(p, p.add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, eme2000ToItrf.transformVector(zSatEME2000)), 1.0e-10);
    // Check that the line contains earth center
    double distance = pointingLine.distance(earthShape.transform(geoTarget));
    Assert.assertEquals(0, distance, 1.e-7);
}
Also used : Line(org.hipparchus.geometry.euclidean.threed.Line) Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) DateComponents(org.orekit.time.DateComponents) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 100 with GeodeticPoint

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

the class TargetPointingTest method testGeodeticConstructor.

/**
 * Test if geodetic constructor works
 */
@Test
public void testGeodeticConstructor() throws OrekitException {
    // Satellite position
    // ********************
    CircularOrbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.), FastMath.toRadians(270.), FastMath.toRadians(5.300), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    // Attitude law
    // **************
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Target definition as a geodetic point
    GeodeticPoint geoTargetITRF = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
    // Attitude law definition
    TargetPointing geoTargetAttitudeLaw = new TargetPointing(circ.getFrame(), geoTargetITRF, earthShape);
    // Check that observed ground point is the same as defined target
    Vector3D pObservedEME2000 = geoTargetAttitudeLaw.getTargetPV(circ, date, FramesFactory.getEME2000()).getPosition();
    GeodeticPoint geoObserved = earthShape.transform(pObservedEME2000, FramesFactory.getEME2000(), date);
    Assert.assertEquals(geoObserved.getLongitude(), geoTargetITRF.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoObserved.getLatitude(), geoTargetITRF.getLatitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoObserved.getAltitude(), geoTargetITRF.getAltitude(), 1.1e-8);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) 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