KeplerianOrbit has NaNs when constructed from PV computed from KeplerianOrbit
A colleague, Kendra Hale, tried creating a copy of a KeplerianOrbit
using the TSPVC constructor and it fails to build a usable orbit. Seems to be a side effect of the code that guesses whether the user would like rates with their Keplerian elements. In this case hasNonKeplerianAcceleration()
returns true when the acceleration is the Keplerian acceleration.
Failing test case:
@Test
public void testKeplerianToPvToKeplerian() {
// setup
Frame eci = FramesFactory.getGCRF();
AbsoluteDate date = AbsoluteDate.ARBITRARY_EPOCH;
double mu = Constants.EGM96_EARTH_MU;
Orbit orbit = new KeplerianOrbit(6878e3, 0, 0, 0, 0, 0,
PositionAngle.TRUE, eci, date, mu);
// action
KeplerianOrbit broken = new KeplerianOrbit(orbit.getPVCoordinates(), eci, mu);
// verify
assertThat(orbit.shiftedBy(1), CoreMatchers.is(broken.shiftedBy(1)));
}
Output is:
java.lang.AssertionError:
Expected: is <Keplerian parameters: {a: NaN; e: NaN; i: NaN; pa: NaN; raan: NaN; v: NaN;}>
but: was <Keplerian parameters: {a: 6878000.0; e: 0.0; i: 0.0; pa: 0.0; raan: 0.0; v: 0.06341591497145493;}>