I have an ephemeris file (which contains position and speed) and I try to read the data and create an Ephemeris object.
Here are my code lines:
orekit_states = []
for position_speed in orbit[1][“positionSpeedJ2000”]:
pv_j2000 = PVCoordinates(Vector3D(position_speed[“position”][“x”], position_speed[“position”][“y”],
position_speed[“position”][“z”]),
Vector3D(position_speed[“speed”][“x”], position_speed[“speed”][“y”],
position_speed[“speed”][“z”]))
co = CartesianOrbit(pv_j2000, FramesFactory.getEME2000(), date, Constants.WGS84_EARTH_MU)
orekit_states.append(SpacecraftState(co))
When I try to instantiate my Ephemeris object (eph = Ephemeris(orekit_states, 8)), I get the following error message:
thanks for your answer.
Indeed, I’ve been trying to cast the list to a Java ArrayList for a while but, since I’m new as a Python user, I didn’t manage to make my Python interpreter recognize “ArrayList”. I’ve tried “from java.util import ArrayList” but the java reference is unresolved.
I had the same problem when trying from java.util import ArrayList and section Java Virtual Machine problems → Windows from Petrus faq page solved the issue.
Does it help ?
I still can not import the Java ArrayList but it seems to be linked to my IDE (PyCharm).
Probably the Java runtime to be reconfigured but I didn’t manage to do it.
Nevertheless, when I run the code in a mamba prompt, it works using the “ArrayList”:
orekit_states = ArrayList()
for position_speed in orbit[1][“positionSpeedJ2000”]:
pv_j2000 = PVCoordinates(Vector3D(position_speed[“position”][“x”], position_speed[“position”][“y”], position_speed[“position”][“z”]), Vector3D(position_speed[“speed”][“x”], position_speed[“speed”][“y”], position_speed[“speed”][“z”]))
co = CartesianOrbit(pv_j2000, FramesFactory.getEME2000(), date, Constants.WGS84_EARTH_MU)
orekit_states.add(SpacecraftState(co))
date = date.shiftedBy(float(step))