Best Practices For Getting Position/Velocity from Propagator


Sorry if this is a basic question as I’m new to Orekit. But in all of the examples for numerical propagation I’ve seen to get positiona and velocity, a SpacecraftState is made and then getPVCoordinates is called, for example:

pv_coords = propagator_num.propagate(propagation_abs_date).getPVCoordinates(eme_2000_frame)

However, the NumericalPropagator class also has a getPVCoordinates method that would be executed as follows:

pv_coords = propagator_num.getPVCoordinates(propagation_abs_date,eme_2000_frame)

From my perspective the outputs are identical. Are these commands truly equivalent, or if I were doing some other calculations (or using event triggers, etc.) is one better practice to use than the other? Or is one more computationally efficient than the other if I’m calculating many positions and velocities sequentially?

Thank you for your time,

Hi @Sam

When you call propagator_num.getPVCoordinates, you trigger a new propagation. When you first propagate and then extract the coordinates, you separate the propagation and the extraction of the date from the propagated state. If you want just one set of coordinates, both method are equivalent, as you indeed need to propagate and get the results. If you want several states, it would be better to use one propagation associated with a step handler, and extract the coordinates on the fly as they are produced.
You can look at the tutorials for the master propagation mode that explains this. Launching a new propagation 1000 times is much more costly thant running one propagation and extraction 1000 coordinates from it.

1 Like