Search in sources :

Example 26 with TopocentricFrame

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

the class GroundFieldOfViewDetectorTest method testCaseSimilarToElevationDetector.

/**
 * Check FoV detector is similar to {@link ElevationDetector} when using
 * zenith pointing.
 *
 * @throws OrekitException on error.
 */
@Test
public void testCaseSimilarToElevationDetector() throws OrekitException {
    // setup
    double pi = FastMath.PI;
    // arbitrary date
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    AbsoluteDate endDate = date.shiftedBy(Constants.JULIAN_DAY);
    Frame eci = FramesFactory.getGCRF();
    Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ecef);
    GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(39), FastMath.toRadians(77), 0);
    TopocentricFrame topo = new TopocentricFrame(earth, gp, "topo");
    // iss like orbit
    KeplerianOrbit orbit = new KeplerianOrbit(6378137 + 400e3, 0, FastMath.toRadians(51.65), 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EGM96_EARTH_MU);
    Propagator prop = new KeplerianPropagator(orbit);
    // compute expected result
    ElevationDetector elevationDetector = new ElevationDetector(topo).withConstantElevation(pi / 6).withMaxCheck(5.0);
    EventsLogger logger = new EventsLogger();
    prop.addEventDetector(logger.monitorDetector(elevationDetector));
    prop.propagate(endDate);
    List<LoggedEvent> expected = logger.getLoggedEvents();
    // action
    // construct similar FoV based detector
    // half width of 60 deg pointed along +Z in antenna frame
    // not a perfect small circle b/c FoV makes a polygon with great circles
    FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, pi / 3, 16, 0);
    // simple case for fixed pointing to be similar to elevation detector.
    // could define new frame with varying rotation for slewing antenna.
    GroundFieldOfViewDetector fovDetector = new GroundFieldOfViewDetector(topo, fov).withMaxCheck(5.0);
    Assert.assertSame(topo, fovDetector.getFrame());
    Assert.assertSame(fov, fovDetector.getFieldOfView());
    logger = new EventsLogger();
    prop = new KeplerianPropagator(orbit);
    prop.addEventDetector(logger.monitorDetector(fovDetector));
    prop.propagate(endDate);
    List<LoggedEvent> actual = logger.getLoggedEvents();
    // verify
    Assert.assertEquals(2, expected.size());
    Assert.assertEquals(2, actual.size());
    for (int i = 0; i < 2; i++) {
        AbsoluteDate expectedDate = expected.get(i).getState().getDate();
        AbsoluteDate actualDate = actual.get(i).getState().getDate();
        // same event times to within 1s.
        Assert.assertEquals(expectedDate.durationFrom(actualDate), 0.0, 1.0);
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) GroundFieldOfViewDetector(org.orekit.propagation.events.GroundFieldOfViewDetector) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) ElevationDetector(org.orekit.propagation.events.ElevationDetector) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) EventsLogger(org.orekit.propagation.events.EventsLogger) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldOfView(org.orekit.propagation.events.FieldOfView) Test(org.junit.Test)

Example 27 with TopocentricFrame

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

the class ElevationExtremumDetectorTest method testLEO.

