Skip to main content

Moonlander Architecture

System Overview

The diagram below illustrates the main components of the Moonlander Simulation, including the frontend, backend, logger, and configuration flow.

Moonlander Architecture Diagram

Component Descriptions

  • Frontend (UI / Cockpit): User interface for telemetry display, spacecraft selection, cockpit visualization, and interactive control.
  • Backend (Simulation Engine): Executes physics computations, state updates, thrust calculations, g-loads, and optimization routines.
  • CockpitPage: Qt widget in the main thread handling UI logic, telemetry display, and user interactions.
  • SimulationWorker: Dedicated worker thread that safely executes simulation steps and interfaces between frontend and backend.
  • SimControl: Orchestrates simulation steps, validates parameters, and forwards commands between frontend and spacecraft.
  • Spacecraft: Owns the complete physical state (position, velocity, mass, orientation, thrust) and computes dynamics from applied forces.
  • Physics & Integrators: Interfaces and implementations (IPhysicsModel, BasicMoonGravity, Physics, IIntegrator, EulerIntegrator) for modular dynamics propagation.
  • Sensors & Perception: Sensor interfaces and models (ISensor, SensorModel) computing g-load, telemetry, and optional sensor noise.
  • Thrust & Optimization: Modules for thrust computation and fuel-efficient landing (Thrust, OptimizationModelParams, ThrustOptimizationProblem, ThrustOptimizer).
  • Config / JSON: Simulation and UI parameters loaded from JSON in the frontend, passed to the worker, and forwarded to the backend.
  • Backend structs: Standardized data structures for spacecraft state, integrator state, simulation data, and environment configuration.
  • Logger: Captures debug output from backend independently of the UI.

Physics Architecture

The diagram illustrates the core modular architecture of the Moonlander simulation backend, centered around the Physics orchestrator. This orchestrator serves as the central hub for all physics-related computations, coordinating the interactions between integrators, physics models, controllers, autopilot logic, and sensors.

Moonlander Architecture Diagram

Key Components and Relationships

  • Physics Orchestrator: The main entry point for all physics calculations. Delegates computations to the active physics model, integrator, and control modules without performing calculations itself.
  • Physics Models (iPhysicsModel): Abstract interface for all physics computations. The concrete implementation, BasicMoonGravity, provides lunar gravitational forces applied to the spacecraft.
  • Integrators (iIntegrator): Responsible for numerically integrating the spacecraft state over time. EulerIntegrator is a concrete example that advances the lander’s position, velocity, and other dynamic states each simulation step.
  • Controllers (iController): Handle velocity and guidance control.PD Controller is used to track target velocities and provide acceleration commands to the thrust system.
  • Autopilot / Automation (iAutopilot): Generates thrust commands for automated landings. The Adaptive Descent Controller implements an energy-based landing strategy with brake-ratio-guided mode switching.
  • Sensors (iSensor): Abstract interface for all sensor feedback.SensorModel computes telemetry such as proper g-load, which informs the controller and autopilot decisions.

Flow Summary

  • The Physics orchestrator coordinates all inputs and outputs.
  • Physics models define the forces acting on the spacecraft.
  • Integrators update the spacecraft state over time.
  • Controllers and the Adaptive Descent Controller calculate acceleration and thrust commands.
  • Sensors provide real-time feedback for adaptive control and telemetry.

This modular architecture ensures that each component can be developed, tested, and swapped independently, supporting a robust and flexible simulation framework.