Question about transforming velocity coordinates

Hello,

I am new to Orekit and I am trying to convert coordinates from the GCRF frame to ITRF. I followed the tutorial for converting the position coordinates, but am encountering issues when it comes to velocity.

I’ve tried two different methods:

target_frame = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
inertialFrame = FramesFactory.getGCRF()

for time, tmp_s in zip(t,s):
    trans = inertialFrame.getTransformTo(target_frame, time)
    pos = StaticTransform.cast_(trans).transformPosition(tmp_s.getPVCoordinates().getPosition())
    x_itrf.append(pos.getX()/1000)
    y_itrf.append(pos.getY()/1000)
    z_itrf.append(pos.getZ()/1000)
    vel = StaticTransform.cast_(trans).transformPosition(tmp_s.getPVCoordinates().getVelocity())
    vx_itrf.append(vel.getX()/1000)
    vy_itrf.append(vel.getY()/1000)
    vz_itrf.append(vel.getZ()/1000)

but from what I can tell from looking through the forum/documentation, using StaticTransform for velocity transformations is incorrect (?)

I have also tried transforming the PVCoordinates and extracting the position and velocity from these:

for time, tmp_s in zip(t,s):
    trans = inertialFrame.getTransformTo(target_frame, time)
    pv_coords = inertialFrame.getTransformTo(target_frame, time).transformPVCoordinates(tmp_s.getPVCoordinates())

    pv_itrf.append(pv_coords)

    x_itrf.append(pv_coords.getPosition().getX()/1000)
    y_itrf.append(pv_coords.getPosition().getY()/1000)
    z_itrf.append(pv_coords.getPosition().getZ()/1000)
    vx_itrf.append(pv_coords.getVelocity().getX()/1000)
    vy_itrf.append(pv_coords.getVelocity().getY()/1000)
    vz_itrf.append(pv_coords.getVelocity().getZ()/1000)

but when I compare the position coordinates using this method to the ones I previously generated using StaticTransform.cast_ they differ greatly so I am not sure that my implementation of the transformation is correct, for either position or velocity.

Are either of these methods correct for transforming the velocity coordinates?
This is just for a Keplerian Orbit generated by the following code for a set of initial orbital elements:

cart_orbit = OrbitType.CARTESIAN.convertType(initialOrbit)

propagator = KeplerianPropagator(initialOrbit)

el = []
pv = []
t = []
s = []

while (extrapDate.compareTo(finalDate) <= 0.0):
    s.append(propagator.propagate(extrapDate))
    t.append(extrapDate)
    extrapDate = extrapDate.shiftedBy(10.0)

Thank you for any help and apologies for anything that isn’t clear!
Amelia

Hi @ameliasamuel

Welcome to the Orekit forum! :slight_smile:

That’s right. The purpose of StaticTransform is to only transform the position vector. This class exists because transforming only the position is something usual. Then the class reduce the computations. For position/velocity transformation, you shall use Transform object.

I’m not sure that casting the object will change the Transform to a StaticTransform.
If you want to transform both position and velocity, you shall use your second solution, not the one using StaticTransform:

    trans = inertialFrame.getTransformTo(target_frame, time)
    pv_coords = inertialFrame.getTransformTo(target_frame, time).transformPVCoordinates(tmp_s.getPVCoordinates())

Note that the Transform object will transform everything it can (position, velocity, acceleration, attitude, etc.).
For 12.1 we created a new class KinematicTransform that only transform positon and velocity. It is better for performance. This class is not yet released, but it is available in the development version.

I hope I answered your questions.
Best regards,
Bryan

Hi Bryan,

Thank you very much! I’ve implemented the second solution successfully.

Amelia