SDFormat/SDF model and world authoring, validation, and simulator handoff. Use for `.sdf` files, SDFormat XML, models, worlds, links, joints, poses, frames, ine
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-sdf-9518b4eafff3 ,按照其中的说明把「sdf」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Provenance: maintained in earthtojake/text-to-cad. Use the installed local skill files as the runtime source of truth; the repository link is only for provenance and release review.
Use this skill when the deliverable is an SDFormat document. SDFormat describes simulator and world behavior: models, worlds, frames, poses, links, joints, inertials, visuals, collisions, sensors, lights, physics, plugins, includes, and simulator metadata.
This skill is for SDFormat, not signed-distance-field geometry.
The .sdf file is the source of truth: author and edit the XML directly. There is no gen_sdf() contract.
This skill's commands are thin entrypoints over the cadgen distribution, which
carries the Python build runtime and the JavaScript it executes. Install it once:
python -m pip install -r requirements.txt
Rendering additionally needs a browser, which pip cannot supply:
python -m playwright install chromium
.sdf XML directly and validate every created or modified file with cadgen sdf validate before reporting completion.version="1.12" for new outputs unless the target consumer constrains the version..sdf. Use references/design-ledger.md and references/llm-guardrails.md.relative_to / expressed_in explicitly on every nontrivial pose and axis. Implicit frame defaults are the top SDF failure mode. See references/frame-semantics.md.references/interoperability.md.gz sdf --check itself whenever gz is on PATH), simulator load, joint motion, and plugin/sensor startup.Use this skill for SDFormat outputs. Do not use it for signed-distance-field modeling, raw geometry generation, planning semantics, or to paper over incorrect upstream robot/source data unless the task is explicitly simulator-only.
After completing SDF work that creates or modifies a .sdf, you must ALWAYS hand the explicit file path to $cad-viewer when that skill is installed. $cad-viewer must start CAD Viewer if it is not already running and return link(s) to the relevant created or updated file(s); if $cad-viewer is unavailable or startup fails, report that instead of silently omitting the handoff.
.sdf and its consumers.references/frame-semantics.md before editing any <pose>, <frame>, joint axis, relative_to, expressed_in, nested scope, sensor frame, or plugin frame.references/examples.md.cadgen sdf validate; treat bundled validation as a guardrail, not simulator proof.references/smoke-tests.md).$cad-viewer. Static rendering does not execute SDF plugins or read file-authored motion metadata.Run cadgen from the Python environment this skill's requirements.txt was installed into (python -m cadgen.cli <verb> with that interpreter is the PATH-independent equivalent). cadgen doctor <skill-dir> verifies the installed cadgen matches this skill's pin — docs drift silently on a mismatched install. Validation itself needs nothing beyond the Python standard library; only snapshots need the browser. Use cadgen <verb> --help for the complete current interface.
cadgen sdf validate path/to/model.sdf
cadgen sdf validate path/to/model.sdf --strict
cadgen sdf validate path/to/model.sdf --json
cadgen sdf snapshot path/to/model.sdf review.png
The validator checks document shape, name scopes, pose/frame graphs, joints, geometry, mesh URIs, inertials, sensors, and plugins, and prints its findings plus a summary. One run validates ONE file: --strict treats warnings as failures and --json prints one line of {"ok", "path", "issues": [{"severity", "code", "message", "element", "hint"}], "summary"}, where element is the XML path. It exits nonzero if the target fails.
External checking is on by default:
cadgen sdf validate path/to/model.sdf --gz-check required
cadgen sdf validate path/to/model.sdf --gz-check never
gz sdf --check is target-consumer validation. --gz-check auto is the default: it runs when gz is on PATH, reporting gz_check_passed or the tool's own output as the error gz_check_failed, and otherwise notes info: gz_check_unavailable and carries on. An absent optional tool says nothing about the file, so it never fails a clean document and --strict does not change that. --gz-check required makes the tool mandatory — a missing gz is then an error — and --gz-check never skips it outright.
When finishing an SDF task, include a compact report:
Validated: path/to/model.sdf
Checks run:
- bundled SDF validation: passed
- gz sdf --check: skipped, gz not installed
- simulator load: skipped, target simulator unavailable
- viewer handoff: `$cad-viewer` link returned
Assumptions:
- Assumed mesh units are meters.
- Assumed lidar frame is coincident with lidar_link.
Risks:
- Camera plugin filename was not verified in the target simulator environment.
cadgen sdf snapshot renders the robot to a PNG still, using the same shared
CLI and headless browser runtime every rendering skill uses — so a snapshot matches what
the CAD Viewer shows.
cadgen sdf snapshot path/to/robot.sdf review.png
It accepts .sdf only (a format door, same TARGET [OUT] grammar as the rest). Pose the robot with --joint-values — {joint: degrees} JSON,
joints you do not name staying at the rest pose (the "jointValues" job field is the same
thing in a packet). Robots are authored in metres and are framed on the robot scene scale
automatically.
A normal snapshot uses deterministic light CAD lighting and hides grid and axis guides.
Pass --render light or --render dark (or photographic Render JSON or a file path)
for the shared Render scene. An envelope with no studio resolves Light in the CLI.
Set its camera inside Render JSON; top-level --camera, --display, and --joint-values
control normal snapshots and cannot be combined with Render. Robot link meshes have no CAD-edge or exploded assembly
topology, so those display combinations are rejected clearly.
Link meshes are resolved relative to the description, so they must be present: an
unhydrated Git LFS pointer fails as "No link mesh loaded for robot". Run
git lfs checkout <mesh dir> first.
The grammar is cadgen sdf snapshot TARGET [OUT] [flags], the same one every
format door uses. Use cadgen sdf snapshot --help for the complete current
interface — the flags a robot cannot act on are absent from it, not refused by it.
references/sdf-workflow.mdreferences/examples.mdreferences/llm-guardrails.mdreferences/design-ledger.mdreferences/frame-semantics.mdreferences/validation.mdreferences/smoke-tests.mdreferences/interoperability.md