use of org.orekit.propagation.events.GroundFieldOfViewDetector 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);
}
}
Aggregations