Since there have been significant improvements in handling events using the python wrappers with the new v.12, I thought I would share my updated version of the code
from org.orekit.bodies import GeodeticPoint from org.orekit.bodies import OneAxisEllipsoid from org.orekit.frames import FramesFactory from org.orekit.frames import TopocentricFrame from org.orekit.propagation.events import ElevationDetector from org.orekit.propagation.events import EventsLogger from org.orekit.utils import Constants as OrekitConstants from org.orekit.utils import IERSConventions def locate_event() : # Create earth earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, True) earthBodyShape = OneAxisEllipsoid(OrekitConstants.WGS84_EARTH_EQUATORIAL_RADIUS, OrekitConstants.WGS84_EARTH_FLATTENING, earthFrame) # Creates the propagators orekitSat = # function to make orekit satellite station = GeodeticPoint(lat, lon, alt) frame = TopocentricFrame(earthBodyShape, station, "name") passDetector = ElevationDetector(frame).withConstantElevation(threshold_elev) # Create events logger logger = EventsLogger() logPass = logger.monitorDetector(passDetector) # NOTE: Need to propagate to start time before can run event detector! # Otherwise risk bad pass data b/c of incorrect start times! sat.propagate(start_time) sat.addEventDetector(logPass) # Propagates through until hit the stop time while sat.propagate(stop_time).getDate().isBefore(stop_time) : pass # Extracts events from the logger for i in range(0, logger.getLoggedEvents().size()) : # Get spacecraft state s = logger.getLoggedEvents().get(i).getState()
@petrus.hyvonen I do have one question. Right now whether the satellite stops or continues to propagate when it encounters an event is automatically set by the EventDetector class used. It is not a big deal because all events are logged and you can simply continue to propagate the satellite until you hit your desired stop point, but Is there any way to set this condition manually in the python without resorting to a custom class such as was required in v.11? Thank you.