Wrong usage of FieldOfViewDetector

Hi all, I wrote in another topic about a GNSS sim that I am writing. I made some progress and I’m trying to use InterSatDirectViewDetector and FieldOfViewDetector for the event based scheduler. My current code is working with the only inclusion of the first detector. Once I introduce also the second one the following error is displayed

org.orekit.errors.OrekitException: zero norm
	at org.orekit.errors.OrekitException.unwrap(OrekitException.java:154)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.integrateDynamics(AbstractIntegratedPropagator.java:565)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:474)
	at org.orekit.propagation.PropagatorsParallelizer$PropagatorMonitoring.lambda$new$0(PropagatorsParallelizer.java:417)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Caused by: org.hipparchus.exception.MathRuntimeException: zero norm
	at org.hipparchus.geometry.euclidean.threed.Vector3D.angle(Vector3D.java:359)
	at org.orekit.geometry.fov.CircularFieldOfView.offsetFromBoundary(CircularFieldOfView.java:75)
	at org.orekit.propagation.events.FieldOfViewDetector.g(FieldOfViewDetector.java:160)
	at org.orekit.propagation.events.NegateDetector.g(NegateDetector.java:86)

I do not show all the traceback for the sake of brevity. I do not understand how to fix it: as far as I understood InterSat detector acts on the secondary (I am using GNSS satellite read from SP3 as suggested) but it is attached to the primary in the propagation, whereas for FieldOfViewDetector it seems the opposite (as PVCoordinateProvider I am using my LEO satellite). I report a piece of code hereinafter

    for item in sp3_ephemeris.keySet():
        sp3_prop = EphemerisFile.SatelliteEphemeris.cast_(sp3_ephemeris.get(item)).getPropagator()
        sp3_att = LofOffset(sp3_prop.getFrame(), LOFType.LVLH)
        sp3_prop.setAttitudeProvider(sp3_att)
        gnss_satellite = generator.addPropagator(sp3_prop)
        visib_inter_sat = InterSatDirectViewDetector(ear_shape, sp3_prop)
        field_of_view = CircularFieldOfView(Vector3D.MINUS_I, FOV_HA, 0.0)
        visib_field_of_view = FieldOfViewDetector(generator.getPropagator(satellite), field_of_view).withHandler(ContinueOnEvent())
        visib_metric = BooleanDetector.andCombine([visib_inter_sat, BooleanDetector.notCombine(visib_field_of_view)])

Do you have any ideas where is the error? Thanks

You got a zero norm math exception - if I understand this correctly, it means you have a vector with a magnitude of zero, and the code cannot normalize it. Do you have any reason to believe your code is trying to normalize a zero-magnitude vector?

Looking at the traceback of the error it seems that zero norm issue is encountered during the computation of angle between LEO and GNSS satellites positions for the field of view visibility condition. But I do not understand why it should be zero. I can’t find the error in my implementation. If you need the whole code, I can post it.