e2m2e — Earth to Moon, Moon to Earth
e2m2e 是面向地月空间任务规划的算法工具集基础设施。在“LLM+Agent”式自主任务规划系统中,大模型负责理解任务意图、分解与编排子任务,e2m2e 负责提供精确可靠的轨道计算工具:建立地月空间的动力学模型,生成周期轨道族,设计轨道之间的转移路径,并把结果画出来检查。
安装
用 uv 安装:
uv pip install e2m2e
发布物覆盖 Windows x86_64、Linux x86_64 与 Linux aarch64(arm64,如鲲鹏/飞腾/树莓派)的 wheel;其余平台从源码构建。
在自己的项目中使用:
uv init my-project && cd my-project
uv add e2m2e
从源码开发(需要 Rust 工具链,用于构建积分器内核):
git clone https://github.com/cislunarspace/e2m2e.git
cd e2m2e
uv sync
make setup # 拉取 CSPICE 编译包 + SPICE 内核(cspice-v1 / kernels-v1 release,首次必跑)
make dev # maturin develop 构建并安装 Rust 扩展(spice 默认开启)
SPICE 内核
星历动力学需要 NASA SPICE 内核文件。本项目测试所需的全部内核(行星星历、地球自转、月球姿态、闰秒与行星常数)已打包在 GitHub Release 的 kernels-v1 中。三种配置方式:
- 自动配置(推荐):
make setup下载并放入kernels/(见scripts/download_kernels.py)。 - 手动下载:从 Release 下载
kernels-v1,解压到kernels/目录。 - 自备数据:使用自己的内核文件,放入
kernels/目录,或将$SPICE_KERNEL_DIR指向其所在路径。
官方来源:NASA NAIF。
快速开始
设计一条地月 L2 Halo 轨道(需先完成上方「SPICE 内核」配置):
from e2m2e.api import Facade
facade = Facade()
result = facade.design_orbit(
orbit_type="Halo",
collinear_point=2,
amplitude=30000.0,
epoch=[2024, 1, 1, 0, 0, 0.0],
duration=365.25 * 86400.0,
)
print(result.orbit_type)
print(result.initial_state)
参数含义、返回字段与其他轨道类型见在线文档;可运行示例见 examples/ 目录。
能力
已建成与未建成的部分按领域列出。详细的能力清单与 API 文档见在线文档;逐版本变更见 CHANGELOG.md。
时空系统
- 坐标系转换:J2000 / ITRF93(SPICE 高精度)/ IAU 2006,GMAT 兼容的原生 ITRF,动态坐标轴 VNB / LVLH。
- 时空联合转换:TDT+GCRS ↔ TDB+EBCRS(r2s2 后端,含相对论项)。
- SPICE 星历与时间管理:内核加载、UTC / TDB / TAI 时间尺度、天体状态与帧旋转查询。
积分器与动力学
- Rust 积分器内核:单步 RK(PD45 / PD78 / RK89)、Adams 多步、Störmer–Cowell 二阶积分;状态转移矩阵(STM)传播;事件检测(terminal / direction 语义)。
- 动力学模型:CR3BP(快速设计)、星历 N 体(SPICE,精确外推)、含太阳解析摄动的 BCR4BP,以及三者之间的转换。
- 高精度力模型:点质量与第三体引力、球谐重力场(含固体潮)、ECOM 9 系数光压、大气阻力、太阳光压、连续推力,传播精度与 GMAT、DFH 对齐到亚百米级。
任务轨道设计
- 周期轨道族:DRO、Halo、Lyapunov、Lissajous、共振轨道(RO)、DPO、Axial、三角平动点 SPO / LPO、Horseshoe。
- 数值算法:微分修正、多重打靶、延拓;全链路 CR3BP 初猜 → 星历修正 → 高精度预报。
- 名义轨道契约(NominalOrbit):等间距状态表 + Floquet 基 + 投影因子,供轨道保持直接消费。
转移轨道设计
- 脉冲转移:Lambert 求解与 porkchop 扫描、多脉冲优化(Lawden 主矢量检验)、霍曼直接转移(HMN)。
- 低能量转移:月球引力辅助(LGA)、WSB 太阳引力辅助弹道捕获、不变流形与庞加莱截面拼接。
- 低推力转移:Q-law 初猜 + 打靶 / 配点。
- 网格搜索 + 非线性规划两步法(Rust Rayon 并行)。
轨道控制
- 三种控制律:特征点、目标点严格、目标点宽松;蒙特卡洛测定轨与推力误差仿真。
- 角动量管理:姿态发动机联合控制。
接口与工具
- Facade 任务级入口,统一对外调用面。
- 未建成:MCP 服务化封装——Facade 方法的元数据与派生机制已就位,
create_server/e2m2e mcp-serve尚为占位([mcp]extra)。
文档
在线文档:https://cislunarspace.github.io/e2m2e/
本地构建:
uv sync --group docs
uv run sphinx-build -b html docs docs/_build/html
测试与代码规范
make test # Rust 测试 + Python xdist 并行测试(需先 make setup 拉内核)
make check # cargo fmt/clippy + ruff
测试按“验证什么”分七类,目录镜像源码结构:
theory:数学公式与物理理论(解析解、Jacobi 常数等守恒量、文献公式)integrator:积分器对解析轨道的精度force:力模型的加速度与雅可比data:内核、参考帧、物理常数等数据层orchestration:设计、修正、转移等算法编排链路interface:Facade API 的校验、响应与错误翻译aux:日志等辅助工具
断言来自解析解、守恒量与文献公式,不与其他软件对照。Rust 侧数值方法在 crates/*/tests/ 对解析解。
贡献
- Fork 本仓库
- 创建功能分支 (
git checkout -b feature/amazing-feature) - 提交更改 (
git commit -m 'Add amazing feature') - 推送到分支 (
git push origin feature/amazing-feature) - 开启 Pull Request
引用
@software{e2m2e,
title = {e2m2e: Earth to Moon, Moon to Earth Transfer Orbit Design Library},
author = {ouyangjiahong},
email = {ouyangjiahong22@nudt.edu.cn},
url = {https://github.com/cislunarspace/e2m2e},
version = {5.6.10},
year = {2026},
}
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file e2m2e-5.6.10.tar.gz.
File metadata
- Download URL: e2m2e-5.6.10.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac157abcd37a91be1dfe37a045f5bfcc7eeaf94476e5c8b15823884a3628906b
|
|
| MD5 |
2a662758418e29baafccedcee14c9dba
|
|
| BLAKE2b-256 |
b484d4ffe67fda4e42d0992cce94372d07ae3846b4714f6a961c4425cd733a6a
|
Provenance
The following attestation bundles were made for e2m2e-5.6.10.tar.gz:
Publisher:
release.yml on cislunarspace/e2m2e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
e2m2e-5.6.10.tar.gz -
Subject digest:
ac157abcd37a91be1dfe37a045f5bfcc7eeaf94476e5c8b15823884a3628906b - Sigstore transparency entry: 2467052478
- Sigstore integration time:
-
Permalink:
cislunarspace/e2m2e@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Branch / Tag:
refs/tags/v5.6.10 - Owner: https://github.com/cislunarspace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Trigger Event:
push
-
Statement type:
File details
Details for the file e2m2e-5.6.10-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: e2m2e-5.6.10-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b530f4ea7e4d6b6f193387c9cb6bbbd1fb177fb7dbacefdb537efbd0d40deec
|
|
| MD5 |
76c6ab73197d3925165f3b1b50d020c2
|
|
| BLAKE2b-256 |
105ad31d0bcadf54959281ed54a02ab0f2125cfc1dbe71ca4a84037667a1544a
|
Provenance
The following attestation bundles were made for e2m2e-5.6.10-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on cislunarspace/e2m2e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
e2m2e-5.6.10-cp310-abi3-win_amd64.whl -
Subject digest:
9b530f4ea7e4d6b6f193387c9cb6bbbd1fb177fb7dbacefdb537efbd0d40deec - Sigstore transparency entry: 2467052496
- Sigstore integration time:
-
Permalink:
cislunarspace/e2m2e@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Branch / Tag:
refs/tags/v5.6.10 - Owner: https://github.com/cislunarspace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Trigger Event:
push
-
Statement type:
File details
Details for the file e2m2e-5.6.10-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: e2m2e-5.6.10-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e280530365dc7d501080f63df7e330a3f68b42c088f8957ec5bf41de74ffe86a
|
|
| MD5 |
aa351066300b4aaf803569d768368a3b
|
|
| BLAKE2b-256 |
1a7b70565eec2b591f45de61a73446ce2ae5698c5a3b59378d1231f7a76cc04d
|
Provenance
The following attestation bundles were made for e2m2e-5.6.10-cp310-abi3-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on cislunarspace/e2m2e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
e2m2e-5.6.10-cp310-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
e280530365dc7d501080f63df7e330a3f68b42c088f8957ec5bf41de74ffe86a - Sigstore transparency entry: 2467052503
- Sigstore integration time:
-
Permalink:
cislunarspace/e2m2e@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Branch / Tag:
refs/tags/v5.6.10 - Owner: https://github.com/cislunarspace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Trigger Event:
push
-
Statement type:
File details
Details for the file e2m2e-5.6.10-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: e2m2e-5.6.10-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4177cb787f4a6ad35b527f5f1efc2c0bf06704a18ab6c2230841d3fe5a8e523
|
|
| MD5 |
1f399d3a522e47a33bf3ffd6b8d77bf3
|
|
| BLAKE2b-256 |
22b6204b1e7393ea3faae9caacb23e45bebfe3ca163791987875a8b0682007cc
|
Provenance
The following attestation bundles were made for e2m2e-5.6.10-cp310-abi3-manylinux_2_28_aarch64.whl:
Publisher:
release.yml on cislunarspace/e2m2e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
e2m2e-5.6.10-cp310-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
b4177cb787f4a6ad35b527f5f1efc2c0bf06704a18ab6c2230841d3fe5a8e523 - Sigstore transparency entry: 2467052518
- Sigstore integration time:
-
Permalink:
cislunarspace/e2m2e@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Branch / Tag:
refs/tags/v5.6.10 - Owner: https://github.com/cislunarspace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca4b960ad20d97baa6fda8fa811aba84e6199523 -
Trigger Event:
push
-
Statement type: