AttributeError: 'Transform' object has no attribute 'transformPosition'

Hi,

In orekit v11.2, the frame transformation is improved.

An interface StaticTransform is added, which contains the followings methods transformPosition, transformVector and transformLine.

So, in Python, an instance Transform needs to be cast as StaticTransform to use the method transformPosition.
Or the error occurs, AttributeError: 'Transform' object has no attribute 'transformPosition'.

Here is an example,

transform_tnw = LOFType.TNW.transformFromInertial(date, pv)
transform_tnw = StaticTransform.cast_(transform_tnw)
tnw_pos = transform_tnw.transformPosition(pos)

Wow I didn’t realize that would be a side effect. That seems very annoying to have to do. It also makes it seem that the Python interface is unable to use Java’s polymorphism, which is the main benefit of using an object oriented language.

I just have a question. Do we have to do a patch to restore the previous version and merge the change in a 12.0 version?

Bryan

Hi @bcazabonne and @evan.ward,

I think there is no need to do the patch to restore the previous version. It is just the python’s issue. Since orekit is Java, so we focus on java.

I post this topic is just to figure out these is an such issue and how to fix it in python.

Maybe we should try to find a solution to use Java’s polymorphism in python by the wrapper. Though, I don’t know if it is possible.

Regards,
lirw

Hello,

I’m opening this subject once but I tried your method and obtained:

AttributeError: 'LOFType' object has no attribute 'transformFromInertial'

My initial code is

pv = self.satellite.propagator.getPVCoordinates(absDateList[i], inertialFrame)
                pos_tmp = pv.getPosition()
                frameTrans = inertialFrame.getTransformTo(self.groundStation.frame, absDateList[i])
                channelLength[i] = frameTrans.transformPosition(pos_tmp).getNorm()

Thanks again

Hi there,

I’m guessing you’re using orekit 12, because in this version the method you’re trying to use is defined in a new interface called LOF. So try casting with that instead of LOFType.

Cheers,
Romain.