How to log all detected events?


#1

I’m using a basic FoVDetector to try and find out when a point on Earth will be visible to the sensor, but when I get the logged events I only get one event. How do you get all events between the start date and the end date?

Thanks


#2

The simplest way to do that is to wrap your FovDetector using an EventLogger before registering it to your
propagator as follows:

  Propagator propagator = ...
  EventsDetector detector1 = ...
  EventsDetector detector2 = ...
  EventsDetector detector3 = ...
  EventsLogger logger = new EventsLogger();
  propagator.addEventDetector(logger.monitor(detector1));
  propagator.addEventDetector(logger.monitor(detector2));
  propagator.addEventDetector(logger.monitor(detector3));
  propagator.propagate(targetDate);
  List<LoggedEvent> allEvents = logger.getLoggedEvents();

The events are logged according to their occurrence dates, so you get them in a meaningful order.


#3

Another point, which may be more appropriate: the default behavior of FoVDetector is to stop the propagation when the target leaves the field of view. If you want to see several successive events on
one detector of this type, you have to change its default events handler using:

  FowDetector fovd = new FovDetector(...).withHandler(myHandler);

and make sure myHandler returns Action.CONTINUE when evenOccurred is called. The default
handler returns Action.CONTINUE on decreasing events (i.e. when target enters the FoV) and
Action.STOP on increasing events (i;e. when target leaves the FoV).


#4

Thanks, the built-in ContinueOnEvent handler seems to work well.