Return type of transformPVCoordinates with TimeStampedPVCoordinates

#1

When using the transformPVCoordinates method of a Transform object with a TimeStampedPVCoordinates argument I get a PVCoordinates type return value instead of a TimeStampedPVCoordinates return value as documented in the api docs. I’m using the Python wrapper for Orekit v9.3. Is this an issue with Orekit, the wrapper, or just my understanding?

0 Likes

#2

Hi,

Sometimes it is necessary to explicitly cast the return if there are different options.

Try:

TimeStampedPVCoordinates.cast_(result)

Regards
/Petrus

0 Likes

#3

Hi Petrus,

Thanks for the quick response. I get a TypeError when I attempt to cast the result to a TimeStampedPVTCoordinates object.

-JP

0 Likes

#4

Hi,

Could you please post a short example that is not working and we can try to have a look at it?

Regards
/Petrus

0 Likes

#5

Sorry, should have included this in the first post. Thanks!

import orekit

orekit.initVM()

from os.path import join
from orekit.pyhelpers import setup_orekit_curdir, datetime_to_absolutedate
setup_orekit_curdir()

from datetime import datetime

from org.orekit.utils import TimeStampedPVCoordinates
from org.orekit.frames import FramesFactory
from org.hipparchus.geometry.euclidean.threed import Vector3D

# Create initial TimeStampedPVCoordinates
pos = Vector3D(10000., 20000., 30000.)
vel = Vector3D(2000., 1000., 1500.)
date = datetime_to_absolutedate(datetime(2019, 4, 5))
pvt1 = TimeStampedPVCoordinates(date, pos, vel)
print(type(pvt1))

# Create transform
eme2000 = FramesFactory.getEME2000()
icrf = FramesFactory.getICRF()
transform = eme2000.getTransformTo(icrf, date)

# Transform the TimeStampedPVCoordinates
pvt2 = transform.transformPVCoordinates(pvt1)
print(type(pvt2))
TimeStampedPVCoordinates.cast_(pvt2)
0 Likes

#6

Thanks. Very wierd. This worked in python wrapper v 9.2… Will investigate.

0 Likes

#7

I get a different result on my machine. Your code provides the following output.
I tried with both Orekit 9.3 and 9.3.1 (installed via conda-forge). My machine runs on Ubuntu 18.10 x64.

<class ‘TimeStampedPVCoordinates’>
<class ‘TimeStampedPVCoordinates’>
<TimeStampedPVCoordinates: {2019-04-05T00:00:00.000, P(-1.4498577873328207E11, -3.37158245950099E10, -1.4620953546524195E10), V(9044.628901335669, -25553.01231150674, -10010.117818595207), A(0.005764302570035149, 0.0013827271370062176, 5.965191625383763E-4)}>

Regards
yzokras

0 Likes

#8

Hmmm. I’m running Orekit 9.3.1 but on a Windows machine.

<class 'TimeStampedPVCoordinates'>
<class 'PVCoordinates'>
Traceback (most recent call last):
  File "transform_sample.py", line 30, in <module>
    TimeStampedPVCoordinates.cast_(pvt2)
TypeError: {P(-1.4498577873328207E11, -3.37158245950099E10, -1.4620953546524195E10), V(9044.628901335669, -25553.01231150674, -10010.117818595207), A(0.005764302570035149, 0.0013827271370062176, 5.965191625383763E-4)}
0 Likes

#9

Hi, after some troubleshooting this is a clear bug in the python wrapping and we’re trying to solve it. The problem occurs when there is overloaded methods with same number of variables and some versions are subclasses of each other, like PVCoordinates and TimeStampPVCoordinates. The matching of right method will at current moment be non-deterministic in this case and thus the effects as seen above occurs… I am surprised we have not seen this before.

0 Likes