Class World

Inheritance Relationships

Base Type

Class Documentation

class World : public lupnt::Object<World>

Shared, read-only physical environment for a Simulation.

The World owns the pieces of a scenario that are common to every agent and expensive to re-specify per agent: the simulation epoch, the reference frame, and the environment models. Two flavors of environment are supported (either or both may be present in the world: block):

  • Orbital: a force_model: block (central bodies, gravity degree/order, third bodies, SRP/relativity, integrator) → MakeDynamics() builds a matching NBodyDynamics, so truth and estimator share one force model.

  • Surface: a central-body point-mass Gravity() plus, optionally, a dem: terrain block → a loaded LunarDem and its local East-North-Up tangent frame, for surface-navigation scenarios (rover/lander).

The World deliberately does not propagate agents or own their states: each AgentWithDynamics self-propagates via its own dynamics pointer. The World only provides the environment and a read-only truth facade (GetStateAt) so applications can ask “where is agent X at time t” without reaching through Simulation::GetAgent and down-casting.

Public Functions

World() = default
explicit World(Config &world_config)

Build a World from a world: config block.

Recognized keys: frame (reference frame, default MOON_CI); an optional force_model: sub-block (same schema as an NBodyDynamics dynamics: block: bodies, integrator, dt, abstol, reltol, max_iter, autodiff, and default CR/area/mass); an optional gravity: block (body: MOON|EARTH|... selecting the point-mass GM for Gravity(), default MOON); and an optional dem: block (site_lat_deg, site_lon_deg, half_width_m, max_res_m) loading a LOLA DEM and its ENU tangent frame. The epoch is taken from the global LuPNT epoch (GetLupntEpoch()), which Simulation sets from the scenario epoch:.

inline void SetSimulation(Simulation *sim)

Register the owning Simulation (called by Simulation::SetWorld), enabling the GetStateAt truth facade to resolve agents by name.

inline Real GetEpoch() const

TDB epoch [s past J2000] of simulation time t = 0.

inline Frame GetFrame() const

Reference frame shared by the environment.

inline const Config &GetForceModel() const

The raw force-model config block, for inspection/serialization.

inline bool HasForceModel() const

Whether a force_model: block was provided (so MakeDynamics works).

Ptr<NBodyDynamics> MakeDynamics() const

Construct a dynamics model for the shared force model, using the force model’s default SRP spacecraft parameters (if any).

Ptr<NBodyDynamics> MakeDynamics(double cr, double area_m2, double mass_kg) const

Construct a dynamics model for the shared force model, overriding the SRP spacecraft parameters (radiation-pressure coefficient, area [m^2], mass [kg]) for a specific spacecraft.

Ptr<NBodyDynamics> MakeTruthDynamics() const

Construct a truth dynamics model for the shared force model with the state-transition matrix disabled (autodiff = false) — truth propagation needs no STM. This is what a physical agent uses when it inherits the common world: force model instead of declaring its own dynamics: block. (The STM-carrying MakeDynamics() is for estimators.)

inline const Config &GetPlasma() const

The raw plasma: config block (ionosphere/plasmasphere signal-delay environment), if provided. This is a shared truth-environment property, so it lives under world: rather than in an individual receiver’s application block; the GNSS ODTS app reads it from here. Requires HasPlasma().

inline bool HasPlasma() const

Whether a plasma: block was provided under world:.

inline double GetGM() const

Central-body gravitational parameter GM [m^3/s^2].

Vec3d Gravity(const Vec3d &r) const

Point-mass central-body gravitational acceleration at position r (in the world frame) [m/s^2] — used by surface INS mechanization.

inline bool HasTerrain() const

Whether a dem: terrain block was provided.

inline const LunarDem &GetDem() const

The loaded terrain DEM (for plotting/geometry). Requires HasTerrain().

double GetElevation(double east_m, double north_m) const

Terrain elevation at a local ENU offset (east_m, north_m) from the DEM/site center [m]. Requires HasTerrain().

Vec3d EnuToWorld(double east_m, double north_m, double up_m) const

Convert a local East-North-Up offset (from the site center) to a position in the world frame [m]. Requires HasTerrain().

inline const Mat3d &REnuToWorld() const

Rotation from the local ENU tangent frame to the world frame.

inline const Vec3d &SiteCenterWorld() const

Site center position in the world frame [m] (ENU origin).

inline double SiteLatDeg() const

Site latitude / east longitude [deg].

inline double SiteLonDeg() const
Cart6 GetStateAt(const std::string &agent_name, Real t) const

Read-only truth facade: the Cartesian state [r; v] of agent agent_name at simulation time t [s], in the agent’s frame. Resolves the agent through the owning Simulation and calls its GetStateAt (which self-propagates without mutating the agent). Aborts if no Simulation is registered or the agent is unknown.