ThrustDirection And AttitudeProvider not implemented error in Python

Hi all,

sorry if this is a dumb question but I’m very new to Orekit, and this one completely beats me. Hence, I’ve decided to reach out to you for some help.

A bit of background: I’m trying to propagate a low-thrust trajectory using ConfigurableLowThrustManeuver in Python. Before I got to even create an instance of ConfigurableLowThrustManeuver, however, I ran into the following error when trying to create a ThrustDirectionAndAttitudeProvider, which is needed to create a low-thrust manoeuvre:

thrustDirProvider = ThrustDirectionAndAttitudeProvider(lvlhAttitudeProvider, thrustDirLVLH)
Traceback (most recent call last):

  File "<ipython-input-8-54c89a266d3d>", line 1, in <module>
    thrustDirProvider = ThrustDirectionAndAttitudeProvider(lvlhAttitudeProvider, thrustDirLVLH)

NotImplementedError: ('instantiating java class', <class 'org.orekit.forces.maneuvers.propulsion.ThrustDirectionAndAttitudeProvider'>)

Here’s a sample code that reproduces the error:

from orekit.pyhelpers import download_orekit_data_curdir, setup_orekit_curdir
if not os.path.isfile('orekit-data.zip'):
    download_orekit_data_curdir()
setup_orekit_curdir()

from org.hipparchus.geometry.euclidean.threed import Vector3D
from org.orekit.frames import FramesFactory, LOFType
from org.orekit.attitudes import LofOffset
from org.orekit.forces.maneuvers.propulsion import ThrustDirectionAndAttitudeProvider

j2000 = FramesFactory.getEME2000()

lvlhAttitudeProvider = LofOffset(j2000, LOFType.LVLH)
thrustDirLVLH = Vector3D(1., 0., 0.)
thrustDirProvider = ThrustDirectionAndAttitudeProvider(lvlhAttitudeProvider,
                                                       thrustDirLVLH)

I’ve also tried it with LOFType.VNC and LOFType.TNW with the same result. I’m a bit lost because the way I call the constructor is the same as the one in the source code (link). Needless to say, it’s the same in the docs (link).

In most other cases, simply repeating in Python what is done in Java works, but not here. Any ideas what is wrong?

Hi @AlekLee,

I’m just a fellow python OREKIT user also fumbling my way through some of the more interesting ideas within this great package but I think your problem here is expecting this class-invocation to return an instance of the class, when in this case it does NOT.

What you want is to call the build method of this class:

thrustDirProvider = ThrustDirectionAndAttitudeProvider.buildFromCustomAttitude(lvlhAttitudeProvider, thrustDirLVLH)

It’s an illusion of the Java syntax in those examples, they are calling this method :wink:

1 Like

Ah, thanks for your help, it works like a charm. To be fair, it now seems obvious that this appears as a classmethod in Python but I just didn’t think of it on Friday. Also, I’ve never seen this way of creating of instances in Orekit yet - seems to be quite a mix :wink: