Hello,
If I have a state vector whose PVCoordinates are in ECEF, do I need to first, convert state vector position and velocity to ECI, before propagation, like this…
public Orbit calculateOrbit(Vector3D position, Vector3D velocity, AbsoluteDate date) {
// Create an instance of the ITRF 2008 frame (ECEF)
Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
// Create an instance of the GCRF frame (ECI)
Frame eci = FramesFactory.getICRF();
// All ephemeris files are in the ECI frame, no conversion is necessary.
PVCoordinates pvCoordinatesECEF = new PVCoordinates(position, velocity);
// Get the transform from ECEF to ECI at the target date
Transform ecefToEci = ecef.getTransformTo(eci, date);
// Apply the transform to the ECEF coordinates
PVCoordinates eciPV = ecefToEci.transformPVCoordinates(pvCoordinatesECEF);
printLLA(eciPV, eci, date); // debugging
// Calculate and return the CartesianOrbit orbit
return new CartesianOrbit(eciPV, FramesFactory.getICRF(), date, earth.getGM());
}
I have tried the above code with this state vector, reminder it’s ECEF.
as you point out, you need to convert coordinates to an inertial frame
your coordinates seem to be in kilometers and kilometers per seconds, whereas Orekit API is in SI units (i.e meters and meters per second)
you define your orbit as being defined in ICRF frame, which is an inertial frame at the solar system barycenters, hence about 150 million kilometers from Earth
Luc has answered you, but I would just add that if you actually try to define a CartesianOrbit in a rotating frame, you’ll get an exception.
The (Field)Orbit class assume the motion is in (un)perturbed two body problem. To relax this constraint, you can look at SpacecraftState using AbsolutePVCoordinates.
If my goal is to propagate in ECI would I instead use FramesFactory.getEME2000(). I have updated my transformation code like so.
public Orbit calculateOrbit(Vector3D position, Vector3D velocity, AbsoluteDate date) {
// Create an instance of the ITRF 2008 frame (ECEF)
Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
// Create an instance of the ECI frame.
Frame eci = FramesFactory.getEME2000();
// All ephemeris files are in the ECI frame, no conversion is necessary.
PVCoordinates pvCoordinatesECEF = new PVCoordinates(position, velocity);
// Get the transform from ECEF to ECI at the target date
Transform ecefToEci = ecef.getTransformTo(eci, date);
// Apply the transform to the ECEF coordinates
PVCoordinates eciPV = ecefToEci.transformPVCoordinates(pvCoordinatesECEF);
printLLA(eciPV, eci, date); // debugging
// Calculate and return the CartesianOrbit orbit
return new CartesianOrbit(eciPV, eci, date, earth.getGM());
}