How rocketpy-team/rocketpy works
Purpose and Entry Points
RocketPy is a Python library for high-power rocket trajectory analysis: primarily nonlinear 6-DOF flight simulation with variable mass, aerodynamics, weather, recovery, controls, and uncertainty analysis. The public API is exposed from rocketpy/__init__.py; users typically construct Environment, a motor, Rocket, then Flight. Interactive entry points are notebooks such as docs/notebooks/getting_started.ipynb and scenario examples under docs/examples/.
Core Simulation Pipeline
Flight is the central orchestration and results object. It consumes a fully assembled rocket plus environment and launch-rail/heading parameters, integrates the trajectory, models flight phases including descent, and retains computed states for reporting/export.
• rocketpy/simulation/flight.py
• rocketpy/simulation/flight_data_exporter.py
• rocketpy/simulation/flight_comparator.py
The principal boundary is object configuration versus numerical execution: Environment, motor, rocket geometry/recovery, sensors, and controllers are composed before Flight runs.
Environment and Atmospheric Data
Environment owns launch location, date, elevation/topography, gravity, and atmospheric state such as wind and pressure profiles. It supports standard/custom atmosphere and retrieved forecast, reanalysis, sounding, and ensemble data; fetcher/mapping code isolates external weather providers from simulation consumers.
• rocketpy/environment/environment.py
• rocketpy/environment/fetchers.py
• rocketpy/environment/weather_model_mapping.py
Packaged NetCDF weather/topography files provide reproducible local datasets, e.g. data/weather/EuroC_pressure_levels_reanalysis_2001-2021.nc and data/sites/switzerland/NASADEM_NC_n46e008.nc.
Propulsion and Mass Evolution
The motor hierarchy turns thrust inputs and propellant/tank definitions into time-varying thrust, mass, center of mass, and inertia used by Rocket and Flight. It supports solid, hybrid, liquid, generic, point-mass, and clustered motors; liquid/hybrid paths compose fluids, tanks, and tank geometry.
• rocketpy/motors/motor.py
• rocketpy/motors/solid_motor.py
• rocketpy/motors/liquid_motor.py
Inputs cross a file-format boundary through ENG/RSE/CSV thrust and flow data, with representative assets in data/motors/cesaroni/Cesaroni_M1670.eng and data/motors/liquid_motor_example/.
Vehicle, Aerodynamics, Recovery, and Control
Rocket aggregates dry-body properties, attached motor(s), drag models, rail hardware, and aerodynamic surfaces. Surface subclasses encapsulate geometry/aerodynamic contributions; parachutes define deployment trigger, lag, noise, and descent drag. Controllers allow custom continuous or discrete actuation, including air brakes.
• rocketpy/rocket/rocket.py
• rocketpy/rocket/aero_surface/air_brakes.py
• rocketpy/rocket/parachute.py
• rocketpy/control/controller.py
This is the main assembly boundary: component APIs produce a vehicle model consumed by the flight solver rather than directly solving trajectories.
Numerical and Sensor Foundations
Reusable Function/interpolation machinery represents thrust curves, atmospheric profiles, drag tables, and derived time histories. Vector/matrix operations support the 6-DOF dynamics. Simulated accelerometer, gyroscope, barometer, and GNSS models can feed recovery/control logic with noise and seeding behavior.
• rocketpy/mathutils/function.py
• rocketpy/mathutils/vector_matrix.py
• rocketpy/sensors/sensor.py
Dispersion, Sensitivity, and Outputs
Stochastic wrappers parameterize uncertain environment, motor, rocket, aerodynamic, parachute, and flight inputs. MonteCarlo repeatedly instantiates/runs these models for dispersion; sensitivity analysis evaluates output dependence. Results are exposed through plotting/printing facades and may be exported/imported as flight data or KML.
• rocketpy/simulation/monte_carlo.py
• rocketpy/stochastic/stochastic_flight.py
• rocketpy/sensitivity/sensitivity_model.py
• rocketpy/plots/flight_plots.py
Runtime and Delivery
The material runtime is Python, distributed as the rocketpy package through PyPI and Conda. Documentation is Sphinx/Read the Docs-oriented (docs/conf.py), with Jupyter and MATLAB integration artifacts. Docker supports reproducible development/runtime environments.
• pyproject.toml
• docker/Dockerfile
• .github/workflows/publish-to-pypi.yml
Main entry points: flight.py Flight · rocket.py Rocket · environment.py Environment · motor.py Motor hierarchy
Components 22
Model Assembly
Configured inputs assembled before numerical execution.
- Environment · Launch conditions and atmospheric state.
rocketpy/environment/environment.py - Weather providers · Maps external weather sources into environment profiles.
rocketpy/environment/fetchers.py - Weather mapping
rocketpy/environment/weather_model_mapping.py - Packaged weather data · Reproducible weather and topography inputs.
data/weather/EuroC_pressure_levels_reanalysis_2001-2021.nc - Motor hierarchy · Produces time-varying thrust, mass, center of mass, and inertia.
rocketpy/motors/motor.py - Liquid motor · Composes fluids, tanks, and tank geometry.
rocketpy/motors/liquid_motor.py - Thrust & flow inputs · ENG, RSE, CSV, and flow definitions.
data/motors/cesaroni/Cesaroni_M1670.eng - Rocket · Aggregates body, motors, aerodynamics, rail hardware, and recovery.
rocketpy/rocket/rocket.py - Air brakes
rocketpy/rocket/aero_surface/air_brakes.py - Parachute · Models deployment trigger, lag, noise, and descent drag.
rocketpy/rocket/parachute.py - Controllers · Continuous or discrete actuator logic.
rocketpy/control/controller.py
Simulation & Analysis
Flight execution and post-flight studies.
- Flight · Integrates flight phases and retains trajectory results.
rocketpy/simulation/flight.py - Flight data export
rocketpy/simulation/flight_data_exporter.py - Monte Carlo · Repeatedly instantiates and runs uncertain models.
rocketpy/simulation/monte_carlo.py - Stochastic flight · Parameterizes uncertain flight inputs.
rocketpy/stochastic/stochastic_flight.py - Sensitivity analysis
rocketpy/sensitivity/sensitivity_model.py - Flight plots
rocketpy/plots/flight_plots.py
Shared Foundations
- Function & interpolation · Represents profiles, tables, curves, and derived histories.
rocketpy/mathutils/function.py - Simulated sensors · Noisy accelerometer, gyroscope, barometer, and GNSS models.
rocketpy/sensors/sensor.py
Delivery
- Python package · Published through PyPI and Conda.
pyproject.toml - PyPI publishing
.github/workflows/publish-to-pypi.yml
Other components
- Public API
rocketpy/__init__.py
Connections 25
- Public API → Environment: exposes
- Public API → Motor hierarchy: exposes
- Public API → Rocket: exposes
- Public API → Flight: exposes
- Weather providers → Weather mapping: uses
- Weather mapping → Environment: normalizes for
- Packaged weather data → Environment: profiles for
- Thrust & flow inputs → Motor hierarchy: defines
- Liquid motor → Motor hierarchy: specializes
- Motor hierarchy → Rocket: attached to
- Air brakes → Rocket: aerodynamic component
- Parachute → Rocket: recovery component
- Controllers → Rocket: actuates
- Function & interpolation → Environment: profiles
- Function & interpolation → Motor hierarchy: curves
- Function & interpolation → Rocket: drag tables
- Environment → Flight: conditions
- Rocket → Flight: vehicle model
- Simulated sensors → Controllers: measurements for
- Flight → Flight data export: exports results
- Flight → Flight plots: visualizes
- Stochastic flight → Monte Carlo: parameterizes
- Monte Carlo → Flight: repeats
- Flight → Sensitivity analysis: outputs analyzed
- Python package → PyPI publishing: published by