End-to-End Autonomous Generation of Human Assembly Plans

https://github.com/IDEALLab/AssembleX/tree/main

ReadMe:

AssembleX 会分析一个由多个零件组成的 CAD 装配体(例如由 AI CAD 工具生成的),并找出其组装方法。如果可以组装,AssembleX 会生成一份带插图的装配手册;如果无法组装,它会说明是哪一个零件导致了问题,以及需要进行哪些修改。

对于每个装配体,它会:

  1. 检查零件。每个零件都必须是封闭的实体;微小间隙会自动修复,而重叠的零件会被报告出来。

  2. 规划装配顺序。它会寻找一种能够将零件拆解(从而组装)的顺序,并在物理模拟器中检查每个步骤的碰撞情况、重力下的稳定性以及必须握持的零件数量。

  3. 生成结果。生成一份 PDF 手册,其中每个步骤包含一页插图和由视觉语言模型生成的操作说明;同时生成组装动画;若设计无法组装,则生成反馈 PDF,其中每个问题占一页。

规划是在 RedMax 物理模拟器上通过 ASAPx 运行的,ASAPx 是 ASAP 序列规划器的分支。

Installation:

以下四个编号步骤是受支持的安装路径。setup.sh 会一次性执行步骤 1 到 3。

Before starting, make sure you have:

  • Linux, or Windows with WSL.
  • Conda (Miniconda or Miniforge).
  • cmake and a C++ toolchain (build-essential or g++) to build RedMax.
  • An OpenAI API key, needed only for naming, instructions and feedback text.

1. Clone the repository and fetch the planner backend

python 复制代码
git clone https://github.com/IDEALLab/AssembleX.git
cd AssembleX
git submodule update --init --recursive ASAPx

2. Create the conda environment

python 复制代码
conda env create -f environment.yml
conda activate assemblex

3. Build the RedMax physics binding

python 复制代码
cd ASAPx/simulation
python setup.py install
cd ../..

If g++ fails, run sudo apt update && sudo apt install build-essential and retry. To confirm the simulator built correctly:

python 复制代码
cd ASAPx && python test_sim/test_simple_sim.py --model box/box_stack --steps 2000 && cd ..

4. Provide your OpenAI API key

The key is read from the OPENAI_API_KEY environment variable or from a .env file in the repository root (OPENAI_API_KEY=sk-...).

Quick start

python 复制代码
export OPENAI_API_KEY="sk-..."
python main.py run_pipeline --input path/to/my_assembly

my_assembly is a folder with one mesh file per part, or a single file holding the whole assembly (see Input). The results land in output/my_assembly/; start with summary.json, then manual.pdf or feedback.pdf. The run ends with an overview of the same.

my_assembly 是一个文件夹,其中每个零件对应一个网格文件,或者是一个包含整个装配体的单一文件(参见"输入"部分)。结果保存在 output/my_assembly/ 目录下;文件名以 summary.json 开头,随后是 manual.pdf 或 feedback.pdf。运行结束时会显示相关结果的概述。

To try it without your own model, run the seven-part example that ships with the repository:

python 复制代码
python main.py run_pipeline                # results in output/04489/
python main.py run_pipeline --plan-only    # the same without an API key

Usage

python 复制代码
python main.py run_pipeline --input <file or folder> [options]
python main.py run_pipeline --help        # every option
python 复制代码
assembly selection (datasets under assets/):
  --id ID               assembly id (00042), inclusive range (00010-00050) or comma-separated list. Omit to use the
                        assembly shipped with the repository (04489).
  --dir DIR             directory holding the assemblies, resolved under assets/ (default: data)
  --storage-dir STORAGE_DIR
                        directory for the assembly's plan, renders and caches (default: <out>/<id>/internal/; research
                        commands: assets/assembly_cache/<dir>/<id>/)
  --min-parts MIN_PARTS
                        minimum number of parts in included assemblies (only for --id ranges)
  --max-parts MAX_PARTS
                        maximum number of parts in included assemblies (only for --id ranges)
  --balance-parts N     keep at most N assemblies per distinct part count, so every assembly size in the --id range is
                        equally represented. Implies --sort-by-parts.
  --sort-by-parts       process assemblies in ascending order of part count instead of by id
  --sample-seed SEED    draw each part-count's candidates in a seeded random order instead of by ascending id
  --exclude-ids IDS     comma-separated assembly ids to hold out of --id selection (e.g. a training split)

