textX languages for abstract scene models (scene) and executable scene instances (scenex).
scene(*.scene) describes abstract robotic scene content: objects, workspaces, agents, workspace compositions, and scene models.scenex(*.scenex) describes executable scene instances: model files, geometry, frames, poses, kinematics, attachments, bodies, and inertial mass..ktreefiles hold reusable device trees. They are parsed with thescenexmetamodel, and imported like a.scenefile.
scenex references the registered scene language, so executable models can
import a .scene file and link to SceneModel declarations.
A tree without a namespace is a template: it describes a device without being any particular one, so every use is an instance that copies it under its own name. An element's IRI is its namespace plus the path down to it, so two instances of one device may share a namespace, and a sensor is scoped by the agent carrying it.
The package ships device trees for common robots in scene_dsl/robots/:
| File | Device |
|---|---|
kinova_gen3_7dof.ktree |
Kinova Gen3, 7 DoF arm |
robotiq_2f85.ktree |
Robotiq 2F-85 gripper |
ur10e.ktree |
Universal Robots UR10e arm |
eddie_base.ktree |
Eddie mobile base |
Import one with the scene_dsl: prefix, which names the package it comes from:
import "scene_dsl:robots/kinova_gen3_7dof.ktree"
<package>:<path> resolves to <path> inside any installed top-level package,
through importlib.resources, so another package can ship its own trees the
same way. Every other import is relative to the importing file.
scene-dsl is a Python package installable with pip. It depends on
rdf-utils, textx, rdflib, and
numpy.
Example meshes are stored with Git LFS: install git-lfs
before cloning, or run git lfs pull in an existing clone.
For local development with sibling checkouts:
pip install "../rdf-utils[all]"
pip install -e .Example models live under examples/models.
Print abstract scene RDF as TriG:
textx generate examples/models/lab.scene --target console --format trigWrite abstract scene RDF to examples/generated/lab.scene.trig:
textx generate examples/models/lab.scene --target graph -o examples/generated --format trigPrint executable scenex RDF as TriG:
textx generate examples/models/lab.scenex --target console --format trigWrite executable scenex RDF to examples/generated/lab.scenex.trig:
textx generate examples/models/lab.scenex --target graph -o examples/generated --format trigThe RDF generators write the model graph as one named graph, named by a fresh
urn:uuid:, and accept format (json-ld, the default, as .ld.json;
nquads as .nq; trig as .trig) and filename.
For JSON-LD, pass --nocompact to skip compacting IRIs.
The graph and kdl targets take --provenance, which also records the PROV
bundle of the run as a second named graph beside the model graph: in the graph
file itself for graph, and in <output>.ld.json (or the extension of
format) for the KDL header, with both steps in one bundle. A tool calls the
same steps, rdf-utils record_model_to_graph and record_graph_to_text, in a Dataset
holding the bundle that create_pkg_bundle(dataset, "scene_dsl") creates.
Draw the scene's bodies and the joints between them, with each device a cluster
and any declared serial chain picked out. Needs graphviz
for anything but dot:
textx generate examples/models/lab.scenex --target dot -o examples/generated --format pngformat takes dot (the default), png, svg, or pdf. To print the graph
instead of writing it:
textx generate examples/models/lab.scenex --target dot-consolepytest -q tests
ruff check src tests