Chained event detector - logical "AND"
I think it would be useful to have a possibility of "chained" event detectors, such that it is possible to combine for example an elevation detector and a eclipse detector (to detect passes in sunlight). This can of course be done today but combining several detectors by logical AND would be a quick way to do this. I think operators like AND and possible OR would be useful.
I don't know the detector architecture in depth, so there might be reasons for not doing this, but did a first example at a very simple two-detector AND, but there is surely better and more architecturally clean ways of doing this
Let me know what you think, and if there are better ways to do this.
#1 Updated by Luc Maisonobe 8 months ago
The idea is interesting.
Concerning the implementation, I would suggest relying on the EventEnablingPredicateFilter class,
which takes care of a lot of special cases.
Also note the notion of And/Or works only for detection functions that have a semantic of
in/out regions. this for example does not apply to DateDetector where the sign changes
at specific instants, but the before and after do not have a meaning of in/out.
I have working AND, OR, and NOT detectors. The detectors assume a positive g function means true and a negative g function means false. While there are many functions that have the same effect I think using Math.min() for AND and Math.max() for OR is the best way to implement the g function because it avoids numerical stability problems. I can contribute the three detectors if you think they would be a good addition.
I think the EventEnablingPredicateFilter class is trying to solve a different problem. Petrus' problem is triggering event based on entry or exit from a two dimensional region. If elevation angle is the x axis and sunlight is the y axis then the region is the first quadrant. Crossing either boundary should trigger an event. From my understanding of the documentation for EventEnablingPredicateFilter it only triggers on events from one event detector and so would only trigger on one of the boundaries. Also the implementation of an AND detector is simpler which is a benefit when it is sufficient.