I am writing a piece of software which propagates the orbit of a spacecraft from an initial Earth orbit to an interplanetary orbit. My simple two-body propagation works fine in either a geocentric or heliocentric orbit. However, I cannot seem to handle the transition correctly.

Here are the steps of that transition (I can share relevant code if useful):

  1. Get ecliptic J200 position of Earth (via https://github.com/soniakeys/meeus/blob/master/planetposition/planetposition.go#L195 ) and compute the velocity of Earth (via equations in the first pages of Vallado - Fundamentals in Astrodynamics). Note that the "meeus/planetposition" library returns the ecliptic positions in L, B, R, which I convert to cartesian coordinates (via https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Rectangular_coordinates )

  2. Rotate the radius and velocity vectors of my geocentric orbit about the first axis and by the axial tilt of Earth (as per https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Converting_Cartesian_vectors )

  3. Add the spacecraft R and V vectors computed in step 2 to the radius and velocity vectors of the planet computed in step 1 (since $r_{\text{sc}_{\text{helio}}} = r_{\text{sc}_{\text{earth}}} + r_{\text{earth}_{\text{helio}}}$)

When visualizing both trajectories in Cosmographia, I can definitely tell that the computation is wrong (cf. the two screenshots below). I have been stuck on this issue for a few hours now (about twelve I'd say), so any help would be greatly appreciated.

Earth seen from the expected position (geocentric vectors) Earth seen from the incorrectly computed heliocentric position

  • 1
    $\begingroup$ This is a good place to ask, but you can also look in Astronomy SE and Math SE for potentially helpful pre-existing answers as well. $\endgroup$
    – uhoh
    Oct 31, 2016 at 5:53
  • 1
    $\begingroup$ I highly recommend the use of JPL's SPICE Toolkit for coordinate frame conversions, as well as many other things, such as accessing natural body and spacecraft ephemerides. $\endgroup$
    – Mark Adler
    Oct 31, 2016 at 13:58
  • $\begingroup$ I know of SPICE, however, it isn't feasible for me to use it currently (I was initially hoping to use it). My software is written entirely in Go without any bindings to other languages. $\endgroup$
    – ChrisR
    Oct 31, 2016 at 14:17

1 Answer 1


You could obviously do a rough Z-axis rotation matrix (relative to earth) and estimate earth's rotation as constant with time, but that is not fully accurate. You can re-create CesiumJS's computeFixedToICRF method. It is very reverse-engineering-y and is not a full solution but trying to do these transformations are not trivial to say the least.

Link to ComputeFixedToICRF method documentation in cesium: https://cesiumjs.org/Cesium/Build/Documentation/Transforms.html?classFilter=transf#.computeFixedToIcrfMatrix

There's a package called satellite.js which also does a ECF to ECI transformation here: https://github.com/shashwatak/satellite-js/blob/develop/src/transforms.js


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.