Skip to main content

Coordinate Systems & Transformations

This section describes the coordinate reference frames used by the Spaceflight Dynamics Framework and the mathematical transformations implemented in the CoordinateTransformer class.

The framework uses a single simulation truth frame for physical propagation and derives all other coordinate representations from this state. This prevents conflicting state representations while still providing specialized frames for guidance, navigation, telemetry, visualization, and future orbital operations.


State Ownership and Frame Hierarchy

The translational state of the spacecraft is propagated in the Moon-Centered Inertial frame. The corresponding state vector is the single source of truth for spacecraft motion.

x=[rMCI,vMCI,qIB,ωSBF] \mathbf{x} = \left[ \mathbf{r}_{MCI}, \mathbf{v}_{MCI}, q_{IB}, \boldsymbol{\omega}_{SBF} \right]

Where:
• rMCI\mathbf{r}_{MCI} is the spacecraft position in MCI [m]
• vMCI\mathbf{v}_{MCI} is the spacecraft velocity in MCI [m/s]
• qIBq_{IB} is the body-to-inertial attitude quaternion
• ωSBF\boldsymbol{\omega}_{SBF} is the angular velocity expressed in the spacecraft body frame [rad/s]

All other frames are derived views:

MCI
├── MCMF
│   ├── MSC
│   └── ENU
│
├── LVLH
│
└── SBF

Reference Frame Definitions

MCI — Moon-Centered Inertial

The Moon-Centered Inertial frame is the primary physics frame of SDF. All translational dynamics are integrated in this frame.

Origin: Center of the Moon
Axes:
• +Z = Lunar North Pole
• +X = Prime Meridian at reference epoch t0t_0
• +Y = +Z×+X+Z \times +X

MCI is moon-centered, inertial, non-rotating, and right-handed.

MCMF — Moon-Centered Moon-Fixed

The Moon-Centered Moon-Fixed frame is attached to the lunar body and rotates with the Moon. It is used for surface-fixed locations, landing sites, and lunar geography.

Origin: Center of the Moon
Axes:
• +Z = Lunar North Pole
• +X = Current Prime Meridian
• +Y = +Z×+X+Z \times +X

MCMF is moon-centered, rotating, surface-fixed, non-inertial, and right-handed.

MSC — Moon Surface Coordinates

Moon Surface Coordinates provide a geodetic representation of a lunar surface or near-surface location.

MSC is not a Cartesian frame. It is represented by latitude, longitude, and altitude:

MSC=(ϕ,λ,h) MSC = \left( \phi, \lambda, h \right)

Where:
• ϕ\phi is lunar latitude [rad]
• λ\lambda is lunar longitude [rad]
• hh is altitude above the mean lunar radius [m]

ENU — East-North-Up

ENU is a local tangent frame attached to a mission reference point, typically the landing site. It is used for landing guidance, local navigation, and surface-relative telemetry.

Origin: Landing site
Axes:
• +X = East
• +Y = North
• +Z = Up

ENU is right-handed and locally defined. Its orientation depends on the chosen surface reference point.

LVLH — Local Vertical Local Horizontal

The LVLH frame is a spacecraft-centered orbital frame. It is useful for relative motion, rendezvous, docking, and orbital guidance.

Origin: Current spacecraft position
Axes:
• +X = Forward
• +Y = Right
• +Z = Down, toward the lunar center

The current implementation expresses LVLH velocities as projected relative velocities. Full rotating-frame velocity and acceleration terms are reserved for future high-fidelity dynamics.

SBF — Spacecraft Body Frame

The Spacecraft Body Frame is rigidly attached to the spacecraft and rotates with its attitude. It is the primary frame for propulsion, RCS, sensors, and control-related quantities.

Origin: Spacecraft center of mass
Axes:
• +X = Forward
• +Y = Right
• +Z = Down

Engine directions and RCS force directions are expressed in SBF. The current propulsion pipeline computes thrust in SBF and rotates it into MCI before passing it to the physics model.


MCI to MCMF Transformation

