Skip to main content

e2m2e — Earth to Moon, Moon to Earth

License: Apache 2.0 Python Version PyPI CI

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

安装

uv(推荐)

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

conda

e2m2e 没有 conda-forge 包,conda 用来创建和管理 Python 环境,环境内仍用 pip 安装:

conda create -n e2m2e python=3.12
conda activate e2m2e
pip install e2m2e

pip

pip install e2m2e

可选依赖(Hamiltonian 正规化流水线):

pip install e2m2e[normal-form]

SPICE 内核

星历动力学需要 NASA SPICE 内核文件,放置在 kernels/ 目录或 $SPICE_KERNEL_DIR 指定的路径。

国内用户推荐从项目的 GitHub Release 下载:kernels-v1 中打包了全部必需内核(行星星历、地球自转、月球姿态、闰秒与行星常数),下载后放入 kernels/ 目录即可。官方来源(网络可达时):NASA NAIF

快速开始

创建地月 CR3BP 系统,生成一个 DRO 轨道族:

from e2m2e.core import CR3BP_System, Orbit, CR3BP_Dynamics
from e2m2e.algorithms import DifferentialCorrection, Continuation

system = CR3BP_System(mu=0.01215, primary="earth", secondary="moon")
dynamics = CR3BP_Dynamics(system=system)

# 种子轨道
initial_state = [0.79188556619742, 0.0, 0.0, 0.0, 0.53682, 0.0]
seed_orbit = Orbit(states=[initial_state], times=[0])

# 微分修正收敛到周期轨道
corrector = DifferentialCorrection(dynamic=dynamics)
corrector.setup_2D_symmetric_x_fixed_x0(x0=initial_state[0])
seed_dro = corrector.iterate_correction(initial_guess=seed_orbit)

# 延拓生成轨道族
continuation = Continuation(corrector=corrector)
family = continuation.natural_continuation(
    seed_orbit=seed_dro,
    param_range=(0.14, 0.9),
    step_size=0.005,
)

更多示例(星历动力学、多重打靶、转移设计、可视化)见在线文档examples/ 目录。

使命与进度

航天任务规划正从“人在回路”走向自主规划。传统模式依赖地面人员逐级分解任务、调配资源,决策链条冗长,单次在轨服务任务的地面支持普遍在十余个小时。李胤慷等在《基于“LLM+Agent”的在轨服务自主任务规划技术》(上海航天,2026)中提出了新架构:大模型负责语义理解、任务分解与编排,专业算法工具负责精确计算,两者通过 MCP 协议协同,分钟级生成全流程任务规划方案。

“LLM+Agent”协同推理决策架构(李胤慷等,2026)

这套架构能否落地,关键在算法工具集。大模型是概率生成模型,自身做不了精确轨道计算,它输出的方案是否可信,取决于所调用工具的精度与可靠性。没有标准化、经过验证、可被调用的算法工具集,自主规划就是空中楼阁。

这里有一个容易产生的误解需要说清。用户把任务需求和相关信息输入大模型,大模型调用工具求解问题,最终呈现的结果并非大模型自身生成,而是工具计算得出的。大模型做的只是把工具的输出整理成便于人阅读和理解的形式。看起来像是模型直接根据输入生成了答案,实际上这些结果既不是大模型算出来的,也不是它推理出来的,而是工具的运算输出。因此,工具集的质量决定了整个系统的质量,这正是 e2m2e 要守住的地方。

算法工具集整体架构(李胤慷等,2026)

地月空间是这套范式最重要的应用场景之一,空间站、导航与通信星座、月面往返都从这里起步。e2m2e 的使命是建设地月空间方向的算法工具集基础设施,把轨道建模、轨道生成、转移设计等算法做成精确、标准化、可被上层规划系统调用的开源工具库。上图中算法封装层与接口协议层的能力,正是 e2m2e 已经建成和正在补齐的部分。

已经建成:

  • 两套动力学模型:简化三体模型(CR3BP,用于快速设计)和高精度星历模型(基于 SPICE,用于精确外推),以及两者之间的转换
  • 周期轨道族生成:DRO、Halo、Lyapunov、Lissajous、Butterfly、Dragonfly、共振轨道(RO)等,配微分修正、多重打靶、延拓等数值算法
  • 高精度力模型:点质量与第三体引力、球谐重力场(含固体潮)、大气阻力、太阳光压、连续推力,传播精度已与 GMAT、DFH 对齐到亚百米级
  • 转移轨道设计:网格搜索 + 非线性规划的两步法
  • 坐标系转换(J2000/ITRF 等,与 GMAT 兼容)和 2D/3D 可视化

正在进行和计划中的:

  • 更多轨道族:DPO、三角平动点附近的 SPO/LPO、Horseshoe 等
  • 小推力转移与 LEO/GEO 端点条件
  • Hamiltonian 正规化流水线的进一步完善(把平动点附近轨道化简为少数表征参数)
  • 面向上层规划系统的服务化封装。下一步把 e2m2e 封装为 MCP 服务器,接入下图所示的异构模型交互框架,让大模型可以像调用 Lambert、C-W 工具一样调用地月轨道算法

基于 MCP 的异构模型交互框架(李胤慷等,2026)

详细的能力清单与 API 文档见在线文档;逐版本变更见 CHANGELOG.md

文档

在线文档:https://cislunarspace.github.io/e2m2e/

本地构建:

uv sync --group docs
uv run sphinx-build -b html docs docs/_build/html

测试与代码规范

uv run pytest tests/
uv run ruff check .

贡献

  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.3.0},
  year = {2026},
}

使命叙述依据的文献:

李胤慷, 王浩, 袁容昊, 等. 基于“LLM+Agent”的在轨服务自主任务规划技术[J]. 上海航天(中英文), 2026, 43(1): 169-179. DOI: 10.19328/j.cnki.2096-8655.2026.01.016.

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.3.1.tar.gz (3.1 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.3.1-cp310-abi3-win_amd64.whl (3.9 MB view details)

Uploaded CPython 3.10+Windows x86-64

e2m2e-5.3.1-cp310-abi3-manylinux_2_28_x86_64.whl (4.2 MB view details)

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

File details

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

File metadata

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

File hashes

Hashes for e2m2e-5.3.1.tar.gz
Algorithm Hash digest
SHA256 24f8a8f93b5f1f4ca28733a3f8e246cc3c78d617ce0587fe2687d23c79bb974e
MD5 4f67fa48c2597e4b2cf39e3bfd2e1253
BLAKE2b-256 6f446069709bfea31942f8abdef714f0eea700269bafc58ae00cc0f0af5077db

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: e2m2e-5.3.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for e2m2e-5.3.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 82421e5b253835eb11dce80557708d072d5b1165839f24b7c2a7fa6744122cc5
MD5 e34b646008342ee5906b6f6409e8973c
BLAKE2b-256 d82e9d3a8b9acba4891e428c66dbb394c16ed6ba41c72f7336301b86d5142229

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for e2m2e-5.3.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 81d6b1869adc9ce7b6c27b7bc5fa600954ec636ecf8c5dcd9d8be5c0f416a625
MD5 6e65b10c726560509953ab81111fe901
BLAKE2b-256 35f8f039b3f8c6c73108dba8fce8c4f5200f2094c053e31cb2ccd4f478ff5fd0

See more details on using hashes here.

Provenance

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

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

This release

5.3.1 This release

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