cosmic-warp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cosmic_warp-0.1.0/CHANGELOG.md +49 -0
- cosmic_warp-0.1.0/CITATION.cff +21 -0
- cosmic_warp-0.1.0/CONTRIBUTING.md +83 -0
- cosmic_warp-0.1.0/LICENSE +201 -0
- cosmic_warp-0.1.0/MANIFEST.in +10 -0
- cosmic_warp-0.1.0/PKG-INFO +251 -0
- cosmic_warp-0.1.0/README.md +211 -0
- cosmic_warp-0.1.0/benchmarks/baselines/nvidia_geforce_rtx_4070_ti_super.json +35 -0
- cosmic_warp-0.1.0/benchmarks/bench.py +278 -0
- cosmic_warp-0.1.0/cosmic_warp/__init__.py +15 -0
- cosmic_warp-0.1.0/cosmic_warp/actuators/__init__.py +7 -0
- cosmic_warp-0.1.0/cosmic_warp/actuators/base.py +288 -0
- cosmic_warp-0.1.0/cosmic_warp/actuators/reaction_wheels.py +313 -0
- cosmic_warp-0.1.0/cosmic_warp/actuators/thrusters.py +336 -0
- cosmic_warp-0.1.0/cosmic_warp/core/__init__.py +1 -0
- cosmic_warp-0.1.0/cosmic_warp/core/autodiff.py +244 -0
- cosmic_warp-0.1.0/cosmic_warp/core/config.py +706 -0
- cosmic_warp-0.1.0/cosmic_warp/core/context.py +27 -0
- cosmic_warp-0.1.0/cosmic_warp/core/entities.py +71 -0
- cosmic_warp-0.1.0/cosmic_warp/core/flags.py +87 -0
- cosmic_warp-0.1.0/cosmic_warp/core/integrators/__init__.py +1 -0
- cosmic_warp-0.1.0/cosmic_warp/core/integrators/base.py +341 -0
- cosmic_warp-0.1.0/cosmic_warp/core/integrators/euler.py +172 -0
- cosmic_warp-0.1.0/cosmic_warp/core/integrators/rk4.py +250 -0
- cosmic_warp-0.1.0/cosmic_warp/core/integrators/symplectic.py +287 -0
- cosmic_warp-0.1.0/cosmic_warp/core/pipeline.py +1108 -0
- cosmic_warp-0.1.0/cosmic_warp/core/randomization.py +342 -0
- cosmic_warp-0.1.0/cosmic_warp/core/reset.py +913 -0
- cosmic_warp-0.1.0/cosmic_warp/core/rng.py +89 -0
- cosmic_warp-0.1.0/cosmic_warp/core/state.py +23 -0
- cosmic_warp-0.1.0/cosmic_warp/core/termination.py +312 -0
- cosmic_warp-0.1.0/cosmic_warp/core/validation.py +168 -0
- cosmic_warp-0.1.0/cosmic_warp/core/vehicle.py +310 -0
- cosmic_warp-0.1.0/cosmic_warp/physics/__init__.py +1 -0
- cosmic_warp-0.1.0/cosmic_warp/physics/aggregation.py +92 -0
- cosmic_warp-0.1.0/cosmic_warp/physics/drag.py +238 -0
- cosmic_warp-0.1.0/cosmic_warp/physics/gravity.py +130 -0
- cosmic_warp-0.1.0/cosmic_warp/physics/magnetic.py +88 -0
- cosmic_warp-0.1.0/cosmic_warp/physics/orbits.py +236 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/__init__.py +23 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/adapters/__init__.py +22 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/adapters/rl_games.py +166 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/adapters/rsl_rl.py +141 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/adapters/skrl.py +214 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/diff_bridge.py +348 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/diff_env.py +150 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/diff_tasks.py +58 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/env.py +303 -0
- cosmic_warp-0.1.0/cosmic_warp/rl/tasks.py +57 -0
- cosmic_warp-0.1.0/cosmic_warp.egg-info/PKG-INFO +251 -0
- cosmic_warp-0.1.0/cosmic_warp.egg-info/SOURCES.txt +193 -0
- cosmic_warp-0.1.0/cosmic_warp.egg-info/dependency_links.txt +1 -0
- cosmic_warp-0.1.0/cosmic_warp.egg-info/requires.txt +18 -0
- cosmic_warp-0.1.0/cosmic_warp.egg-info/top_level.txt +1 -0
- cosmic_warp-0.1.0/docs/assets/banner.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/domain_randomization.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/energy_conservation_comparison.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/gradient_optimization.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/integrator_comparison.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/j2_comparison.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/monte_carlo_analysis.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/orbital_3d.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/orbital_altitude_velocity.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/orbital_timeseries.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/planar_thrusters_angular_velocity.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/planar_thrusters_mass.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/planar_thrusters_trajectory.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/planar_thrusters_velocity.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/rw_angvel.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/rw_wheels.png +0 -0
- cosmic_warp-0.1.0/docs/assets/examples/system_identification.png +0 -0
- cosmic_warp-0.1.0/docs/assets/favicon.svg +5 -0
- cosmic_warp-0.1.0/docs/assets/learning-dark.svg +3092 -0
- cosmic_warp-0.1.0/docs/assets/learning-light.svg +3092 -0
- cosmic_warp-0.1.0/docs/assets/step-dark.svg +3420 -0
- cosmic_warp-0.1.0/docs/assets/step-light.svg +3420 -0
- cosmic_warp-0.1.0/docs/benchmarks.md +52 -0
- cosmic_warp-0.1.0/docs/citation.md +33 -0
- cosmic_warp-0.1.0/docs/getting-started.md +190 -0
- cosmic_warp-0.1.0/docs/guides/actuators.md +139 -0
- cosmic_warp-0.1.0/docs/guides/configuration.md +428 -0
- cosmic_warp-0.1.0/docs/guides/differentiable-rl.md +168 -0
- cosmic_warp-0.1.0/docs/guides/differentiable.md +186 -0
- cosmic_warp-0.1.0/docs/guides/extending.md +87 -0
- cosmic_warp-0.1.0/docs/guides/index.md +19 -0
- cosmic_warp-0.1.0/docs/guides/integrators.md +53 -0
- cosmic_warp-0.1.0/docs/guides/physics.md +66 -0
- cosmic_warp-0.1.0/docs/guides/randomization.md +85 -0
- cosmic_warp-0.1.0/docs/guides/reset.md +217 -0
- cosmic_warp-0.1.0/docs/guides/rl.md +297 -0
- cosmic_warp-0.1.0/docs/guides/running.md +171 -0
- cosmic_warp-0.1.0/docs/guides/scaling.md +142 -0
- cosmic_warp-0.1.0/docs/guides/vehicle.md +102 -0
- cosmic_warp-0.1.0/docs/index.md +102 -0
- cosmic_warp-0.1.0/docs/javascripts/katex.js +12 -0
- cosmic_warp-0.1.0/docs/reference/index.md +7 -0
- cosmic_warp-0.1.0/docs/reference/stability.md +124 -0
- cosmic_warp-0.1.0/docs/references.bib +220 -0
- cosmic_warp-0.1.0/docs/references.md +168 -0
- cosmic_warp-0.1.0/docs/roadmap.md +57 -0
- cosmic_warp-0.1.0/docs/stylesheets/extra.css +45 -0
- cosmic_warp-0.1.0/docs/theory/actuators.md +110 -0
- cosmic_warp-0.1.0/docs/theory/conventions.md +168 -0
- cosmic_warp-0.1.0/docs/theory/differentiable.md +124 -0
- cosmic_warp-0.1.0/docs/theory/dynamics.md +143 -0
- cosmic_warp-0.1.0/docs/theory/environment.md +101 -0
- cosmic_warp-0.1.0/docs/theory/execution.md +351 -0
- cosmic_warp-0.1.0/docs/theory/gravity.md +85 -0
- cosmic_warp-0.1.0/docs/theory/index.md +27 -0
- cosmic_warp-0.1.0/docs/theory/integrators.md +183 -0
- cosmic_warp-0.1.0/docs/theory/sampling.md +176 -0
- cosmic_warp-0.1.0/docs/troubleshooting.md +106 -0
- cosmic_warp-0.1.0/docs/validation/execution.md +189 -0
- cosmic_warp-0.1.0/docs/validation/index.md +115 -0
- cosmic_warp-0.1.0/docs/validation/learning.md +156 -0
- cosmic_warp-0.1.0/docs/validation/numerics.md +115 -0
- cosmic_warp-0.1.0/docs/validation/physics.md +230 -0
- cosmic_warp-0.1.0/examples/01_basic_orbit.py +437 -0
- cosmic_warp-0.1.0/examples/02_integrator_comparison.py +309 -0
- cosmic_warp-0.1.0/examples/03_parallel_monte_carlo.py +309 -0
- cosmic_warp-0.1.0/examples/04_scalability.py +105 -0
- cosmic_warp-0.1.0/examples/05_energy_conservation.py +307 -0
- cosmic_warp-0.1.0/examples/06_thrusters.py +272 -0
- cosmic_warp-0.1.0/examples/07_reaction_wheels.py +234 -0
- cosmic_warp-0.1.0/examples/08_j2_comparison.py +289 -0
- cosmic_warp-0.1.0/examples/09_multi_body_orbit.py +142 -0
- cosmic_warp-0.1.0/examples/10_domain_randomization.py +158 -0
- cosmic_warp-0.1.0/examples/11_gradient_optimization.py +194 -0
- cosmic_warp-0.1.0/examples/12_system_identification.py +183 -0
- cosmic_warp-0.1.0/examples/13_rl_attitude_env.py +145 -0
- cosmic_warp-0.1.0/examples/14_rl_rsl_training.py +99 -0
- cosmic_warp-0.1.0/examples/15_rl_skrl_training.py +101 -0
- cosmic_warp-0.1.0/examples/16_rl_rlgames_training.py +111 -0
- cosmic_warp-0.1.0/examples/17_rl_shac_training.py +112 -0
- cosmic_warp-0.1.0/examples/README.md +14 -0
- cosmic_warp-0.1.0/examples/attitude_task.py +243 -0
- cosmic_warp-0.1.0/examples/minimal_orbit.yaml +23 -0
- cosmic_warp-0.1.0/examples/monte_carlo_dispersion.yaml +59 -0
- cosmic_warp-0.1.0/examples/multibody_orbit.yaml +110 -0
- cosmic_warp-0.1.0/examples/rendezvous_chaser_target.yaml +95 -0
- cosmic_warp-0.1.0/examples/rl_attitude_training.yaml +69 -0
- cosmic_warp-0.1.0/examples/run_config.py +110 -0
- cosmic_warp-0.1.0/examples/shac.py +431 -0
- cosmic_warp-0.1.0/mkdocs.yml +157 -0
- cosmic_warp-0.1.0/pyproject.toml +103 -0
- cosmic_warp-0.1.0/scripts/diagrams.py +381 -0
- cosmic_warp-0.1.0/scripts/figures.py +323 -0
- cosmic_warp-0.1.0/scripts/gen_changelog_page.py +19 -0
- cosmic_warp-0.1.0/scripts/gen_example_pages.py +103 -0
- cosmic_warp-0.1.0/scripts/gen_figures.py +19 -0
- cosmic_warp-0.1.0/scripts/gen_ref_pages.py +35 -0
- cosmic_warp-0.1.0/scripts/gen_tables.py +145 -0
- cosmic_warp-0.1.0/setup.cfg +4 -0
- cosmic_warp-0.1.0/tests/conftest.py +100 -0
- cosmic_warp-0.1.0/tests/goldens/cpu.npz +0 -0
- cosmic_warp-0.1.0/tests/goldens/nvidia_geforce_rtx_4070_ti_super.npz +0 -0
- cosmic_warp-0.1.0/tests/orbit_utils.py +137 -0
- cosmic_warp-0.1.0/tests/rl_tasks.py +134 -0
- cosmic_warp-0.1.0/tests/test_api.py +283 -0
- cosmic_warp-0.1.0/tests/test_attitude.py +90 -0
- cosmic_warp-0.1.0/tests/test_bench.py +25 -0
- cosmic_warp-0.1.0/tests/test_closed_form.py +90 -0
- cosmic_warp-0.1.0/tests/test_config.py +547 -0
- cosmic_warp-0.1.0/tests/test_cw.py +53 -0
- cosmic_warp-0.1.0/tests/test_diagram.py +175 -0
- cosmic_warp-0.1.0/tests/test_docs.py +275 -0
- cosmic_warp-0.1.0/tests/test_drag.py +109 -0
- cosmic_warp-0.1.0/tests/test_example_attitude_task.py +85 -0
- cosmic_warp-0.1.0/tests/test_example_shac.py +288 -0
- cosmic_warp-0.1.0/tests/test_examples.py +192 -0
- cosmic_warp-0.1.0/tests/test_figures.py +38 -0
- cosmic_warp-0.1.0/tests/test_golden.py +123 -0
- cosmic_warp-0.1.0/tests/test_gradients.py +586 -0
- cosmic_warp-0.1.0/tests/test_hot_loop.py +42 -0
- cosmic_warp-0.1.0/tests/test_integrator_order.py +131 -0
- cosmic_warp-0.1.0/tests/test_j2.py +125 -0
- cosmic_warp-0.1.0/tests/test_kernel_hygiene.py +299 -0
- cosmic_warp-0.1.0/tests/test_maneuvers.py +185 -0
- cosmic_warp-0.1.0/tests/test_orbit_sampling.py +345 -0
- cosmic_warp-0.1.0/tests/test_pipeline.py +294 -0
- cosmic_warp-0.1.0/tests/test_randomization.py +285 -0
- cosmic_warp-0.1.0/tests/test_reset.py +452 -0
- cosmic_warp-0.1.0/tests/test_rl_diff_env.py +524 -0
- cosmic_warp-0.1.0/tests/test_rl_env.py +345 -0
- cosmic_warp-0.1.0/tests/test_rl_rlgames_adapter.py +131 -0
- cosmic_warp-0.1.0/tests/test_rl_rsl_adapter.py +103 -0
- cosmic_warp-0.1.0/tests/test_rl_skrl_adapter.py +170 -0
- cosmic_warp-0.1.0/tests/test_rng.py +169 -0
- cosmic_warp-0.1.0/tests/test_rw.py +241 -0
- cosmic_warp-0.1.0/tests/test_set_config.py +247 -0
- cosmic_warp-0.1.0/tests/test_stability.py +235 -0
- cosmic_warp-0.1.0/tests/test_termination.py +275 -0
- cosmic_warp-0.1.0/tests/test_thrusters.py +158 -0
- cosmic_warp-0.1.0/tests/test_two_body.py +121 -0
- cosmic_warp-0.1.0/tests/wheel_smoke.py +57 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
|
|
5
|
+
uses [semantic versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-11-04
|
|
8
|
+
|
|
9
|
+
First public release, as a **beta**: the public API may change before 1.0,
|
|
10
|
+
and each breaking change will be listed here.
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- GPU-parallel spacecraft dynamics on NVIDIA Warp: thousands to millions of
|
|
15
|
+
independent environments, 6-DOF orbital and attitude dynamics in float64,
|
|
16
|
+
with physics, integration and termination fused into one kernel per step
|
|
17
|
+
and replayed as a CUDA graph by `simulate()`.
|
|
18
|
+
- Integrators: Euler, RK4 (default) and symplectic kick–drift–kick, each
|
|
19
|
+
verified to reach its nominal order of convergence.
|
|
20
|
+
- Physics: point-mass gravity, J2, atmospheric drag, gravity-gradient and
|
|
21
|
+
magnetic torques, variable mass.
|
|
22
|
+
- Actuators: up to 8 thrusters (Isp, propellant use) and 4 reaction wheels
|
|
23
|
+
(momentum saturation, viscous friction) per body.
|
|
24
|
+
- Multi-body environments, configured per body from Python or YAML.
|
|
25
|
+
- Reset sampling (Cartesian boxes or orbital elements) and domain
|
|
26
|
+
randomization on the GPU, from counter-based (Philox) per-entity random
|
|
27
|
+
streams with 64-bit seeds; on-device termination, including non-finite
|
|
28
|
+
states and actuator commands.
|
|
29
|
+
- Differentiable rollouts: reverse-mode gradients w.r.t. initial state,
|
|
30
|
+
control sequences and vehicle parameters.
|
|
31
|
+
- Reinforcement learning: on-device vectorized environment with auto-reset
|
|
32
|
+
and zero-copy torch views; adapters for rsl_rl, skrl and rl_games; a
|
|
33
|
+
differentiable environment for first-order methods. A reference attitude
|
|
34
|
+
task and a minimal SHAC trainer are in `examples/`.
|
|
35
|
+
- Seventeen examples, a YAML scenario format, a physics validation suite
|
|
36
|
+
against analytic results, and a per-GPU performance regression benchmark.
|
|
37
|
+
|
|
38
|
+
### Known limitations
|
|
39
|
+
|
|
40
|
+
- No user force/torque input and no supported custom-integrator interface;
|
|
41
|
+
both are planned for 1.x.
|
|
42
|
+
- Earth is the only central body: orbit specs take no `mu`.
|
|
43
|
+
- The integrators do not locate events: reaction-wheel saturation inside a
|
|
44
|
+
step limits every integrator to second order around it, and propellant
|
|
45
|
+
burnout is spread over its step (delta-v exact, position error
|
|
46
|
+
O(dt²) once per burnout).
|
|
47
|
+
- On consumer GPUs the step is bound by FP64 throughput (1/64 of FP32 rate);
|
|
48
|
+
GPUs with full-rate FP64 have not been measured.
|
|
49
|
+
- The RL trainer adapters support one body per environment.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it as below."
|
|
3
|
+
title: "COSMIC WARP: GPU-Accelerated Spacecraft Simulator"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: "Lima"
|
|
7
|
+
given-names: "Pedro"
|
|
8
|
+
affiliation: "University of Luxembourg, SnT, SpaceR"
|
|
9
|
+
- family-names: "Arora"
|
|
10
|
+
given-names: "Aman"
|
|
11
|
+
affiliation: "University of Luxembourg, SnT, SpaceR"
|
|
12
|
+
version: 0.1.0
|
|
13
|
+
license: Apache-2.0
|
|
14
|
+
repository-code: "https://github.com/Pedro-g-Lima/COSMIC_WARP"
|
|
15
|
+
url: "https://pedro-g-lima.github.io/COSMIC_WARP/"
|
|
16
|
+
keywords:
|
|
17
|
+
- spacecraft simulation
|
|
18
|
+
- GPU
|
|
19
|
+
- NVIDIA Warp
|
|
20
|
+
- differentiable simulation
|
|
21
|
+
- reinforcement learning
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributing to COSMIC WARP
|
|
2
|
+
|
|
3
|
+
Thanks for your interest! Bug reports, fixes, documentation improvements and
|
|
4
|
+
new physics or actuator models are all welcome. For larger changes, open an
|
|
5
|
+
issue first so the approach can be discussed before you invest time.
|
|
6
|
+
|
|
7
|
+
## Development install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/Pedro-g-Lima/COSMIC_WARP.git
|
|
11
|
+
cd COSMIC_WARP
|
|
12
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
13
|
+
pip install --upgrade "pip>=25.1" # for --group
|
|
14
|
+
pip install -e . --group dev
|
|
15
|
+
# the RL stack: pip install -e ".[torch,rsl-rl,skrl,rl-games]" --group dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Tests
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pytest # full suite on CUDA
|
|
22
|
+
pytest --device cpu # without a GPU (what CI runs)
|
|
23
|
+
pytest -m "not slow" # skip the end-to-end training tests
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
CI runs the CPU suite on Python 3.12 and 3.14; both ends of the dependency
|
|
27
|
+
ranges (Python 3.12 with the lowest supported Warp, NumPy and PyYAML, Python
|
|
28
|
+
3.14 with the newest); the built wheel in a fresh environment; and the RL
|
|
29
|
+
tests with CPU torch. CUDA-only tests (graph capture, training, the GPU
|
|
30
|
+
golden trajectories) must pass on a GPU before a release.
|
|
31
|
+
|
|
32
|
+
If you change a step kernel, also run the performance gate on your GPU:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python benchmarks/bench.py --save # once, on the base commit
|
|
36
|
+
python benchmarks/bench.py # after your change; fails on >15 % regression
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Releasing
|
|
40
|
+
|
|
41
|
+
Set `__version__` in `cosmic_warp/__init__.py` (the package version is read
|
|
42
|
+
from it) and in `CITATION.cff`, date the `CHANGELOG.md` entry, then push the
|
|
43
|
+
tag `v<version>`: the release workflow builds, checks and publishes to PyPI,
|
|
44
|
+
and refuses a tag that does not match `__version__`.
|
|
45
|
+
|
|
46
|
+
## Docs
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install -e . --group docs
|
|
50
|
+
mkdocs build --strict # must pass
|
|
51
|
+
mkdocs serve # preview at http://127.0.0.1:8000
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## What a pull request needs
|
|
55
|
+
|
|
56
|
+
- **Correctness first.** Physical accuracy, then differentiability, then
|
|
57
|
+
GPU performance. No silent approximations: state any model limit in the
|
|
58
|
+
docs.
|
|
59
|
+
- **A test for every fix**, one that fails before the fix. Physics changes
|
|
60
|
+
are tested against an analytic or known result, and gradients against
|
|
61
|
+
finite differences. Don't loosen tolerances to make a test pass; seed
|
|
62
|
+
randomness; every skip states its reason.
|
|
63
|
+
- **Validate at configuration time**, with a `ValueError` that names the
|
|
64
|
+
field. Nothing in the step loop may synchronize with the host.
|
|
65
|
+
- **Float64 and adjoint-safe kernels**: see the
|
|
66
|
+
[kernel conventions](https://pedro-g-lima.github.io/COSMIC_WARP/guides/extending/#kernel-conventions).
|
|
67
|
+
Every float literal in a kernel goes through `wp.float64(...)`
|
|
68
|
+
(`tests/test_kernel_hygiene.py` enforces it).
|
|
69
|
+
- **Golden trajectories.** `tests/test_golden.py` pins a seeded run bit for
|
|
70
|
+
bit. If your change is meant to alter results, regenerate the fixtures
|
|
71
|
+
(`pytest tests/test_golden.py --device cpu --update-goldens`, and on a GPU
|
|
72
|
+
with `--device cuda`) and say why in the pull request.
|
|
73
|
+
- **Scope.** The package is the simulator: controllers, tasks and training
|
|
74
|
+
algorithms belong in `examples/` or in your own project.
|
|
75
|
+
- **Docs and changelog.** Update the docs for any behaviour change and add
|
|
76
|
+
an entry to `CHANGELOG.md`.
|
|
77
|
+
- Match the surrounding code style; keep changes minimal and focused.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
Unless you explicitly state otherwise, any contribution you submit for
|
|
82
|
+
inclusion is licensed under the Apache License 2.0, as defined in section 5
|
|
83
|
+
of the [license](LICENSE), without additional terms or conditions.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Pedro Lima and Aman Arora
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# The sdist is the whole source (conda-forge builds and tests from it): the
|
|
2
|
+
# test suite with its helpers and golden fixtures, and what the suite reads —
|
|
3
|
+
# the docs it checks, the examples it runs, the scripts that draw the figures.
|
|
4
|
+
graft tests
|
|
5
|
+
graft docs
|
|
6
|
+
graft examples
|
|
7
|
+
graft scripts
|
|
8
|
+
graft benchmarks
|
|
9
|
+
include mkdocs.yml CHANGELOG.md CITATION.cff CONTRIBUTING.md
|
|
10
|
+
global-exclude __pycache__ *.py[cod]
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cosmic-warp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: GPU-accelerated parallel spacecraft dynamics simulator built on NVIDIA Warp
|
|
5
|
+
Author: Pedro Lima, Aman Arora
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Pedro-g-Lima/COSMIC_WARP
|
|
8
|
+
Project-URL: Documentation, https://pedro-g-lima.github.io/COSMIC_WARP/
|
|
9
|
+
Project-URL: Issues, https://github.com/Pedro-g-Lima/COSMIC_WARP/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Pedro-g-Lima/COSMIC_WARP/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: spacecraft,simulation,astrodynamics,attitude dynamics,gpu,nvidia warp,differentiable simulation,reinforcement learning
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: GPU :: NVIDIA CUDA
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: warp-lang<1.19,>=1.15
|
|
27
|
+
Requires-Dist: numpy>=2.0
|
|
28
|
+
Requires-Dist: PyYAML>=6.0.1
|
|
29
|
+
Provides-Extra: examples
|
|
30
|
+
Requires-Dist: matplotlib; extra == "examples"
|
|
31
|
+
Provides-Extra: torch
|
|
32
|
+
Requires-Dist: torch; extra == "torch"
|
|
33
|
+
Provides-Extra: rsl-rl
|
|
34
|
+
Requires-Dist: rsl-rl-lib<6.0,>=5.0; extra == "rsl-rl"
|
|
35
|
+
Provides-Extra: skrl
|
|
36
|
+
Requires-Dist: skrl[torch]<3.0,>=2.0; extra == "skrl"
|
|
37
|
+
Provides-Extra: rl-games
|
|
38
|
+
Requires-Dist: rl-games<2.0,>=1.6.5; extra == "rl-games"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# COSMIC WARP
|
|
42
|
+
|
|
43
|
+
<p align="center"><img src="https://raw.githubusercontent.com/Pedro-g-Lima/COSMIC_WARP/main/docs/assets/banner.png" alt="COSMIC WARP" width="900" /></p>
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<a href="https://github.com/Pedro-g-Lima/COSMIC_WARP/actions/workflows/tests.yml"><img src="https://github.com/Pedro-g-Lima/COSMIC_WARP/actions/workflows/tests.yml/badge.svg" alt="Tests" /></a>
|
|
47
|
+
<a href="https://pedro-g-lima.github.io/COSMIC_WARP/"><img src="https://img.shields.io/badge/docs-GitHub%20Pages-blue" alt="Documentation" /></a>
|
|
48
|
+
<a href="https://pypi.org/project/cosmic-warp/"><img src="https://img.shields.io/pypi/v/cosmic-warp" alt="PyPI" /></a>
|
|
49
|
+
<img src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-blue" alt="Python 3.12-3.14" />
|
|
50
|
+
<a href="https://github.com/Pedro-g-Lima/COSMIC_WARP/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License: Apache-2.0" /></a>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
COSMIC WARP is a GPU-parallel spacecraft dynamics simulator built on
|
|
54
|
+
[NVIDIA Warp](https://github.com/NVIDIA/warp). It propagates thousands to
|
|
55
|
+
millions of independent spacecraft environments at once — 6-DOF orbital and
|
|
56
|
+
attitude dynamics in float64, with thrusters, reaction wheels and
|
|
57
|
+
environmental perturbations — for Monte Carlo studies, trajectory and
|
|
58
|
+
parameter optimization with exact gradients, and reinforcement learning.
|
|
59
|
+
`simulate()` and the RL environment replay each step as a CUDA graph, with
|
|
60
|
+
no host round-trip inside the loop.
|
|
61
|
+
|
|
62
|
+
**[Documentation](https://pedro-g-lima.github.io/COSMIC_WARP/)** — installation, guides,
|
|
63
|
+
examples, theory and API reference.
|
|
64
|
+
|
|
65
|
+
> **Status: 0.1 beta.** The public API may change before 1.0; every breaking
|
|
66
|
+
> change is listed in the [changelog](https://github.com/Pedro-g-Lima/COSMIC_WARP/blob/main/CHANGELOG.md).
|
|
67
|
+
|
|
68
|
+
## Highlights
|
|
69
|
+
|
|
70
|
+
- **GPU-parallel** — physics, integration and termination fused into one
|
|
71
|
+
kernel per step for every environment; `simulate()` replays the step as a
|
|
72
|
+
CUDA graph
|
|
73
|
+
- **Float64 throughout** — all dynamic state and physics in double precision
|
|
74
|
+
- **Integrators** — Euler, RK4 (default) and a symplectic kick–drift–kick scheme, each
|
|
75
|
+
verified to reach its nominal order of convergence
|
|
76
|
+
- **Physics** — point-mass gravity, J2, atmospheric drag, gravity-gradient
|
|
77
|
+
and magnetic torques, each switchable; variable mass from thruster
|
|
78
|
+
propellant use
|
|
79
|
+
- **Actuators** — up to 8 thrusters (Isp, propellant use) and 4 reaction
|
|
80
|
+
wheels (momentum saturation, viscous friction) per body
|
|
81
|
+
- **Multi-body** — several spacecraft per environment, configured per body
|
|
82
|
+
and terminated together (no forces between them)
|
|
83
|
+
- **Differentiable** — reverse-mode gradients through the dynamics w.r.t.
|
|
84
|
+
initial state, control sequences and vehicle parameters, checked against
|
|
85
|
+
finite differences
|
|
86
|
+
- **Reinforcement learning** — on-device vectorized environment with
|
|
87
|
+
auto-reset and zero-copy torch views, adapters for rsl_rl, skrl and
|
|
88
|
+
rl_games, and a differentiable environment for first-order methods; a
|
|
89
|
+
reference task and a minimal SHAC trainer in `examples/`
|
|
90
|
+
- **Domain randomization and reset sampling** — on-GPU, including orbital
|
|
91
|
+
element sampling
|
|
92
|
+
- **Validated** — tests against analytic results: Kepler orbits, J2 secular
|
|
93
|
+
rates, drag decay, torque-free rigid-body motion, Hohmann transfers, the
|
|
94
|
+
rocket equation, Clohessy–Wiltshire relative motion, closed-form torques
|
|
95
|
+
|
|
96
|
+
## Inside a step
|
|
97
|
+
|
|
98
|
+
One fused kernel per step integrates every entity: one GPU thread each, with
|
|
99
|
+
the forces, torques, actuators, integrator update and termination check
|
|
100
|
+
inside. `simulate()` records the step's kernels once as a CUDA graph and
|
|
101
|
+
replays them.
|
|
102
|
+
|
|
103
|
+
<picture>
|
|
104
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Pedro-g-Lima/COSMIC_WARP/main/docs/assets/step-dark.svg">
|
|
105
|
+
<img alt="One simulate() step: the step kernel, the multi-body reduction, the optional trajectory store and auto-reset, and the trajectory index. Inside the step kernel, per entity: episode counter, terminated check, thruster wrench, integration stages (forces, torques, wheel momenta), store, termination check." src="https://raw.githubusercontent.com/Pedro-g-Lima/COSMIC_WARP/main/docs/assets/step-light.svg">
|
|
106
|
+
</picture>
|
|
107
|
+
|
|
108
|
+
## Learning through the dynamics
|
|
109
|
+
|
|
110
|
+
`DiffVecEnv` runs short windows of steps on torch's autograd graph, so a
|
|
111
|
+
loss built from the rewards differentiates through the policy and the
|
|
112
|
+
dynamics at every step — the gradient a first-order method such as SHAC
|
|
113
|
+
uses (example 17).
|
|
114
|
+
|
|
115
|
+
<picture>
|
|
116
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Pedro-g-Lima/COSMIC_WARP/main/docs/assets/learning-dark.svg">
|
|
117
|
+
<img alt="One DiffVecEnv window: H steps of one environment from the carried, detached state; a policy shared by every step maps observations to actions; rewards go into the trainer's loss, and backward runs through every step back to the start of the window." src="https://raw.githubusercontent.com/Pedro-g-Lima/COSMIC_WARP/main/docs/assets/learning-light.svg">
|
|
118
|
+
</picture>
|
|
119
|
+
|
|
120
|
+
## Installation
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pip install cosmic-warp
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Optional extras (quote the brackets):
|
|
127
|
+
|
|
128
|
+
| Extra | Adds |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| `torch` | PyTorch: torch views, differentiable RL |
|
|
131
|
+
| `rsl-rl`, `skrl`, `rl-games` | the trainer adapters (each pulls in torch) |
|
|
132
|
+
| `examples` | matplotlib for the example scripts |
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install "cosmic-warp[torch,skrl]"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The examples and tests live in the repository; to run them, install from a
|
|
139
|
+
clone:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git clone https://github.com/Pedro-g-Lima/COSMIC_WARP.git
|
|
143
|
+
cd COSMIC_WARP
|
|
144
|
+
pip install -U pip # the dependency groups below need pip 25.1
|
|
145
|
+
pip install -e ".[examples]"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
A CUDA GPU is the intended target; everything also runs on the CPU
|
|
149
|
+
(`device="cpu"`; the default is `"cuda"`, with no automatic fallback). See
|
|
150
|
+
[Getting started](https://pedro-g-lima.github.io/COSMIC_WARP/getting-started/).
|
|
151
|
+
|
|
152
|
+
## Quick start
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from cosmic_warp.core.pipeline import SpacecraftSimulator
|
|
156
|
+
|
|
157
|
+
# 1000 spacecraft in low Earth orbit, drawn from the default reset bounds
|
|
158
|
+
sim = SpacecraftSimulator(num_envs=1000, integrator="rk4", dt=1.0)
|
|
159
|
+
sim.reset()
|
|
160
|
+
|
|
161
|
+
trajectory = sim.simulate(num_steps=600, save_states=True)
|
|
162
|
+
positions = trajectory["positions"].numpy() # [num_steps, num_envs, 3]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Whole scenarios (physics, per-body vehicles and actuators, reset bounds,
|
|
166
|
+
initial conditions) can be defined in YAML (this file ships with the
|
|
167
|
+
repository; run from its root):
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from cosmic_warp.core.config import create_simulator_from_yaml
|
|
171
|
+
|
|
172
|
+
sim = create_simulator_from_yaml("examples/multibody_orbit.yaml")
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Continue with [Getting started](https://pedro-g-lima.github.io/COSMIC_WARP/getting-started/)
|
|
176
|
+
and the [YAML reference](https://pedro-g-lima.github.io/COSMIC_WARP/guides/configuration/).
|
|
177
|
+
|
|
178
|
+
## Examples
|
|
179
|
+
|
|
180
|
+
Seventeen scripts in [`examples/`](https://github.com/Pedro-g-Lima/COSMIC_WARP/tree/main/examples/), run from the repository root
|
|
181
|
+
(`python examples/<name>.py --help`):
|
|
182
|
+
|
|
183
|
+
| Topic | Examples |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| Orbits and integrators | 01 basic orbit, 02 integrator comparison, 05 energy conservation, 08 J2 |
|
|
186
|
+
| Batches | 03 Monte Carlo, 04 scalability, 09 multi-body, 10 domain randomization |
|
|
187
|
+
| Actuators | 06 thrusters, 07 reaction wheels |
|
|
188
|
+
| Gradients | 11 trajectory optimization, 12 system identification |
|
|
189
|
+
| Reinforcement learning | 13 environment, 14–16 PPO with rsl_rl / skrl / rl_games, 17 SHAC |
|
|
190
|
+
|
|
191
|
+
The [examples gallery](https://pedro-g-lima.github.io/COSMIC_WARP/examples/) shows each
|
|
192
|
+
script with its plots and explanation.
|
|
193
|
+
|
|
194
|
+
## Documentation
|
|
195
|
+
|
|
196
|
+
| Section | Contents |
|
|
197
|
+
| --- | --- |
|
|
198
|
+
| [Getting started](https://pedro-g-lima.github.io/COSMIC_WARP/getting-started/) | Install, verify Warp, first orbit |
|
|
199
|
+
| [Guides](https://pedro-g-lima.github.io/COSMIC_WARP/guides/) | Configuration, vehicles, actuators, resets, physics, running, scaling, RL, differentiable simulation |
|
|
200
|
+
| [Examples](https://pedro-g-lima.github.io/COSMIC_WARP/examples/) | One page per example script |
|
|
201
|
+
| [Theory](https://pedro-g-lima.github.io/COSMIC_WARP/theory/) | Conventions, dynamics, gravity and J2, environment, actuators, integrators, sampling, GPU execution, gradients |
|
|
202
|
+
| [Validation](https://pedro-g-lima.github.io/COSMIC_WARP/validation/) | What the test suite checks, against which results |
|
|
203
|
+
| [Benchmarks](https://pedro-g-lima.github.io/COSMIC_WARP/benchmarks/) | Measured throughput per GPU |
|
|
204
|
+
| [API reference](https://pedro-g-lima.github.io/COSMIC_WARP/reference/api/cosmic_warp/) | Generated from the docstrings |
|
|
205
|
+
| [Roadmap](https://pedro-g-lima.github.io/COSMIC_WARP/roadmap/) | Planned for 1.x and beyond |
|
|
206
|
+
|
|
207
|
+
## Testing and benchmarks
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pip install -e . --group dev # pinned test tools (pip >= 25.1)
|
|
211
|
+
pytest # full suite on CUDA
|
|
212
|
+
pytest --device cpu # the same suite without a GPU
|
|
213
|
+
pytest -m "not slow" # skip the end-to-end training tests
|
|
214
|
+
|
|
215
|
+
python benchmarks/bench.py --save # record this GPU's baseline (first run)
|
|
216
|
+
python benchmarks/bench.py # compare; exit 1 on a >15 % regression
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Contributing
|
|
220
|
+
|
|
221
|
+
Contributions are welcome — see [CONTRIBUTING.md](https://github.com/Pedro-g-Lima/COSMIC_WARP/blob/main/CONTRIBUTING.md). For
|
|
222
|
+
questions, bugs and feature requests, open an
|
|
223
|
+
[issue](https://github.com/Pedro-g-Lima/COSMIC_WARP/issues).
|
|
224
|
+
|
|
225
|
+
## Citation
|
|
226
|
+
|
|
227
|
+
If you use COSMIC WARP in your research, please cite it (GitHub's "Cite this
|
|
228
|
+
repository" uses [`CITATION.cff`](https://github.com/Pedro-g-Lima/COSMIC_WARP/blob/main/CITATION.cff)):
|
|
229
|
+
|
|
230
|
+
```bibtex
|
|
231
|
+
@software{cosmic_warp,
|
|
232
|
+
title = {COSMIC WARP: GPU-Accelerated Spacecraft Simulator},
|
|
233
|
+
author = {Lima, Pedro and Arora, Aman},
|
|
234
|
+
year = {2026},
|
|
235
|
+
version = {0.1.0},
|
|
236
|
+
url = {https://github.com/Pedro-g-Lima/COSMIC_WARP}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Please also cite the tools it builds on, in particular NVIDIA Warp. BibTeX
|
|
241
|
+
for these and for every source behind the physics models is on the
|
|
242
|
+
[references page](https://pedro-g-lima.github.io/COSMIC_WARP/references/).
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
[Apache License 2.0](https://github.com/Pedro-g-Lima/COSMIC_WARP/blob/main/LICENSE).
|
|
247
|
+
|
|
248
|
+
## Acknowledgements
|
|
249
|
+
|
|
250
|
+
COSMIC WARP is developed by the SpaceR research group at SnT, University of
|
|
251
|
+
Luxembourg.
|