The MCMF frame rotates with the Moon relative to the inertial MCI frame. In SDF, positive lunar rotation is defined about the positive MCI Z-axis. The lunar rotation angle is computed as:

θ(t)=ωMt \theta(t) = \omega_M t

Where:
• ωM\omega_M is the lunar sidereal rotation rate [rad/s]
• tt is simulation time [s]

The corresponding quaternion represents the active positive rotation Rz(+θ)R_z(+\theta) from MCMF into MCI:

qM(t)=[cos⁡(θ2),0,0,sin⁡(θ2)] q_M(t) = \left[ \cos\left(\frac{\theta}{2}\right), 0, 0, \sin\left(\frac{\theta}{2}\right) \right]

Because MCI to MCMF is a coordinate transformation into the rotating frame, it uses the inverse rotationRz(−θ)R_z(-\theta):

rMCMF=qM−1 rMCI qM \mathbf{r}_{MCMF} = q_M^{-1} \, \mathbf{r}_{MCI} \, q_M

Since the target frame is rotating, the velocity transformation includes the transport term caused by the lunar angular velocity:

vMCMF=qM−1(vMCI−ωM×rMCI)qM \mathbf{v}_{MCMF} = q_M^{-1} \left( \mathbf{v}_{MCI} - \boldsymbol{\omega}_M \times \mathbf{r}_{MCI} \right) q_M

with:

ωM=[0,0,ωM]T \boldsymbol{\omega}_M = \left[ 0, 0, \omega_M \right]^T

MCMF to MCI Transformation

The inverse transformation maps a Moon-fixed state back into the inertial frame. Since qMq_M represents the active positive lunar rotation, MCMF to MCI usesRz(+θ)R_z(+\theta) directly:

rMCI=qM rMCMF qM−1 \mathbf{r}_{MCI} = q_M \, \mathbf{r}_{MCMF} \, q_M^{-1}

The inertial velocity is reconstructed by adding the rotating-frame velocity contribution:

vMCI=qM(vMCMF+ωM×rMCMF)qM−1 \mathbf{v}_{MCI} = q_M \left( \mathbf{v}_{MCMF} + \boldsymbol{\omega}_M \times \mathbf{r}_{MCMF} \right) q_M^{-1}

This sign convention is physically constrained by the motion of a Moon-fixed point. ForrMCMF=[R,0,0]T\mathbf{r}_{MCMF}=[R,0,0]^T andvMCMF=0\mathbf{v}_{MCMF}=0, positive lunar rotation givesvMCI=ωM×rMCI\mathbf{v}_{MCI}=\boldsymbol{\omega}_M\times\mathbf{r}_{MCI}. Therefore the point initially moves toward positive MCI Y, and atθ=π/2\theta=\pi/2 its inertial position is[0,R,0]T[0,R,0]^T.


MCMF to Moon Surface Coordinates

A Cartesian position in the Moon-fixed frame can be converted into geodetic Moon Surface Coordinates.

Given:

rMCMF=[x,y,z]T \mathbf{r}_{MCMF} = \left[ x, y, z \right]^T

The radial distance is:

r=∣∣rMCMF∣∣ r = ||\mathbf{r}_{MCMF}||

Latitude, longitude, and altitude are computed as:

ϕ=arcsin⁡(zr) \phi = \arcsin \left( \frac{z}{r} \right)
λ=atan2⁡(y,x) \lambda = \operatorname{atan2}(y,x)
h=r−RM h = r - R_M

Where RMR_M is the mean lunar reference radius.


Moon Surface Coordinates to MCMF

The inverse mapping reconstructs the Moon-fixed Cartesian position from latitude, longitude, and altitude.

r=RM+h r = R_M + h
x=rcos⁡ϕcos⁡λ x = r \cos\phi \cos\lambda
y=rcos⁡ϕsin⁡λ y = r \cos\phi \sin\lambda
z=rsin⁡ϕ z = r \sin\phi

The resulting velocity is initialized as zero in MCMF, because a fixed surface location is stationary in the Moon-fixed frame.


