Skip to main content

e2m2e — Earth to Moon, Moon to Earth

License: Apache 2.0 Python Version PyPI CI GitHub stars Rust: stable

e2m2e 是面向地月空间任务规划的算法工具集基础设施。在“LLM+Agent”式自主任务规划系统中,大模型负责理解任务意图、分解与编排子任务,e2m2e 负责提供精确可靠的轨道计算工具:建立地月空间的动力学模型,生成周期轨道族,设计轨道之间的转移路径,并把结果画出来检查。

安装

uv 安装:

uv pip install e2m2e

在自己的项目中使用:

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 Releasekernels-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/ 对解析解。

贡献

  1. Fork 本仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 开启 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.8},
  year = {2026},
}

License

Apache 2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

e2m2e-5.6.8.tar.gz (3.4 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

e2m2e-5.6.8-cp310-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

e2m2e-5.6.8-cp310-abi3-manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

File details

Details for the file e2m2e-5.6.8.tar.gz.

File metadata

  • Download URL: e2m2e-5.6.8.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

Hashes for e2m2e-5.6.8.tar.gz
Algorithm Hash digest
SHA256 5c53271000c4eb787951d466569a9f11a5d08ace9c6fb46364b04ed65f7f10cf
MD5 efad6a72651fa65566fa8cd4989d9424
BLAKE2b-256 f407c564cd591e16b14742aad45f2c42dac92af9ccd3771491aa8551b2cd8d38

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.6.8.tar.gz:

Publisher: release.yml on cislunarspace/e2m2e

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file e2m2e-5.6.8-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: e2m2e-5.6.8-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.5 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

Hashes for e2m2e-5.6.8-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 45a069299d9705633ffd5bb5f4cfa3e5fdfc1f04d5789835a52a22c9b7caa022
MD5 3a2054af8b16b07ef65c4bfb6c3428b0
BLAKE2b-256 8f4d287fedee3924ba8ff70129210cfd418b36886f8b94d0dd7dca2f96cf169f

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.6.8-cp310-abi3-win_amd64.whl:

Publisher: release.yml on cislunarspace/e2m2e

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file e2m2e-5.6.8-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for e2m2e-5.6.8-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db5e4619bbe5c352f02291e1a0c5f020096e2b7986b8e6d81b4982c7a21c7a3d
MD5 525934a97674615bbf2d7762b821a1d7
BLAKE2b-256 238430d9738baf05e01080cd114733e365e25622ae2729162983afcc6a5a1aba

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.6.8-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on cislunarspace/e2m2e

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

5.8.6

4 files

5.8.5

4 files

5.8.4

4 files

5.8.3

4 files

5.8.2

4 files

5.8.1

4 files

5.8.0

4 files

5.7.3

4 files

5.7.2

4 files

5.7.1

4 files

5.6.10

4 files

5.6.9

4 files

This release

5.6.8 This release

3 files

5.6.7

3 files

5.6.6

3 files

5.6.5

3 files

5.6.4

3 files

5.6.3

3 files

5.6.2

3 files

5.6.1

3 files

5.6.0

3 files

5.5.0

3 files

5.3.1

3 files

5.2.0

3 files

5.1.0

3 files

5.0.0

2 files

4.2.0

2 files

4.1.0

2 files

4.0.0

2 files

3.1.11

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page