@Test
public void testLEO() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
    final ElevationExtremumDetector raw = new ElevationExtremumDetector(new TopocentricFrame(earth, gp, "test")).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<ElevationExtremumDetector>());
    final EventSlopeFilter<ElevationExtremumDetector> maxElevationDetector = new EventSlopeFilter<ElevationExtremumDetector>(raw, FilterType.TRIGGER_ONLY_DECREASING_EVENTS);
    Assert.assertEquals(60.0, raw.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, raw.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, raw.getMaxIterationCount());
    Assert.assertEquals("test", raw.getTopocentricFrame().getName());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(maxElevationDetector));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    int visibleEvents = 0;
    for (LoggedEvent e : logger.getLoggedEvents()) {
        final double eMinus = raw.getElevation(e.getState().shiftedBy(-10.0));
        final double e0 = raw.getElevation(e.getState());
        final double ePlus = raw.getElevation(e.getState().shiftedBy(+10.0));
        if (e0 > FastMath.toRadians(5.0)) {
            ++visibleEvents;
        }
        Assert.assertTrue(e0 > eMinus);
        Assert.assertTrue(e0 > ePlus);
    }
    Assert.assertEquals(15, logger.getLoggedEvents().size());
    Assert.assertEquals(6, visibleEvents);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) TopocentricFrame(org.orekit.frames.TopocentricFrame) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Propagator(org.orekit.propagation.Propagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 28 with TopocentricFrame

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

the class EventEnablingPredicateFilterTest method doElevationTest.

private void doElevationTest(final double minElevation, final AbsoluteDate start, final AbsoluteDate end, final int expectedEvents, final boolean sameSign) throws OrekitException {
    final ElevationExtremumDetector raw = new ElevationExtremumDetector(0.001, 1.e-6, new TopocentricFrame(earth, gp, "test")).withHandler(new ContinueOnEvent<ElevationExtremumDetector>());
    final EventEnablingPredicateFilter<ElevationExtremumDetector> aboveGroundElevationDetector = new EventEnablingPredicateFilter<ElevationExtremumDetector>(raw, new EnablingPredicate<ElevationExtremumDetector>() {

        public boolean eventIsEnabled(final SpacecraftState state, final ElevationExtremumDetector eventDetector, final double g) throws OrekitException {
            return eventDetector.getElevation(state) > minElevation;
        }
    }).withMaxCheck(60.0);
    Assert.assertEquals(0.001, raw.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(60.0, aboveGroundElevationDetector.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, aboveGroundElevationDetector.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, aboveGroundElevationDetector.getMaxIterationCount());
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(aboveGroundElevationDetector));
    propagator.propagate(start, end);
    for (LoggedEvent e : logger.getLoggedEvents()) {
        final double eMinus = raw.getElevation(e.getState().shiftedBy(-10.0));
        final double e0 = raw.getElevation(e.getState());
        final double ePlus = raw.getElevation(e.getState().shiftedBy(+10.0));
        Assert.assertTrue(e0 > eMinus);
        Assert.assertTrue(e0 > ePlus);
        Assert.assertTrue(e0 > minElevation);
    }
    Assert.assertEquals(expectedEvents, logger.getLoggedEvents().size());
    propagator.clearEventsDetectors();
    double g1Raw = raw.g(propagator.propagate(orbit.getDate().shiftedBy(18540.0)));
    double g2Raw = raw.g(propagator.propagate(orbit.getDate().shiftedBy(18624.0)));
    double g1 = aboveGroundElevationDetector.g(propagator.propagate(orbit.getDate().shiftedBy(18540.0)));
    double g2 = aboveGroundElevationDetector.g(propagator.propagate(orbit.getDate().shiftedBy(18624.0)));
    Assert.assertTrue(g1Raw > 0);
    Assert.assertTrue(g2Raw < 0);
    if (sameSign) {
        Assert.assertTrue(g1 > 0);
        Assert.assertTrue(g2 < 0);
    } else {
        Assert.assertTrue(g1 < 0);
        Assert.assertTrue(g2 > 0);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) TopocentricFrame(org.orekit.frames.TopocentricFrame)

Example 29 with TopocentricFrame

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

the class AngularSeparationDetectorTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data");
        earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
        acatenango = new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(14.500833), FastMath.toRadians(-90.87583), 3976.0), "Acatenango");
        iniDate = new AbsoluteDate(2003, 5, 1, 17, 30, 0.0, TimeScalesFactory.getUTC());
        initialOrbit = new KeplerianOrbit(7e6, 1.0e-4, FastMath.toRadians(98.5), FastMath.toRadians(87.0), FastMath.toRadians(216.59976025619), FastMath.toRadians(319.7), PositionAngle.MEAN, FramesFactory.getEME2000(), iniDate, Constants.EIGEN5C_EARTH_MU);
        propagator = new KeplerianPropagator(initialOrbit);
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) TopocentricFrame(org.orekit.frames.TopocentricFrame) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 30 with TopocentricFrame

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