ENU Frame Construction

The ENU frame is constructed from a reference state expressed in MCMF. In the current simulation, this reference state is typically the mission landing site.

The local up direction is the normalized radial direction:

u^=rorigin∣∣rorigin∣∣ \hat{\mathbf{u}} = \frac{ \mathbf{r}_{origin} }{ ||\mathbf{r}_{origin}|| }

A global reference axis is selected to construct the local tangent plane. Under nominal conditions, the lunar rotation axis is used:

k^=[0,0,1]T \hat{\mathbf{k}} = \left[ 0, 0, 1 \right]^T

The east and north directions are computed as:

e^=k^×u^∣∣k^×u^∣∣ \hat{\mathbf{e}} = \frac{ \hat{\mathbf{k}} \times \hat{\mathbf{u}} }{ || \hat{\mathbf{k}} \times \hat{\mathbf{u}} || }
n^=u^×e^ \hat{\mathbf{n}} = \hat{\mathbf{u}} \times \hat{\mathbf{e}}

Near the lunar poles, the implementation switches to a fallback reference axis to avoid singularities caused by nearly parallel vectors.


MCMF to ENU Transformation

To express a Moon-fixed spacecraft state in the local ENU frame, the relative vector from the ENU origin to the spacecraft is projected onto the ENU basis vectors.

Δr=rtarget−rorigin \Delta\mathbf{r} = \mathbf{r}_{target} - \mathbf{r}_{origin}
rENU=[Δr⋅e^,Δr⋅n^,Δr⋅u^]T \mathbf{r}_{ENU} = \left[ \Delta\mathbf{r}\cdot\hat{\mathbf{e}}, \Delta\mathbf{r}\cdot\hat{\mathbf{n}}, \Delta\mathbf{r}\cdot\hat{\mathbf{u}} \right]^T

The same projection is applied to relative velocity:

Δv=vtarget−vorigin \Delta\mathbf{v} = \mathbf{v}_{target} - \mathbf{v}_{origin}
vENU=[Δv⋅e^,Δv⋅n^,Δv⋅u^]T \mathbf{v}_{ENU} = \left[ \Delta\mathbf{v}\cdot\hat{\mathbf{e}}, \Delta\mathbf{v}\cdot\hat{\mathbf{n}}, \Delta\mathbf{v}\cdot\hat{\mathbf{u}} \right]^T

ENU to MCMF Transformation

The inverse transformation reconstructs a Moon-fixed Cartesian state from local ENU coordinates and the stored ENU frame basis.

rMCMF=rorigin+xENUe^+yENUn^+zENUu^ \mathbf{r}_{MCMF} = \mathbf{r}_{origin} + x_{ENU}\hat{\mathbf{e}} + y_{ENU}\hat{\mathbf{n}} + z_{ENU}\hat{\mathbf{u}}
vMCMF=vorigin+vxe^+vyn^+vzu^ \mathbf{v}_{MCMF} = \mathbf{v}_{origin} + v_x\hat{\mathbf{e}} + v_y\hat{\mathbf{n}} + v_z\hat{\mathbf{u}}

LVLH Frame Construction

The LVLH frame is constructed from the current inertial spacecraft state. It is centered on the spacecraft and aligned with the local orbital geometry.

The down direction points toward the Moon center:

d^=−r∣∣r∣∣ \hat{\mathbf{d}} = - \frac{ \mathbf{r} }{ ||\mathbf{r}|| }

The orbital angular momentum vector is:

h=r×v \mathbf{h} = \mathbf{r} \times \mathbf{v}

The right direction is defined as:

y^LVLH=−h∣∣h∣∣ \hat{\mathbf{y}}_{LVLH} = - \frac{ \mathbf{h} }{ ||\mathbf{h}|| }

The forward direction completes the right-handed basis:

x^LVLH=y^LVLH×z^LVLH \hat{\mathbf{x}}_{LVLH} = \hat{\mathbf{y}}_{LVLH} \times \hat{\mathbf{z}}_{LVLH}

