Help with custom frame transformation

Hi all,

after reading official frames tutorial, I have been trying to build a custom MarsICRF frame and convert vectors w.r.t. this frame into the MarsFIXED one (this last frame is already implemented in Orekit following IAU definitions.)

I’ve created an small script, which runs on the following steps:

  • Compute the actual location of Mars barycenter in ICRF frame.
  • Define de MarsICRF as a pure translation of ICRF but centered in previously computed planet position.
  • Get MarsFIXED frame and compute transformation MarsICRF → MarsFIXED.
  • Check if vectors are properly converted comparing against GMAT expected output.

My implementation can be found here: Converts from custom MarsICRS to MarsFixed using Orekit API · GitHub

I define the following position vector w.r.t. MarsICRS:

POS = Vector3D(float(7000e3), float(5000e3), float(200e3))  # [m]

The computed and expected results w.r.t. MarsFIXED are as follows:

computed_pos = [292696819883.6013, -234324874333.56342, -175803942360.86267]
expected_pos = [-8471116.77589713, 845074.9156806216, 1251410.786458257]

I am definitely missing something, as the position vector predicted by my implementation is extremely huge… May anyone guide me through this or give me a hint? Any kind of help is welcomed.

Thank you in advance for your time!

Hi jorgepiloto,

Don’t use UpdatableFrame. This isn’t the use case it is designed for as described in its javadocs. Try making a copy of the TransformProvider in JPLCelestialBody.InertiallyOriented that skips adding the rotation for the IAU pole. Then build your frame with that: new Frame(icrf, transformProvider, "marsCenteredICRF"). Does that make sense?

I think your bug was you forgot to negate the Mars position so instead of subtracting it the frame transform doubled it.

Regards,
Evan

Thank you so much @evan.ward, you helped me a lot with these :rocket: