Pass prediction over an area polygon on ground

I’m trying to predict when an area (defined by a set of coordinates) is visible to payload on the CubeSat. My analogy is as follows:

  1. create a FoV for the CubeSat.
  2. create a target area using SphericalPolygonsSet.
  3. Use FootPrintOverViewDetector for detecting when the FoV crosses the ground target area polygon.

Below is the code for same.

 String line1 = "1 25544U 98067A   23232.54552208  .00013950  00000+0  25634-3 0  9993";
        String line2 = "2 25544  51.6414   9.6997 0003586 329.2127 122.8297 15.49506380411773";
        double mass = 430000;
        double halfApparture = 20;

        // Propagation Characteristics
        AbsoluteDate start_date = new AbsoluteDate(new Date(), TimeScalesFactory.getUTC()); // Propagation starts from date of most recent TLE (Orekit)
        AbsoluteDate final_date = start_date.shiftedBy(1*3600); // 1 day


        //setup orbit from tle
        final TLE tle = new TLE(line1, line2);
        final Frame satelliteFrame = FramesFactory.getTEME();
        var attitudeProvider = new NadirPointing(FramesFactory.getTEME(), Earth.DEFAULT_EARTH_SHAPE);

        final SGP4 propagator = new SGP4(tle, attitudeProvider, mass, satelliteFrame);

        //define satellite FoV
        FieldOfView fov = new CircularFieldOfView(Vector3D.PLUS_K, FastMath.toRadians(halfApparture), 0);


        //define earth
        var earth = Earth.DEFAULT_EARTH_SHAPE;
        var earthFrame = earth.getBodyFrame();

        //define area
        List<Double> AOILongs = List.of(-120.,-119.,-118.);
        List<Double> AOILats = List.of(39.,38.,39.);
        List<Double> AOIAlts = List.of(0.,0.,0.);

        S2Point[] vertex_points = new S2Point[AOILats.size()];

        for (int i = 0; i < AOILats.size(); i++) {
            GeodeticPoint vertex = new GeodeticPoint(FastMath.toRadians(AOILats.get(i)), FastMath.toRadians(AOILongs.get(i)), AOIAlts.get(i));
            vertex_points[i] = new S2Point(FastMath.toRadians(AOILongs.get(i)),FastMath.toRadians(90- AOILats.get(i)));
        }
        System.out.println("check");
        //create the polygon
        SphericalPolygonsSet AOI = new SphericalPolygonsSet(1e-3, vertex_points);

        System.out.println("size of AOI : " + AOI.getSize());

        try {
            EventDetector geoDetect = new FootprintOverlapDetector(fov, (OneAxisEllipsoid) earth,AOI,100)
                    .withMaxCheck(60)// Checking every x second
                    .withHandler((s, detector, increasing) -> {
                        if (increasing) {
                            System.out.println("ENTERING AOI at: " + s.getDate());
                        } else {
                            System.out.println("LEAVING AOI at: " + s.getDate()+"\n");
                        }
                        return  Action.CONTINUE;
                    });


        System.out.println("adding detector to propagator");
        propagator.addEventDetector(geoDetect);
        }catch (Exception e){
            System.err.println(e);
        }


        System.out.println("\n *** start of simulation ***");
        propagator.propagate(start_date,final_date);

        System.out.println("\n *** end of simulation ***");

When I ran this code, the code froze creation of event detector for a long time, finally throwing the following error:

org.orekit.errors.OrekitInternalError: internal error, please notify development team by creating a new topic at https://forum.orekit.org

the time after this error shows up is directly related to the sampling rate value in the FootPrintOverlapDetector, as when I had a value 10 , the error takes a lot of time to show up while if it’s 1000 , the error pops up immediately.

When I replaced FootPrintOverlapDetector with GeographicalZoneDetector , the code is running, but the results are way off.

Hi @shresthdeepgupta,

Sorry for the delay. I’m answering to move up your issue.
Do you still experience this issue?

If yes, it’s probably a bug, I reproduced it. But I’m not proficient enough in this type of feature to be of any help.
Could you please open an issue on the forge?
I don’t see any error in your code, I just have two comments:

I guess you have your own function for getting Earth ellipsoid and ITRF frame?

Just a side note, you can use EllipsoidTesselator.buidlSimpleZone(final double tolerance, final GeodeticPoint... points) for this one.

Cheers,
Maxime

Thanks for the reply @MaximeJ , My issue is solved though , I did use the EllipsoidTesselator.buidlSimpleZone(final double tolerance, final GeodeticPoint... points).
The issue was with the hyperplane thickness parameter and the tolerence parameter.
I took the reference values from an orekit tutorial about DOP computation and it worked afterward.

1 Like

Oh, that’s great to read @shresthdeepgupta!

For the record (and future users), you used 1.e-10 for hyperplane thickness instead of 1.e-3 right?

1 Like

Yes, thats correct.