Skip to content

Repository files navigation

scene-dsl

textX languages for abstract scene models (scene) and executable scene instances (scenex).

Languages

  • 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.
  • .ktree files hold reusable device trees. They are parsed with the scenex metamodel, and imported like a .scene file.

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.

Installation

scene-dsl is a Python package installable with pip. It depends on rdf-utils, textx, rdflib, and numpy.

For local development with sibling checkouts:

pip install "../rdf-utils[all]"
pip install -e .

RDF Generation

Example models live under examples/models.

Print abstract scene RDF as Turtle:

textx generate examples/models/lab.scene --target console --format ttl

Write abstract scene RDF to examples/generated/lab.scene.ttl:

textx generate examples/models/lab.scene --target graph -o examples/generated --format ttl

Print executable scenex RDF as Turtle:

textx generate examples/models/lab.scenex --target console --format ttl

Write executable scenex RDF to examples/generated/lab.scenex.ttl:

textx generate examples/models/lab.scenex --target graph -o examples/generated --format ttl

The RDF generators accept format (json-ld, ttl, or xml) and filename. For JSON-LD, pass --nocompact to skip compacting IRIs.

Drawing the Kinematics

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 png

format takes dot (the default), png, svg, or pdf. To print the graph instead of writing it:

textx generate examples/models/lab.scenex --target dot-console

Development

pytest -q tests
ruff check src tests

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages