PyAstroPDL: Powered Descent and Landing Solver v0.9.1 (Lunar Edition)
PyAstroPDL is a high-performance Python package for solving 1D lunar soft-landing optimal control problems. The package is designed with a modular architecture using JIT compilation (Numba) and contains an advanced toolkit for visualizing phase trajectories and telemetry.
🚀 See It in Action
Input — define the boundary conditions and solve:
import pyastropdl as pdl
init_cond = [28877, -56, 102378] # [m0, v0, h0]
end_cond = [0, 0] # [v_tau, h_tau]
rocket_params = (66628, 0.00029903701260349804, 17644) # (u_max, k, m_propellant)
solver = pdl.Solver(init_cond, end_cond, rocket_params, sim_engine="static_g")
solver.solve(dt=0.01)
solver.print_results()
Output — optimal phase trajectory and terminal state:
Same scenario with both gravity models:
| Engine | Ignition, t_s (s) | Landing, tau (s) |
|---|---|---|
| static_g | 178.87 | 521.97 |
| dynamic_g | 196.98 | 530.47 |
See full examples: with static gravity or dynamic gravity
📐 Mathematical Core & Numerical Methods
The structure of the optimal control is derived via Pontryagin’s maximum principle.
The package’s mathematical core is based on three numerical methods:
-
Shooting Method: Used to reduce a complex BVP to a root-finding problem for a residual function by integrating an initial value problem at each iteration (shot) and adjusting a free parameter of the system (shooting parameter).
-
Fourth-Order Runge-Kutta (RK4): Used for numerical integration of the system of differential equations.
-
Halley's Method: Used to approximate roots with cubic convergence.
🏗️ Architecture & Package Structure
The package is divided into two modules:
-
pyastropdl.core— Computational module. It contains the implementation of the theoretical part of the algorithm for solving the 1D lunar soft-landing optimal control problem.Solver— A class for finding a solution based on the obtained system parameters and for calculating the residual functions.
-
pyastropdl.visualization— Visualization module. It contains tools needed to graphically display the solution and the residual functions.-
Plotter— A class for displaying telemetry, phase trajectories, and residual plots. -
Animator— A class for generating an animation of the phase trajectory.
-
⚙️ The Solver Class and Its Methods
-
Solver(init_cond, end_cond, rocket_params, sim_engine)is a class for solving 1D lunar soft-landing problems. It takes boundary conditions, rocket parameters, and the simulation engine type as input:init_cond= $[m_0, v_0, h_0]$,end_cond= $[v(\tau), h(\tau)]$,rocket_params= $(u_{\max}, k, m_{\text{propellant}})$,sim_engine="static_g"or"dynamic_g".-
.solve(dt, eps)is a method for finding the solution to the BVP. It takesdt(simulation step) andeps(tolerance for root localization of the residual function). It returns an array of the spacecraft’s phase states corresponding to the found solution. -
.print_results()is a method for printing a concise report on the spacecraft’s state at optimal engine ignition ($t_s$) and at the terminal time $\tau$. -
.find_residuals(dt)is a method for calculating values of the residual functions. It takesdt(simulation step). It returns a tuple of two arrays: residual function values for terminal altitude and velocity, respectively.
-
⚙️ The Simulation Engines
The Solver class supports switching between gravity models via the sim_engine parameter:
-
static_g(Default) – Uses a static gravitational acceleration above the lunar surface $g = 1.6234 \text{ m/s}^2$. -
dynamic_g[EXPERIMENTAL] — Calculates gravitational acceleration dynamically depending on the spacecraft’s altitude.⚠️ Warning: The
dynamic_gengine is currently in experimental mode. The calculation of $\Delta v$ is performed using a simplified formula for static gravitation. There may be unstable behavior of the algorithm for localizing the bounds $[t_{\min}, t_{\max}]$, which can lead to a failure to find a solution even if it exists.
⚙️ The Plotter Class and Its Methods
-
Plotter(solver)is a class for static visualization. It requires a Solver instance for initialization from which it automatically extracts the required data.-
.plot_trajectory(fname)is a method for displaying the spacecraft’s phase trajectory plot. It takesfname(save path). It saves the image relative to the current working directory. The default filename isphase_trajectory.png. -
.plot_telemetry(fname)is a method for displaying the spacecraft’s time-series telemetry. It takesfname(save path). It saves the image relative to the current working directory. The default filename istelemetry.png. -
.plot_residuals(fname)is a method for displaying the residual function plots. It takesfname(save path). It saves the image relative to the current working directory. The default filename isresiduals.png.
-
⚙️ The Animator Class and Its Method
-
Animator(solver)is a class for dynamic visualization. It requires a Solver instance for initialization from which it automatically extracts the required data..animate(fps, duration, fname)is a method for generating an animation of the spacecraft’s phase trajectory. It takesfps(frame rate),duration(in seconds),fname(save path). It saves the video file relative to the current working directory. The default filename istrajectory.mp4.
🚀 Quickstart
Install the package via pip:
pip install pyastropdl
import pyastropdl as pdl
# === Condition of BVP ===
h_0 = 35000 # Initial altitude (m)
v_0 = 125 # Initial velocity (m/s)
m_0 = 750 # Initial mass of the spacecraft with the fuel (kg)
init_cond = [m_0, v_0, h_0]
h_tau = 0 # Condition on altitude for soft landing (m)
v_tau = 0 # Condition on velocity for soft landing (m/s)
end_cond = [v_tau, h_tau]
# === Rocket Parameters (DPS Engine) ===
u_max = 1700.0 # Max thrust (N)
isp = 311.0 # Specific impulse (s)
g_earth = 9.80665 # Standard Earth gravity constant (m/s^2)
# Mass flow rate coefficient k = 1 / (Isp * g_0)
k = 1.0 / (isp * g_earth)
m_propellant = 190 # Mass of propellant (kg)
rocket_params = (u_max, k, m_propellant)
# Initialisation of Solver
solver = pdl.Solver(init_cond, end_cond, rocket_params, sim_engine='static_g')
# Solve the system and print short results
solver.solve(dt=0.1)
solver.print_results()
# Find the residuals functions
solver.find_residuals(dt=0.1)
# Initialisation of Plotter
plotter = pdl.Plotter(solver)
# Plot the graphs of the spacecraft phase trajectory and telemetry
plotter.plot_trajectory()
plotter.plot_telemetry()
# Plot the residuals functions
plotter.plot_residuals()
# Initialisation of Animator
animator = pdl.Animator(solver)
# Animate the spacecraft trajectory
animator.animate(fps=60, duration=15)
📂 Repository Structure
pyastropdl/
├── pyastropdl/ # Main Package Directory
│ ├── core/ # Computational module
│ │ ├── common/
│ │ ├── simulation_engine/ # Numerical integration & gravity models
│ │ ├── solvers/ # BVP shooting algorithm implementation
│ │ ├── utils/ # Helper functions, paths & type definitions
│ │ └── solver.py # Main Solver API entry point
│ │
│ └── visualization/ # Visualization module
│ ├── style/ # Visual presets (colors, fonts, themes)
│ ├── components/ # Components for vsisualization
│ ├── animator.py # Dynamic MP4 phase portrait rendering
│ └── plotter.py # Static telemetry charts generation
│
├── Paper/ # Theoretical derivation documents
├── pyproject.toml # Package build configuration
└── README.md
🎓 Academic Background & Project Evolution
This project evolved from an initial short paper into an independent Python package and a full paper.
📜 Short Paper (ITEST-2026)
The initial mathematical problem formulation was published in the conference proceedings:
"DETERMINING THE SWITCHING AND LANDING TIME IN THE MOON SOFT LANDING PROBLEM" (p. 396.)
Conference proceedings of the VIII International Scientific-Practical Conference "Information Technology for Education, Science and Technics" (ITEST-2026)
- Theoretical development of the algorithm and code: Tymoshchuk Dmytro (
@angelet_dev) - Scientific supervision and organizational support: Revina Tetiana
📑 The Full Paper and Python Package
This repository contains a paper (in the Paper/ directory) accompanying the PyAstroPDL codebase.
👤 Author
- Tymoshchuk Dmytro (
@angelet_dev) — Sole developer of the PyAstroPDL package and author of the accompanying paper.
🛠 Tech Stack
- Core: Python 3
- Computation Engine: NumPy, Numba (JIT-compilation).
- Graphics: Matplotlib.
📜 License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for pyastropdl 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyastropdl-0.9.1.tar.gz | 336.5 kB | Without provenance | Details for pyastropdl-0.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyastropdl-0.9.1-py3-none-any.whl | Python 3 | none | any | Details for pyastropdl-0.9.1-py3-none-any.whl |
Total release size: 682.0 kB
Release files / pyastropdl-0.9.1.tar.gz
| Download URL | pyastropdl-0.9.1.tar.gz |
|---|---|
| Size | 336.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7701893279989d7a37d46d2f3b24e00edc4f677b9ba40b06f96e01aab4693c0
|
|
BLAKE2b-256 checksum How to use checksums |
b942104a550533daf532a83877f0fc275e0837e8cb4470ceb46e783642fccaa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / pyastropdl-0.9.1-py3-none-any.whl
| Download URL | pyastropdl-0.9.1-py3-none-any.whl |
|---|---|
| Size | 345.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5680e3b3da2c550b7734fd369862d80028d0f1ff35e82f772d8926bba674a908
|
|
BLAKE2b-256 checksum How to use checksums |
fcc68c9eb1fb83b76859c746344c97a3222019c1e413bf3b02a3bbe526392db8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for pyastropdl 0.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.