with z^LVLH=d^\hat{\mathbf{z}}_{LVLH} = \hat{\mathbf{d}}.

If the angular momentum magnitude approaches zero, a fallback axis is used to avoid a degenerate frame definition.


MCI to LVLH Transformation

A target state is expressed in LVLH by projecting the relative inertial state onto the LVLH basis vectors.

Δr=rtarget−rorigin \Delta\mathbf{r} = \mathbf{r}_{target} - \mathbf{r}_{origin}
rLVLH=[Δr⋅x^LVLH,Δr⋅y^LVLH,Δr⋅z^LVLH]T \mathbf{r}_{LVLH} = \left[ \Delta\mathbf{r}\cdot\hat{\mathbf{x}}_{LVLH}, \Delta\mathbf{r}\cdot\hat{\mathbf{y}}_{LVLH}, \Delta\mathbf{r}\cdot\hat{\mathbf{z}}_{LVLH} \right]^T

The same projection is currently applied to relative velocity. This represents projected relative velocity, not the complete time derivative in a rotating LVLH frame.


LVLH to MCI Transformation

The inverse transformation reconstructs an inertial state from LVLH coordinates using the stored LVLH basis vectors.

rMCI=rorigin+xLVLHx^LVLH+yLVLHy^LVLH+zLVLHz^LVLH \mathbf{r}_{MCI} = \mathbf{r}_{origin} + x_{LVLH}\hat{\mathbf{x}}_{LVLH} + y_{LVLH}\hat{\mathbf{y}}_{LVLH} + z_{LVLH}\hat{\mathbf{z}}_{LVLH}
vMCI=vorigin+vxx^LVLH+vyy^LVLH+vzz^LVLH \mathbf{v}_{MCI} = \mathbf{v}_{origin} + v_x\hat{\mathbf{x}}_{LVLH} + v_y\hat{\mathbf{y}}_{LVLH} + v_z\hat{\mathbf{z}}_{LVLH}

MCI to SBF Transformation

The spacecraft body frame is defined by the spacecraft attitude quaternion and the current spacecraft origin state.

The body-to-inertial quaternion is denoted:

qIB q_{IB}

To transform an inertial state into the spacecraft body frame, the inverse attitude quaternion is applied to the relative state:

rSBF=qIB−1(rMCI−rorigin)qIB \mathbf{r}_{SBF} = q_{IB}^{-1} \left( \mathbf{r}_{MCI} - \mathbf{r}_{origin} \right) q_{IB}
vSBF=qIB−1(vMCI−vorigin)qIB \mathbf{v}_{SBF} = q_{IB}^{-1} \left( \mathbf{v}_{MCI} - \mathbf{v}_{origin} \right) q_{IB}

SBF to MCI Transformation

The inverse transformation maps body-frame coordinates back into the inertial MCI frame.

rMCI=rorigin+qIBrSBFqIB−1 \mathbf{r}_{MCI} = \mathbf{r}_{origin} + q_{IB} \mathbf{r}_{SBF} q_{IB}^{-1}
vMCI=vorigin+qIBvSBFqIB−1 \mathbf{v}_{MCI} = \mathbf{v}_{origin} + q_{IB} \mathbf{v}_{SBF} q_{IB}^{-1}

Generic Vector Transformations

Some quantities represent free vectors rather than position states. Examples include thrust vectors, acceleration vectors, sensor axes, and force directions.

Such quantities are rotated between frames without applying a translational origin offset.

aSBF=qIB−1aMCIqIB \mathbf{a}_{SBF} = q_{IB}^{-1} \mathbf{a}_{MCI} q_{IB}
aMCI=qIBaSBFqIB−1 \mathbf{a}_{MCI} = q_{IB} \mathbf{a}_{SBF} q_{IB}^{-1}

This mechanism is used in the current thrust pipeline. Thrust is computed in SBF and rotated into MCI before it is passed to the physics model.


Variables and Parameters

