use of org.orekit.bodies.GeodeticPoint 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);
}
}
use of org.orekit.bodies.GeodeticPoint 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);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class EventEnablingPredicateFilterTest method setUp.
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
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);
orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
}
use of org.orekit.bodies.GeodeticPoint 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());
}
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class LongitudeCrossingDetectorTest 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));
LongitudeCrossingDetector d = new LongitudeCrossingDetector(600.0, 1.e-6, earth, FastMath.toRadians(-100.0)).withHandler(new ContinueOnEvent<LongitudeCrossingDetector>());
Assert.assertEquals(600.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
Assert.assertEquals(-100.0, FastMath.toDegrees(d.getLongitude()), 1.0e-14);
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[] expectedLatitudes = new double[] { -6.5394381901, -0.4918760372, +6.5916016832 };
Assert.assertEquals(3, logger.getLoggedEvents().size());
for (int i = 0; i < 3; ++i) {
SpacecraftState state = logger.getLoggedEvents().get(i).getState();
GeodeticPoint gp = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null);
Assert.assertEquals(expectedLatitudes[i], FastMath.toDegrees(gp.getLatitude()), 1.0e-10);
Assert.assertEquals(-100.0, FastMath.toDegrees(gp.getLongitude()), 1.2e-9);
}
}
Aggregations