SpacececraftState in WGS84

Hi everyone,

How can I preform the following steps in Orekit?

  1. Define an initial SpacecraftState, with Position and Velocity in WGS84 ECEF reference frame freezed inertially at a specified AbsoluteDate
  2. Convert it to EME2000

Thank you.

Kind Regards,
Alfredo

I’ve tried to define a SpacecraftState with ITRF reference frame but I get the Java error:

    return SpacecraftState(AbsolutePVCoordinates(itrf,epoch,pos,vel))
orekit.JavaError: <super: <class 'JavaError'>, <JavaError object>>
    Java stacktrace:
org.orekit.errors.OrekitException: non pseudo-inertial frame "CIO/2010-based ITRF simple EOP"
        at org.orekit.attitudes.LofOffset.<init>(LofOffset.java:110)
        at org.orekit.attitudes.LofOffset.<init>(LofOffset.java:66)
        at org.orekit.propagation.SpacecraftState.<init>(SpacecraftState.java:305)

I guess I’m doing something illegal…

What is the legal way to do it?

Thank you,
Alfredo

SpacecraftState contains an orbit, an attitude and a mass, plus additional states if you want to add some. Both orbit and attitude reference a frame, and this frame must be the same when they are combined inside a SpacecraftState. In addtion, this frame must be inertial (this constraint comes from the orbit in fact).

So if want to use an Earth frame, you need to perform the conversion on objects that are lower level than spacecraft state and orbit. You should probably use TimeStampedPVCoordinates for this. If you define the pv coordinates in an Earth frame, than you can convert them to inertial frame and build your orbit and spacecraft state from here.

1 Like

Thanks @luc for your answer.
In order to perform the frame conversion at lower level, I’ve implemented the following Python code:

MU = Constants.IERS96_EARTH_MU
conventions = IERSConventions.IERS_2010
ITRF = FramesFactory.getITRF(conventions, True)
J2K_FRAME = FramesFactory.getEME2000()
[...]
tsPV = TimeStampedPVCoordinates(epoch,pos,vel)
aPV = AbsolutePVCoordinates(ITRF,tsPV)
j2k_tsPV = aPV.getPVCoordinates(J2K_FRAME)
print(j2k_tsPV)
print(J2K_FRAME)
print(MU)
orb = Orbit(j2k_tsPV, J2K_FRAME, MU)
s = SpacecraftState(orb)

the print instructions return the following:

{2022-11-07T10:00:00.000, P(-6625698.96093138, -1937317.9139614117, 14595.218396309592), V(-261.8177580950879, 952.1896670039744, 7534.368664024117), A(-0.17407128070403508, -0.05089755772523169, 3.8346679764692746E-4)}
EME2000
398600441800000.0

but then I get this Java error:

File "/home/alfre/python/epic_utils.py", line 198, in loadPostLaunchOPM
    orb = Orbit(j2k_tsPV, J2K_FRAME, MU)
NotImplementedError: ('instantiating java class', <class 'org.orekit.orbits.Orbit'>)

What is it telling me?

Thank you,
Alfredo

Hi @acapobianchi,

‘Orbit’ is an abstract class in Java so it cannot be instantiated.
You need to choose an orbit type. In your case, a ‘CartesianOrbit’ seems appropriate.

1 Like

Thanks @MaximeJ for your explanation, it helped me solving my problem.

I have this working Python code, if anyone else needs it:

pos = Vector3D(float(r[3]), float(r[5]), float(r[7]))
vel = Vector3D(float(v[3]), float(v[5]), float(v[7]))
tsPV = TimeStampedPVCoordinates(epoch,pos,vel) # coordinates definition at a give epoc (AbsoluteDate)
aPV = AbsolutePVCoordinates(ITRF,tsPV)                # ECEF state vector
j2k_tsPV = aPV.getPVCoordinates(J2K_FRAME)     # Conversion to EME2000 occurs here!
orb = CartesianOrbit(j2k_tsPV, J2K_FRAME, MU)
s = SpacecraftState(orb)

Thanks @luc and @MaximeJ for your tips!

Kind Regards,
Alfredo

@bcazabonne,
would you be so kind as to confirm that this implementation of conversion from WGS84 to EME2000 is correct from the theoretical point of view?
Thank you very much.
Kind Regards,
Alfredo

Hi,

The code looks good!

Best regards,
Bryan

1 Like

Thank you very much @bcazabonne!

Really appreciate your approval.

Kind Regards,
Alfredo