Skip to main content

e2m2e — Earth to Moon, Moon to Earth

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

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 1.98.0 工具链,仓库通过 rust-toolchain.toml 固定版本,用于构建积分器内核):

git clone https://github.com/cislunarspace/e2m2e.git
cd e2m2e
make dev     # 唯一入口:同步依赖 + 拉取 CSPICE 编译包与 SPICE 内核 + 构建安装 Rust 扩展(spice 默认开启)

Windows 安装 make

Windows 默认不提供 make。可使用 Scoop 安装;在 PowerShell 中依次执行:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
scoop install make

安装完成后重开 PowerShell,回到仓库目录执行 make dev(唯一入口:同步依赖 + 拉取数据 + 构建安装,见上方)。若已安装 Scoop,只需执行 scoop install make

Windows 上运行 Rust 测试请使用 make test-rust:测试二进制依赖 Python 的 python3.dll,该 DLL 在 Python 安装根目录而不在虚拟环境 Scripts/;Makefile 会自动探测并加入测试进程 PATH。若自动探测失败,可显式执行 make test-rust PYTHON_DLL_DIR=<含 python*.dll 的目录>。手工排查时先对失败的测试 EXE 执行 dumpbin /DEPENDENTSdumpbin /IMPORTS,确认实际缺失的 DLL,不要把 CSPICE 的 lib/(静态库目录)加入 PATH。

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.8.3},
  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.8.3.tar.gz (3.6 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.8.3-cp310-abi3-win_amd64.whl (5.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

e2m2e-5.8.3-cp310-abi3-manylinux_2_28_x86_64.whl (5.8 MB view details)

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

e2m2e-5.8.3-cp310-abi3-manylinux_2_28_aarch64.whl (5.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

File details

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

File metadata

  • Download URL: e2m2e-5.8.3.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for e2m2e-5.8.3.tar.gz
Algorithm Hash digest
SHA256 8f1a8538a32fc3037d71a42e1c0b8fdb402d05f42490a83dd7ecf80afe280ce2
MD5 047e10145d1d80875a683e692a4c823f
BLAKE2b-256 65a777a155d5dad0c4359c0e2a1fb8037d70f508944c8e4adf8b5b219dfb819d

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.8.3.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.8.3-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: e2m2e-5.8.3-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.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.8.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 59082f400e6d71fa7edf4f5eea0ab5419d48e7a5237d4a3470d1a2f45e63edd4
MD5 39dd9c32960b3ed1713e0e4a1584dbf9
BLAKE2b-256 c1867f8ff902045343a04e7f815b1d933abbd88db7e82f63e7880e5cebfa37c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.8.3-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.8.3-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for e2m2e-5.8.3-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 19507a85e76212d02833bd1b975d1317ec4e64781ab5ea32407739dfd77b8f8d
MD5 f8a1bc99960979a8cdcc3e5b0b04edaa
BLAKE2b-256 7762b09535c6dff2650d180cef813e263ce676fb3cb7d0fb28465e7107ce0790

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.8.3-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.

File details

Details for the file e2m2e-5.8.3-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for e2m2e-5.8.3-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1e2480003ee624fe9500b79cc30d399c6c361d9dd8f362b44f1a08f1b42b4a88
MD5 77b1b69558b9fbc79ec474c0a28d489b
BLAKE2b-256 ee9ca02befad42192cd6b564ef58614a52621508d39e0b654f1e35404f3791de

See more details on using hashes here.

Provenance

The following attestation bundles were made for e2m2e-5.8.3-cp310-abi3-manylinux_2_28_aarch64.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

This release

5.8.3 This release

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

5.6.8

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