sdf
Original:🇺🇸 English
Translated
13 scripts
SDFormat/SDF model and world generation, validation, and simulator handoff. Use for `.sdf` files, SDFormat XML, Python `gen_sdf()` sources, models, worlds, links, joints, poses, frames, inertials, visual/collision geometry, mesh URIs, sensors, lights, physics, plugins, includes, Gazebo, CAD Explorer static SDF review, or simulator-specific metadata. Do not use for signed-distance-field geometry.
11installs
Sourceearthtojake/text-to-cad
Added on
NPX Install
npx skill4agent add earthtojake/text-to-cad sdfTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →SDF
Use this skill when the deliverable is an SDFormat document or a Python source. SDFormat describes simulator and world behavior: models, worlds, frames, poses, links, joints, inertials, visuals, collisions, sensors, lights, physics, plugins, includes, and simulator metadata.
gen_sdf()This skill is for SDFormat, not signed-distance-field geometry.
Core rules
- Treat the Python file defining as source of truth. Treat configured
gen_sdf()files as generated artifacts unless the user explicitly asks for direct XML editing..sdf - Identify the target consumer before editing: Gazebo/libsdformat version, another simulator, visualization-only tooling, model package, or world handoff.
- Decide document kind: model-level SDF, world-level SDF, or model-in-world. Prefer model-level SDF for reusable robot/object exports.
- Use SI units unless the target explicitly requires otherwise: meters, kilograms, seconds, radians.
- Prefer for new outputs unless the target consumer constrains the version.
version="1.12" - Establish the design ledger before writing poses, frames, joint axes, mesh scales, inertials, sensors, or plugins. Use and
references/design-ledger.md.references/llm-guardrails.md - Do not infer spatial transforms from visual impression alone. Derive poses, axes, scale, mass, inertia, and frame names from upstream source data, drawings, simulator documentation, measured values, or explicit assumptions.
- Prefer helper functions and named constants over large XML string literals. Hidden numbers are a common SDF failure mode.
- Generate only explicit targets with or the repository's existing SDF launcher. Do not run directory-wide generation.
scripts/sdf - Regenerate upstream geometry, mesh, robot-description, render, topology, or package assets with their owning workflows before regenerating SDF that references them.
- After generation, run available checks: bundled validation, optional , simulator load, joint motion, plugin/sensor startup, and
gz sdf --checkhandoff when available.$render - Report assumptions, skipped checks, unresolved resource paths, and target-specific compatibility risks.
Scope
Use this skill for SDFormat outputs and generators. 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.
Workflow
- Locate the source and intended
gen_sdf()output..sdf - Read or create the design ledger.
- Read before editing any
references/frame-semantics.md,<pose>, joint axis,<frame>,relative_to, nested scope, sensor frame, or plugin frame.expressed_in - Edit the generator source, not generated XML.
- Use optional builder helpers when they make the generated structure clearer; raw ElementTree is still allowed.
- Regenerate the explicit target.
- Treat bundled validation as a guardrail, not simulator proof.
- Run target-consumer smoke tests when available.
- After creating or modifying output, always hand the explicit generated path to
.sdfwhen available;$renderchecks/reuses a live viewer and returns a link. CAD Explorer does not execute SDF plugins or read file-authored motion metadata.$render - For visual feedback during generation review, prefer snapshots over opening the viewer manually or using Playwright. Use still snapshots only; SDF review should not generate GIFs.
$render - Report checks run, checks skipped, and assumptions.
Commands
Run with the project or workspace Python environment.
bash
python scripts/sdf path/to/source.py
python scripts/sdf path/to/source.py -o path/to/output.sdf
python scripts/sdf path/to/a.py=out/a.sdf path/to/b.py=out/b.sdfPlain Python targets write sibling files beside their sources. / is valid only with one plain target. supports custom multi-target destinations.
.sdf-o--outputSOURCE.py=OUTPUT.sdfIf the runtime supports optional external checking:
bash
python scripts/sdf path/to/source.py --gz-check auto
python scripts/sdf path/to/source.py --gz-check required
python scripts/sdf path/to/source.py --gz-check nevergz sdf --checkRequired report shape
When finishing an SDF task, include a compact report:
text
Generated: path/to/model.sdf from path/to/model.py
Checks run:
- bundled SDF validation: passed
- gz sdf --check: skipped, gz not installed
- simulator load: skipped, target simulator unavailable
- visual review: render viewer link returned; snapshot run/skipped
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.References
- Generation command:
references/gen-sdf.md - Generator contract:
references/generator-contract.md - SDF workflow:
references/sdf-workflow.md - Builder helpers:
references/builder-helpers.md - LLM guardrails:
references/llm-guardrails.md - Design ledger:
references/design-ledger.md - Frame semantics:
references/frame-semantics.md - Validation scope:
references/validation.md - Smoke tests:
references/smoke-tests.md - Interoperability notes:
references/interoperability.md - Examples:
references/examples.md - Runtime notes and current limitations:
references/implementation-notes.md