Remedial: getPVCoordinates returning incorrect velocities

Believe I have a subtle usage errror… but cannot “see” the problem. I am trying to convert a Keplerian orbit to Cartesian in J2000 (EME2000). The Orekit solution is getting the position correct, but the velocity is coming out nonsense.

Expecting: Position and Velocity: 5909, -4974, -11; 2.64, 2.99, 5.97
Got: Position and Velocity: 5909, -4974, -11; 83800, 94703, 188928

Velocity is wayyyyy off. But I can “see” what the subtle thing wrong may be.

Here is the code:

            double  semiMajorAxis = 7738.0;
            double eccentricity = 0.01237;
            double inclination = 0.9811;
            double argPerigee = 4.8342;
            double raan = 5.5844;
            double trueAnomaly = 1.447;
            // orbitEpochTime = "2018-11-05T22:43:01.01";
            AbsoluteDate orbitEpochTime1 = new AbsoluteDate(2018, 11, 05, 22, 43, 01, TimeScalesFactory.getUTC());
            Orbit satelliteOrbit1 = new KeplerianOrbit(semiMajorAxis,
                    eccentricity,
                    inclination,
                    argPerigee,
                    raan,
                    trueAnomaly,
                    PositionAngle.TRUE,
                    FramesFactory.getEME2000(),
                    orbitEpochTime1,
                    3.986004418e14);

            PVCoordinates svPV2 = satelliteOrbit1.getPVCoordinates(orbitEpochTime,FramesFactory.getEME2000());

Answer: My Semi-Major Axis was in Kilometers and Meters!!!

1 Like

I’m always torn about putting units on variable names. It always makes sense to me in the short term but I’m afraid I’ll miss a units change as the code is written and all of a sudden “it says smaKM” but now it’s all meters and no one notices until a space craft hits a planet unintentionally…