FieldPVCoordinates from providers

Hi there,

I’m trying to use ephemeris with an epoch defined as a FieldAbsoluteDate but the Python wrapper is giving me some difficulties.
Image you have an AbsoluteDate ‘ref_date’ and a Frame ‘ref_frame’. Then:

nvar, order = 3, 1
ds_factory = DSFactory(nvar, order)
var_time = ds_factory.variable(0, 1.)
zero_ds = ds_factory.constant(0.)
solar_system_barycenter = PVCoordinatesProvider.cast_(CelestialBodyFactory.getSolarSystemBarycenter())
var_date = FieldAbsoluteDate(ref_date, var_time)
solar_system_barycenter.getPVCoordinates(var_date, ref_frame)

It gives me the following error:
orekit.InvalidArgsError: (<class ‘org.orekit.utils.PVCoordinatesProvider’>, ‘getPVCoordinates’, (<FieldAbsoluteDate: 2022-03-04T01:53:01.130645Z>, <FactoryManagedFrame: EME2000>))

But from the Java code I do not see what the problem is, as JPLCelestialBody has a getPVCoordinates accepting a FieldAbsoluteDate and a Frame.

Note that the relevant imports are:
from org.orekit.utils import PVCoordinatesProvider
from org.orekit.bodies import CelestialBodyFactory
from org.orekit.time import FieldAbsoluteDate
from org.hipparchus.analysis.differentiation import DSFactory


Hi Romain,

The method getPVCoordinates(FieldAbsoluteDate, Frame) is not in the PVCoordinatesProvider interface but in FieldPVCoordinatesProvider (or in ExtendedPVCoordinatesProvider). That’s why you have the error.
However, JPLCelestialBody doesn’t implements the FieldPVCoordinatesProvider interface.

Therefore, could you .cast_() to ExtendedPVCoordinatesProvider? I tried and it works.

from org.orekit.utils import ExtendedPVCoordinatesProvider


solar_system_barycenter = ExtendedPVCoordinatesProvider.cast_(CelestialBodyFactory.getSolarSystemBarycenter())


Best regards,

Hi Bryan,

thank you so much, it works!