I’m having some trouble getting the GroundFieldOfViewDetector class to work as I would expect it to, and I’m wondering if someone has an idea why. I’m essentially using one the tutorial cases where I can use an ElevationDetector successfully to identify when a minimum elevation is crossed, but when I keep everything the same except for the event detector, it stops detecting new events.
My setup code is here:
EventsLogger logger = new EventsLogger();
// Orekit Example Satellite Definition
Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 0.0, TimeScalesFactory.getUTC());
TimeStampedPVCoordinates state = new TimeStampedPVCoordinates(initialDate, position, velocity);
Frame inertialFrame = FramesFactory.getEME2000();
// Creating the propagator
double mu = 3.986004415e+14;
Orbit initialOrbit = new KeplerianOrbit(state, inertialFrame, initialDate, mu);
Propagator prop = new KeplerianPropagator(initialOrbit);
// Creating a Fake Sensor
double longitude = FastMath.toRadians(45.);
double latitude = FastMath.toRadians(25.);
double altitude = 0.;
GeodeticPoint station1 = new GeodeticPoint(latitude, longitude, altitude);
// Creating the Topocentric Frame for the Sensor
Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
earthFrame);
TopocentricFrame sta1Frame = new TopocentricFrame(earth, station1, "station1");
I follow that up with this implementation of the event detector:
// Creating the field of view detector
FieldOfView fov = new CircularFieldOfView(Vector3D.PLUS_K, 80.0, 0.0);
GroundFieldOfViewDetector sta1Visi = new GroundFieldOfViewDetector(sta1Frame, fov)
.withHandler((s,d,increasing)->{
return Action.CONTINUE;
});
Followed up by the propagation and logging:
prop.addEventDetector(logger.monitorDetector(sta1Visi));
SpacecraftState finalState = prop.propagate(new AbsoluteDate(initialDate, 86400.0));
List<LoggedEvent> events = logger.getLoggedEvents();
for (LoggedEvent event : events) {
String enterExit = event.isIncreasing() ? "ENTERED" : "EXITED";
System.out.println("EVENT: " + event.getDate().toString() + " " + enterExit);
}
System.out.println(" Final state : " + finalState.getDate().durationFrom(initialDate));
This produces the message in the last line relating to the propagation time but nothing that includes entry/exit events. When I replace the EventDetector with a ElevationDetector, then it detects events with no trouble. The detector code that I used is this:
// Creating a min elevation detector
double maxcheck = 60.0;
double threshold = 0.001;
double elevation = FastMath.toRadians(5.);
EventDetector sta1Visi = new ElevationDetector(maxcheck, threshold,
sta1Frame)
.withConstantElevation(elevation)
.withHandler((s, detector, increasing) -> {
return Action.CONTINUE;
});
Any ideas why one works and the other doesn’t?