Class Spacecraft

Inheritance Relationships

Base Type

Class Documentation

class Spacecraft : public lupnt::Agent

A physical spacecraft whose truth is a joint orbit + clock 8-state [r(3), v(3), clock_bias, clock_drift]. It self-propagates that truth so other agents / sensors can query both its geometry and its clock (needed for two-way time/frequency transfer and pseudorange).

Truth dynamics come entirely from the agent config, keeping the “onboard

software never knows the truth” separation:

  • orbit: the agent’s dynamics: block (an NBodyDynamics-style force model). When omitted, Simulation::Setup injects the shared world.force_model here, so common orbit physics is declared once under world:. Built with the state-transition matrix disabled (truth needs no STM).

  • clock: an optional clock: block (model, seed, add_noise).

The initial truth state is read from initial_state:, which accepts either an explicit {r0_m, v0_mps} (MOON_CI) or a {class: ClassicalOE, ...} block, plus optional clock_bias_s / clock_drift_sps.

This is a general orbit+clock spacecraft agent, used by both the ISL scenarios and the Lunar-GNSS receiver. Truth is propagated in simulation-relative time; JointOrbitClockDynamics adds GetLupntEpoch().

Public Functions

Spacecraft() = default
explicit Spacecraft(Config &config)
inline virtual void Setup() override

Perform one-time setup before the simulation starts: schedules a periodic Step callback with the simulation event scheduler (if frequency_ > 0) and calls Setup on each attached device.

Called once by Simulation::Setup for every registered agent, before the main time-stepping loop begins. AgentWithDynamics and GnssConstellation override/extend this for their own initialization needs.

virtual void Step(Real t) override

Propagate the truth 8-state to t [s, sim-relative] (mutating) and log.

State GetTruthStateAt(Real t) const

The truth joint 8-state [r,v,clock_bias,clock_drift] at time t (sim-relative [s]), without mutating the stored truth.

inline const State &GetTruthState() const
inline Real GetTruthTime() const
inline JointOrbitClockDynamics *GetTruthDynamics() const
virtual Cart6 GetStateAt(Real t) const override

Geometry facade: Cartesian [r; v] truth at t, in Frame::MOON_CI.

Protected Functions

void ConfigureTruth(Config &config)

Build truth_dyn_ (orbit from dynamics:, clock from clock:) and the initial truth_ state from initial_state:. Shared by subclasses.

Protected Attributes

State truth_
Real truth_time_ = 0.0
Ptr<JointOrbitClockDynamics> truth_dyn_