pipeline stages (all on by default):
  --plan-only           only plan and render the disassembly; no LLM/VLM calls, manual, feedback or video
  --no-manual           skip step instructions, manual pages and manual.pdf
  --no-feedback         skip failure feedback for assemblies that cannot be planned
  --no-video            skip the stitched assembly GIF
  --interactive         show detected part overlaps in a viewer and ask before planning
  --user                pick tool axes interactively instead of with the AI selector
  --tool-check          ask the VLM, per part, which tool (if any) installing it needs; cached in
                        storage_dir/tool_decisions.json. With --seq-tool-check the planner then only tries that tool
                        for the part.

sequence planning:
  --planner PLANNER     ASAPx planner: heuristic (default), dfa, dfa-random, dfs, beam, randseq, gen-adapter
  --generator GENERATOR
                        ASAPx candidate generator: rand (default), heur-vol, heur-out, learn, dfa
  --subassemblies       also build the recursive subassembly plan (prefix -> split -> S -> R). On the pipeline
                        commands this turns --plan-arm on, so the plan is only used where it is predicted faster
                        (settings.subassembly_only_if_faster).
  --plan-arm, --no-plan-arm
                        run the arm pipeline after planning: predicted assembly time (log/timing_overview.json;
                        settings.arm_simplified_mode). Default: on with --subassemblies on the pipeline commands, off
                        otherwise.
  --budget BUDGET       maximum number of feasibility checks per plan (default: 6000)
  --max-grippers MAX_GRIPPER, --max-gripper MAX_GRIPPER
                        max parts held fixed during one step, incl. the moving one (default: 3)
  --num-proc NUM_PROC   worker processes for planning; run_pipeline_batch shares them between assemblies (default: CPU
                        count, 20)
  --render-num-proc RENDER_NUM_PROC
                        worker processes for rendering the step GIFs (default: 20)
  --seed SEED           random seed
  --allow-gap           allow small gaps between parts in the stability check (IKEA-style assemblies)
  --connect-path        extend disassembly paths to place each part on the ground next to the assembly
  --use-previous-sdf    reuse the SDFs saved next to the meshes instead of regenerating them
  --seq-tool-check      during planning, require for every step that a tool can be placed on the moving part without
                        colliding with the rest (geometric, no VLM calls)
  --gripper-type {panda,robotiq-85,robotiq-140,rod}
                        contact model of the arm pipeline (settings.contact_model='rod' forces rod)
  --gripper-scale GRIPPER_SCALE
                        uniform scale of the gripper and arm meshes

run control:
  --replan              discard the assembly's cached plan, renders and part names (its storage directory) and start
                        from scratch
  --token-limit TOKEN_LIMIT
                        LLM token budget for the whole run; later LLM calls are skipped once it is used up
  --verbose VERBOSE     verbosity (0=off, 1=info, 2=debug, 3=trace)

Input

  • One file per part: a folder of .obj, .stl, .ply or .off files. The file names are passed to the part naming as hints.
  • One file for the whole assembly: a .glb, .gltf, .step or .stp file; it is split into its bodies.

All parts must be in one coordinate frame, in their assembled positions, and should be closed solids (watertight). The units do not matter: the assembly is rescaled internally. Your files are never modified.

所有零件必须位于同一个坐标系中,处于装配位置,并且应为封闭实体(无孔洞)。单位不限:装配体将在内部进行缩放。您的文件绝不会被修改。

Options

Every stage runs by default. These switch stages off or add optional ones:

Running again

A second run on the same input reuses the plan, the renders and the part names, and only rewrites the documents. When you edit any part file, the next run notices and starts over by itself; --replan forces that.

对同一输入进行第二次运行时,会复用计划、渲染结果和零件名称,仅重写文档。当您编辑任何零件文件时,下次运行会自动检测到这一变化并重新开始;使用 --replan 选项可强制执行此操作。

Datasets

Assemblies of a dataset under assets/<dir>/<id>/ are selected with --id (a single id, a range 00010-00050 or a list 00042,00107) and --dir (default data). run_pipeline_batch --id 00000-00100 runs many of them in parallel. For datasets, see the ASAP download links in ASAPx/README.md.

Outputs

Each assembly gets a folder output/<name>/:

复制代码
output/<name>/
├── summary.json                # outcome, parts (file -> name), steps, overlaps, links
├── manual.pdf                  # the assembly manual (when the design can be assembled)
├── manual/page_01.png, ...     # its pages as images
├── assembly_instructions.txt   # the step instructions as text
├── assembly.gif                # the assembly, animated
├── feedback.pdf                # one page per problem (when there are problems)
├── feedback/                   # the feedback pages as images + feedback.json
└── internal/                   # plan, renders, preprocessed meshes, caches

How it works

python 复制代码
your CAD export
   │
   ▼
