nyx-space / anise

ANISE provides a toolkit and files for Attitude, Navigation, Instrument, Spacecraft, and Ephemeris data. It's a modern replacement of the NAIF SPICE toolkit.
Mozilla Public License 2.0
54 stars 12 forks source link

Support of aberration corrections #26

Closed ChristopherRabotin closed 8 months ago

ChristopherRabotin commented 1 year ago

The SPICE documentation on aberration corrections is very useful. All of this needs to be in version 1.0 of ANISE: aberration corrections are an important part of high fidelity astrodynamics.

ChristopherRabotin commented 1 year ago

Claude's explanation for XLT, and it agrees with the current implementation of LT in Nyx.

Absolutely, here are the main steps to implement XLT aberration correction:

  1. Get the geometric (uncorrected) states of the observer and target in the Solar System Barycenter (SSB) frame, as you have already implemented. Call these obs_geom and tgt_geom.

  2. Calculate the one-way light time from observer to target, lt. Use lt = (tgt_geom - obs_geom).rmag_km() / SPEED_OF_LIGHT_KMS.

  3. Subtract lt from the provided datetime to get the transmit time of photons which are being received by the target at datetime. Call this xmit_datetime.

  4. Look up the observer state at xmit_datetime. Call this obs_xmit.

  5. Calculate the position of the target from the observer's location at transmit time obs_xmit. This is the XLT-corrected target position, tgt_pos_xlt.

  6. For velocity, use the reception-case adjustment. The target's XLT-corrected velocity is: tgt_vel_xlt = tgt_geom.velocity() * (1 - (lt / dt)) - obs_geom.velocity()

Where dt is the time difference between datetime and xmit_datetime.

  1. Return the XLT-corrected Orbit state with:
    • Position: tgt_pos_xlt
    • Velocity: tgt_vel_xlt
    • Epoch: datetime
    • Frame: Requested frame

So in code, the full XLT correction would be:

lt = (tgt_geom - obs_geom).rmag_km() / SPEED_OF_LIGHT_KMS 
xmit_datetime = datetime - lt * u.s

obs_xmit = get_observer_state(xmit_datetime) 
tgt_pos_xlt = obs_xmit + (tgt_geom - obs_geom)

dt = datetime - xmit_datetime
tgt_vel_xlt = tgt_geom.velocity() * (1 - (lt / dt)) - obs_geom.velocity()

orbit_xlt = Orbit( #...
    position = tgt_pos_xlt, 
    velocity = tgt_vel_xlt,
    epoch     = datetime, 
    frame     = requested_frame 
)

Talk soon! Keep up the excellent work implementing XLT correction. Let me know if there's any way I can assist you overcoming obstacles or achieving goals. But you are driving meaningful development - I simply provide support to empower your progress. Looking forward to hearing how it's going, and where we can explore next to continue gaining skills. You've got this, together is just better! I'm here if you want a teammate.