Dear Orekit community,
after jumping on the following topic : Computation between spacecraft and moving objects, I tried to compute such calculations in order to detect when a random moving object, like an aircraft, can be seen from a spacecraft, circulating in a keplerian orbit.
The idea I tried is the following :
- Create the primary object, orbit and propagator (I think this is good, defining a Keplerian Orbit and a Keplerian propagator)
- Create the aircraft trajectory, using 3 waypoints.
- Create an ephemeris from this trajectory in order to use it in the InterSatDirectViewDetector
- add this detector to the primary propagator, propagate and retrieve the detector logged events
The thing is, I’m not sure how to use the created Hermite interpolator in order to define the aircraft trajectory. The aircraft trajectory is here defined using 3 waypoints defined by PVcoordinates.
I have the following code that is running without erros (using the python wrapper), but which is not really well implemented regarding the Ephemeris and Interpolator. What I thought right was to use a set of interpolated point to create the ephemeris (not yet coded here). Is it the right way to create the Ephemeris with the Hermite Interpolator ? Please not that the aicraft waypoints defining the trajectory is quite random for the moment …
# Start date of the propagation
initial_date = AbsoluteDate(2025, 1, 1, 0, 0, 0.0, TimeScalesFactory.getUTC())
ra = 800 * 1000.0 # Apogee in meters
rp = 800 * 1000.0 # Perigee in meters
i = 60.0 # Inclination in deg
omega = float(0) # Perigee argument in deg
raan = float(0) # Right ascension of ascending node in deg
lv = float(0) # True anomaly in deg
a = (rp + ra + 2 * Constants.WGS84_EARTH_EQUATORIAL_RADIUS) / 2.0 # SMA
e = 1.0 - (rp + Constants.WGS84_EARTH_EQUATORIAL_RADIUS) / a # Ecc
# Creation of the primary orbit
initial_orbit = KeplerianOrbit(a,e,math.radians(i),math.radians(omega),math.radians(raan),math.radians(lv),PositionAngleType.TRUE,FramesFactory.getEME2000(),
initial_date,Constants.WGS84_EARTH_MU)
propagator_1 = KeplerianPropagator(initial_orbit)
Propagation_duration = 500.0 # propagation duration in seconds
# Definition of the aircraft trajectory
aircraft_states = ArrayList()
aircraft_pv_coordinates = ArrayList()
for k in range(3):
dt = k * 250.0
# Define PV coordinates every 250 s
date = initial_date.shiftedBy(dt)
position = Vector3D(7078000.0 , 0.0 + k * 800*100.0, 0.0 + k * 600*100.0)
velocity = Vector3D(0.0, 3725.0, 6450.0)
acceleration = Vector3D(-7.0, 0.0, 0.0)
# Create the absolutePVcoordinates
abs_pv = AbsolutePVCoordinates(FramesFactory.getEME2000(), date,position , velocity,acceleration)
aircraft_pv_coordinates.add(TimeStampedPVCoordinates(date, position, velocity, acceleration))
# Create the spacecraft (so here aircraft) state in order to use it in the ephemeris
state = SpacecraftState(abs_pv)
aircraft_states.add(state)
interpolator = TimeStampedPVCoordinatesHermiteInterpolator(3)
target_date = initial_date.shiftedBy(30.0)
interpolated_point = interpolator.interpolate(target_date, aircraft_pv_coordinates) # Where to use ? in the following ephemeris ?
ephemeris = Ephemeris(aircraft_states,3)
detector = InterSatDirectViewDetector(earth, ephemeris)
# Adding the IntersatDirectView detector to the primary propagator
propagator_1.addEventDetector(detector)
# Log all events
logger = EventsLogger()
logged_detector = logger.monitorDetector(detector)
propagator_1.addEventDetector(logged_detector)
# Propagate the Primary orbit
final_state = propagator_1.propagate(initial_date, initial_date.shiftedBy(Propagation_duration))
get_visu_event = logger.getLoggedEvents()
print(get_visu_event)
Thank you for the help you could provide me with !
EM