SymbolDescriptionUnitFrame
ttSimulation time measured from the reference epochs–
RMR_MMean lunar reference radiusm–
ωM\omega_MLunar sidereal rotation raterad/sMCI +Z axis
ωM\boldsymbol{\omega}_MLunar angular velocity vectorrad/sMCI / MCMF aligned +Z axis
θ(t)\theta(t)Lunar rotation angle defined by θ=ωMt\theta=\omega_M tradRotation about +Z
qM(t)q_M(t)Quaternion representing the active rotation Rz(+θ)R_z(+\theta)–MCMF → MCI
qM−1(t)q_M^{-1}(t)Inverse lunar-rotation quaternion representing Rz(−θ)R_z(-\theta)–MCI → MCMF
rMCI\mathbf{r}_{MCI}Position vector expressed in the Moon-Centered Inertial framemMCI
vMCI\mathbf{v}_{MCI}Velocity vector expressed in the Moon-Centered Inertial framem/sMCI
rMCMF\mathbf{r}_{MCMF}Position vector expressed in the Moon-Centered Moon-Fixed framemMCMF
vMCMF\mathbf{v}_{MCMF}Velocity vector expressed in the Moon-fixed rotating framem/sMCMF
ϕ\phiLunar latituderadMSC
λ\lambdaLunar longituderadMSC
hhAltitude above the mean lunar reference radiusmMSC
rrRadial distance from the lunar centermMCMF
e^E\hat{\mathbf{e}}_ELocal East unit vector–MCMF basis of ENU
e^N\hat{\mathbf{e}}_NLocal North unit vector–MCMF basis of ENU
e^U\hat{\mathbf{e}}_ULocal Up unit vector–MCMF basis of ENU
rENU\mathbf{r}_{ENU}Position vector expressed in the local East-North-Up framemENU
vENU\mathbf{v}_{ENU}Velocity vector expressed in the local East-North-Up framem/sENU
r0\mathbf{r}_0Origin position of a local reference framemMCMF or MCI, depending on frame
v0\mathbf{v}_0Origin velocity of a local reference framem/sMCMF or MCI, depending on frame
h=r×v\mathbf{h}=\mathbf{r}\times\mathbf{v}Specific orbital angular-momentum direction used to construct LVLHm²/sMCI
e^F\hat{\mathbf{e}}_FLVLH Forward unit vector–MCI basis of LVLH
e^R\hat{\mathbf{e}}_RLVLH Right unit vector–MCI basis of LVLH
e^D\hat{\mathbf{e}}_DLVLH Down unit vector pointing toward the lunar center–MCI basis of LVLH
rLVLH\mathbf{r}_{LVLH}Relative position vector expressed in LVLH coordinatesmLVLH
vLVLH\mathbf{v}_{LVLH}Projected relative velocity expressed in LVLH coordinatesm/sLVLH
qIBq_{IB}Quaternion rotating vectors from the Spacecraft Body Frame into MCI–SBF → MCI
qIB−1q_{IB}^{-1}Inverse attitude quaternion rotating vectors from MCI into SBF–MCI → SBF
rSBF\mathbf{r}_{SBF}Position vector expressed relative to the spacecraft body-frame originmSBF
vSBF\mathbf{v}_{SBF}Velocity vector expressed relative to the spacecraft body-frame originm/sSBF
aMCI\mathbf{a}_{MCI}Generic vector quantity or acceleration expressed in MCIcontext-dependentMCI
aSBF\mathbf{a}_{SBF}Generic vector quantity or acceleration expressed in SBFcontext-dependentSBF
ωM×r\boldsymbol{\omega}_M \times \mathbf{r}Transport velocity contribution caused by lunar rotationm/sSource Cartesian frame

Implementation Characteristics

  • MCI remains the single translational truth frame.
  • MCMF is obtained by lunar rotation from MCI.
  • MSC is derived from Moon-fixed Cartesian coordinates.
  • ENU is generated from a local MCMF reference point.
  • LVLH is computed from instantaneous MCI position and velocity.
  • SBF is defined by spacecraft attitude and MCI origin state.
  • Generic vector transformations apply rotation only.