Function lupnt::GetBodyPosVel(Real, BodyId, BodyId, Frame)

Function Documentation

Vec6 lupnt::GetBodyPosVel(Real t_tdb, BodyId center, BodyId target, Frame frame)

Get the position and velocity of target relative to center from the DE ephemeris, expressed in frame.

Used throughout the simulator wherever a third-body state is needed: third-body gravitational perturbations in NumericalOrbitDynamics::CalcContrib (dynamics/numerical_orbit_dynamics.cc), Sun/body direction vectors for attitude pointing (dynamics/attitude_dynamics.cc), light-time/Shapiro-delay corrections in conversions/time_conversions.cc and the measurement models, and joint orbit/clock dynamics (dynamics/joint_orbit_clock_dynamics.cc). Lazily loads the DE440 ephemeris on first call. Internally evaluates the relevant DE Chebyshev blocks (combining Earth, Earth-Moon barycenter, and Moon data as needed for Earth/Moon/EMB queries) and, unless frame is GCRF, rotates both states into frame via ConvertFrame before differencing.

Parameters:
  • t_tdb – Epoch [s, TDB since J2000]

  • centerBody at the origin of the returned relative state.

  • targetBody whose state is returned.

  • frame – Reference frame in which the position/velocity are expressed (and in which the subtraction target - center is performed).

Returns:

6-vector [rx, ry, rz, vx, vy, vz]: position [m] and velocity [m/s] of target relative to center, expressed in frame. Zero if center == target.