ephemeridesRecenter#

Ephemerides Recenter#

This module provides functionality to transform the ephemerides of a collection of bodies so that they are expressed relative to a new central body, rather than their original reference (e.g., Sun or Earth).

Assumptions and Limitations#

The module should be used in the following circumstances: when creating a simulation with ephemeris tables mostly all generated with respect to a central body like the Sun or Earth, but with the spacecraft table in the simulation centered on one of these bodies. This module allows to recenter all the bodies around the desired central body.

The module works with planets around the Sun, and with a single moon around one of those planets. Furthermore all of the bodies must be relative to the original zero base, except one moon per body if applicable (in which case the moon is relative to its parent body).

Module Overview#

The module is implemented in C++ and consists of:

  • BodyEphemeris: A container representing a body and its ephemeris messages.

  • EphemeridesRecenter: The module class

When building a body with the BodyEphemeris class, use:

  • bodySpiceName: the name of the new body

  • originalCentralBodyName: its original zero-base (of the input message data)

  • add it to the CelestialEphemerisRecenter module with addBodyEphemerisToRecenter

When setting up the module:

  • setNewZeroBase: sets the zero base that the spacecraft is using and for all the other bodies to switch to

  • setPreviousCommonZeroBase: identify the previous zero base

Usage Example#

Below is an example of using the Python interface (mocked for testing) to interact with the C++ module:

from celestialEphemerisRecenter import CelestialEphemerisRecenter, BodyEphemeris

# Create module and celestial body
module = CelestialEphemerisRecenter()
body = BodyEphemeris()
body.bodySpiceName = "Mars"
body.originalCentralBodyName = "Sun"

# Attach message functors (e.g., input/output links in Basilisk)
body.inputEphemerisMsg = YourInputMsgFunctor()
body.outputEphemerisMsg = YourOutputMsg()

# Register body and configure module
module.addBodyEphemerisToRecenter(body)
module.setNewZeroBase("Mars")
module.setPreviousCommonZeroBase("Sun")

# Run module (e.g., in Basilisk dynamics loop)
module.updateState(callTime)

Notes#

- The maximum number of bodies is limited to 20.

Class EphemeridesRecenter#

class EphemeridesRecenter : public SysModel#

Ephemerides Recenter Basilisk Model.

Public Functions

void updateState(uint64_t callTime) override#

This method recomputes the body positions and velocities relative to the base body ephemeris and writes out updated ephemeris position and velocity for each body.

Parameters:

callTime – : The clock time at which the function was called (nanoseconds)

Returns:

void

void reset(uint64_t callTime) override#

This method resets the module.

Parameters:

callTime – : The clock time at which the function was called (nanoseconds)

Returns:

void

void addBodyEphemerisToRecenter(const BodyEphemeris &ephemerisBody)#

Add a body to be re-centered.

Parameters:

ephemerisBody – BodyEphemeris : A new celestial body instance

Returns:

void

void setNewZeroBase(const std::string &bodyName)#

Set a new celestial body center by name.

Parameters:

bodyName – std::string : the new zero base

Returns:

void

std::string getNewZeroBase() const#

Get the new celestial body center by name.

Returns:

std::string : the new zero base

void setPreviousCommonZeroBase(const std::string &bodyName)#

Set the previous common zero base of all the celestial bodies entered.

Parameters:

bodyName – std::string : the new zero base

std::string getPreviousCommonZeroBase() const#

Get the previous common zero base of all the celestial bodies entered.

Returns:

std::string : the new zero base

std::array<std::string, MAX_NUM_CHANGE_BODIES> getAllNames() const#

Get all the names of the bodies entered.

Returns:

std::array<std::string, MAX_NUM_CHANGE_BODIES> : an array of names

size_t getBodyIndexFromName(const std::string &celestialBodyName) const#

Get the index of a body.

Parameters:

celestialBodyName – std::string : celestial body name

Returns:

size_t : whether or not the index was found

size_t getNumberOfBodies() const#

Get the number of bodies that were entered into the module.

Returns:

size_t : the number of bodies

void clearAllBodies()#

Clear all the bodies from the current list.