core/preprocess.py ─────► closed, normalised part meshes (output/<name>/internal/meshes)
   │
   ▼
core/assembly.py (Eval, Assembly) ── run_pipeline.py drives the stages
   │
   ├─ core/collision_checker.py ─► overlapping parts
   ├─ core/feedback_generator.py ► part names
   ├─ core/sequence_planner.py ──► ASAPx: sequence search in the RedMax simulator,
   │                               then rendering ── tree.pkl + stats.json
   ├─ core/manual_generator.py ──► manual pages, manual.pdf
   └─ core/feedback_generator.py ► step instructions, feedback pages, feedback.pdf

docs/ARCHITECTURE.md describes the modules, the data that passes between them and the planner backend in more detail.

Project Structure

python 复制代码
AssembleX/
├── main.py                 # command line: run_pipeline, run_pipeline_batch, rerender
├── run_pipeline.py         # the pipeline stages, summary and batch runner
├── run_common.py           # assembly-id selection helpers
├── settings.py             # configuration (main / advanced / debug)
├── setup.sh                # convenience installer (install steps 1-3)
├── core/                   # the pipeline
│   ├── preprocess.py       # CAD export -> closed, normalised part meshes
│   ├── assembly.py         # Eval / Assembly, workspace handling
│   ├── models.py           # Object, Step, Tool, LLM response schemas
│   ├── sequence_planner.py # SequencePlanner (wraps ASAPx)
│   ├── collision_checker.py   # static overlap check
│   ├── renderer.py         # part images, overlap views, assembly animation
│   ├── feedback_generator.py  # part naming, step instructions, feedback
│   ├── manual_generator.py    # manual pages and PDF
│   ├── tool_analyzer.py    # tool decisions and placement
│   ├── prompts.py          # every LLM/VLM system prompt
│   └── llm.py              # OpenAI client helpers
├── ASAPx/                  # planner backend (fork of ASAP) and RedMax simulator
├── research/               # benchmarks, weight training, diagnostics (python -m research)
├── tests/                  # CLI, preprocessing and end-to-end tests
├── docs/ARCHITECTURE.md    # how the code fits together
├── assets/
│   ├── data/04489/         # the example assembly
│   └── tools/              # tool catalog
├── environment.yml         # conda environment (name: assemblex, python 3.11)
└── pyproject.toml          # packaging, ruff and mypy configuration

Research tooling

规划器评估背后的代码位于 research/ 目录下,使用该管道时无需使用这些代码:规划器基准测试、启发式权重训练与评估、手动验证和诊断。其运行方式为 python -m research <命令>;运行 python -m research --help 可列出所有命令。这些命令针对 assets/ 目录下已经过预处理的数据集进行操作,并将规划结果缓存到 assets/assembly_cache/ 目录下。

Contributing

Contributions are welcome through issues and pull requests. The code follows ruff with line-length = 88 and the rule sets configured in pyproject.toml; the ASAPx/ submodule is excluded. Run ruff check . before submitting, and keep emojis and decorative formatting out of code and markdown. The development extras (ruff, mypy, pytest, pre-commit) install with pip install -e ".[dev]". Run the tests with python -m pytest tests/; tests/test_smoke.py runs the pipeline end to end (a few minutes, no API key needed).

相关推荐
Wellijohn40 分钟前
2000 个请求、30% 失败率:我把 Python 批量并发的限流和重试参数算了一遍
后端·python·性能优化
Logintern093 小时前
deep agents 多智能体模式——规划与委派
python·langchain
2601_967980114 小时前
Python 办公自动化合集 ⑰:Excel自动计算——总和/平均分/最大值
python·pycharm·办公自动化·数据处理·excel自动计算
databook6 小时前
时间序列预测,模型换了一圈为什么没变好
python·数据分析
reasonsummer7 小时前
【教学类-07-17】20261119大3班破译电话号码HTML实际操作(添加“跳过按钮”和“返回按钮”在底部、增加“自编题目+解题”部分)
python·html
2601_9679801110 小时前
Python闭包(Closure)详解
python·作用域·装饰器·函数式编程·闭包
AI创界者10 小时前
ComfyUI 进阶实战:MiniMax-H3 视频人物脸部替换工作流全解析(对比 Face 5.5 实测与避坑指南)
人工智能·python·aigc
承渊政道11 小时前
【Python编程快速上手—让繁琐工作自动化】(模式匹配与正则表达式:从找到一个号码到批量提取信息)
python·正则表达式·pycharm·自动化·模式匹配
JonaHu11 小时前
AceDataCloud Coding Plan 多模型编程:从 Chat Completions 迁移到 Responses API 与工具调用
python·大模型·api·ai编程·acedatacloud