I’m trying to find the periods of a satellite when the satellite is above the coordinates. But when I propagate to a time further than the tle’s date LongitudeCrossingDetector is triggered excessively and single coordinate prediction does not complete
This problem doesn’t happen on python
Here is the relevant code:
public static OneAxisEllipsoid EARTH;
@BeforeAll
static void beforeAll() {
Utils.setDataRoot(); //load orekit data
EARTH = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
FramesFactory.getITRF(IERSConventions.IERS_2010, true));
}
@Test
void test(){
String[] tle = new String[]{
"Test tle",
"1 25544U 98067A 22257.49623145 .00008872 00000-0 16209-3 0 9998",
"2 25544 51.6424 254.1285 0002269 232.3655 233.3422 15.50204391359035"
};
ZonedDateTime startDate = ZonedDateTime.parse("2022-09-14T17:51:34.39728Z");
ZonedDateTime finalDate = ZonedDateTime.parse("2022-09-14T21:54:34.39728Z");
//when
getIntervals2(tle, startDate, finalDate, 0, 0, 10, 10);
}
private List<Pair<ZonedDateTime, ZonedDateTime>> getIntervals2(
String[] tle,
ZonedDateTime startDate, ZonedDateTime finalDate,
int startLat, int startLon,
int endLat, int endLon
) {
var orekitTle = new org.orekit.propagation.analytical.tle.TLE(tle[1], tle[2]);
var attitudeProvider = new NadirPointing(FramesFactory.getTEME(), EARTH);
var sgp4 = TLEPropagator.selectExtrapolator(orekitTle, attitudeProvider, 466615.0);
var lonEntryDetector = new LongitudeCrossingDetector(EARTH, FastMath.toRadians(startLon))
.withHandler((s, detector, increasing) -> {
System.out.println(s + " " + increasing);
return Action.CONTINUE;
});
var lonExitDetector = new LongitudeCrossingDetector(EARTH, FastMath.toRadians(endLon))
.withHandler((s, detector, increasing) -> {
System.out.println(s + " " + increasing);
return Action.CONTINUE;
});
sgp4.addEventDetector(lonEntryDetector);
sgp4.addEventDetector(lonExitDetector);
sgp4.propagate(toAbs(startDate), toAbs(finalDate));
return null;
}
private AbsoluteDate toAbs(ZonedDateTime zdt){
var utc = TimeScalesFactory.getUTC();
long millis = zdt.toEpochSecond() * TimeUnit.SECONDS.toMillis(1);
return new AbsoluteDate(new Date(millis), utc);
}