the class AttitudesSequenceTest method testResetDuringTransitionBackward.

@Test
public void testResetDuringTransitionBackward() throws OrekitException {
    // Initial state definition : date, orbit
    final AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
    final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
    final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
    final Orbit initialOrbit = new KeplerianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initialDate, Constants.EIGEN5C_EARTH_MU);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final TopocentricFrame volgograd = new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(48.7), FastMath.toRadians(44.5), 24.0), "Волгоград");
    final AttitudesSequence attitudesSequence = new AttitudesSequence();
    final double transitionTime = 250.0;
    final AttitudeProvider nadirPointing = new NadirPointing(initialOrbit.getFrame(), earth);
    final AttitudeProvider targetPointing = new TargetPointing(initialOrbit.getFrame(), volgograd.getPoint(), earth);
    final ElevationDetector eventDetector = new ElevationDetector(volgograd).withConstantElevation(FastMath.toRadians(5.0)).withHandler(new ContinueOnEvent<>());
    final List<AbsoluteDate> nadirToTarget = new ArrayList<>();
    attitudesSequence.addSwitchingCondition(nadirPointing, targetPointing, eventDetector, true, false, transitionTime, AngularDerivativesFilter.USE_RR, (previous, next, state) -> nadirToTarget.add(state.getDate()));
    final double[][] tolerance = NumericalPropagator.tolerances(10.0, initialOrbit, initialOrbit.getType());
    final AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 300.0, tolerance[0], tolerance[1]);
    final NumericalPropagator propagator = new NumericalPropagator(integrator);
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("g007_eigen_05c_coef", false));
    propagator.addForceModel(new HolmesFeatherstoneAttractionModel(earth.getBodyFrame(), GravityFieldFactory.getNormalizedProvider(8, 8)));
    propagator.setInitialState(new SpacecraftState(initialOrbit, nadirPointing.getAttitude(initialOrbit, initialOrbit.getDate(), initialOrbit.getFrame())));
    propagator.setAttitudeProvider(attitudesSequence);
    attitudesSequence.registerSwitchEvents(propagator);
    propagator.propagate(initialDate.shiftedBy(6000));
    // check that if we restart a backward propagation from an intermediate state
    // we properly get an interpolated attitude despite we missed the event trigger
    final AbsoluteDate midTransition = nadirToTarget.get(0).shiftedBy(0.5 * transitionTime);
    SpacecraftState state = propagator.propagate(midTransition.shiftedBy(+60), midTransition);
    Rotation nadirR = nadirPointing.getAttitude(state.getOrbit(), state.getDate(), state.getFrame()).getRotation();
    Rotation targetR = targetPointing.getAttitude(state.getOrbit(), state.getDate(), state.getFrame()).getRotation();
    final double reorientationAngle = Rotation.distance(nadirR, targetR);
    Assert.assertEquals(0.5 * reorientationAngle, Rotation.distance(state.getAttitude().getRotation(), targetR), 0.03 * reorientationAngle);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) ElevationDetector(org.orekit.propagation.events.ElevationDetector) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) ArrayList(java.util.ArrayList) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) FieldOrbit(org.orekit.orbits.FieldOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) Test(org.junit.Test)

Aggregations

TopocentricFrame (org.orekit.frames.TopocentricFrame)37 GeodeticPoint (org.orekit.bodies.GeodeticPoint)35 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)31 Test (org.junit.Test)23 AbsoluteDate (org.orekit.time.AbsoluteDate)23 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)22 Propagator (org.orekit.propagation.Propagator)19 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)19 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)17 SpacecraftState (org.orekit.propagation.SpacecraftState)16 Frame (org.orekit.frames.Frame)15 Orbit (org.orekit.orbits.Orbit)14 PVCoordinates (org.orekit.utils.PVCoordinates)14 BodyShape (org.orekit.bodies.BodyShape)13 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)8 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)8 ElevationDetector (org.orekit.propagation.events.ElevationDetector)8 HashMap (java.util.HashMap)6 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)6