Final project repository for CAS782 (Digital Twins), focused on a CARLA-driven scene graph pipeline with incremental graph query matching and model transformation using VIATRA.
Before starting, review all system requirements:
PREREQUISITES.md (5-10 minutes to read)
- System requirements (Windows 10/11, disk space, GPU)
- Required software (Git, Python 3.8+, Visual C++ Build Tools)
- One-time setup checklist
- Troubleshooting
Once prerequisites are met, run the automated setup:
.\SETUP.ps1Note: This will download CARLA 0.9.16 (~8GB) and may take 10-30 minutes depending on your internet connection.
The script will output detailed next steps, including:
- How to activate the virtual environment
- How to start the CARLA server
- How to run demos
- How to start the live scene graph stream
Once setup is complete, explore these guides:
| Document | Purpose | When to Read |
|---|---|---|
| QUICKSTART.md | First-time usage workflows | After SETUP.ps1 completes |
Setup & Documentation:
PREREQUISITES.md— System requirements & one-time setupSETUP.ps1— Automated environment setup (run once after clone)QUICKSTART.md— First-time usage guide
Source Code:
src/carla_scenegraph_export.py— Export CARLA state as XMI scene graphssrc/scenegraph_stream_bridge.py— Continuous stream producer (XMI + JSONL)src/scenario_ego_follow.py— Demo: ego vehicle follows lead vehicle (with follow camera)
Metamodel & Queries:
SceneGraphModel/model/SceneGraph.ecore— EMF metamodel (Vehicle, Pedestrian, Node, Edge)SceneGraphQueries/src/queries/scenegraph.vql— VIATRA query patterns (fastVehicle, connected, etc.)
Scale Simulation & Utilities:
scripts/bootstrap_windows.ps1— Legacy prerequisite checkerscripts/run_scenegraph_stream.ps1— Start scene graph streamscripts/open_live_view.ps1— Open live graph visualization
Data & Outputs:
data/stream/latest_snapshot.xmi— Most recent snapshot (auto-synced)data/stream/events.jsonl— Incremental change events (JSONL format)data/stream/live_view.html— Auto-refresh browser visualization
Data Flow:
CARLA Simulator → Scene Graph Export → latest_snapshot.xmi + JSONL Events
↓
VIATRA Query Engine
↓
Query Results
Components:
- Scene Source: CARLA 0.9.16 simulation (vehicles, pedestrians, environment)
- Extraction: Python bridge collects positions, speeds, relationships
- Format: EMF XMI (W3C standard) + JSONL event stream (incremental updates)
- Querying: VIATRA incremental pattern matching on live XMI models
- Metamodel: Single unified
SceneGraph.ecore(Vehicle, Pedestrian, Node, Edge, Scene)
All outputs are written to data/stream/ directory:
| File | Format | Purpose |
|---|---|---|
latest_snapshot.xmi |
XMI | Current world state (load into VIATRA) |
events.jsonl |
JSONL | Incremental changes per tick (node/edge deltas) |
current_state.json |
JSON | Same as latest_snapshot.xmi but in JSON |
live_view.html |
HTML | Auto-refresh browser visualization |
Example XMI Snapshot:
<scenegraph:Scene xmlns:scenegraph="http://cas782/scenegraph" name="CARLA_Stream">
<nodes xsi:type="scenegraph:Vehicle" id="26" x="-64.6" y="24.5" z="-0.01" speed="0.0" />
<nodes xsi:type="scenegraph:Vehicle" id="32" x="120.3" y="28.6" z="0.13" speed="0.004" />
</scenegraph:Scene>Example JSONL Event:
{"timestamp": "2026-03-09T02:33:12.935688+00:00", "tick": 1, "snapshot": "data/stream/latest_snapshot.xmi", "node_changes": {"added": [{"node_type": "Vehicle", "external_id": "26", "x": -64.6446, "y": 24.471, "z": -0.0075, "speed": 0.0}], "removed": [], "updated": []}}Project Documentation:
- PREREQUISITES.md — System setup requirements
- SETUP.ps1 — Automated installation script
- QUICKSTART.md — First-time usage guide
External Resources:
- CARLA 0.9.16 Docs — Simulator reference
- CARLA Windows Build — Build instructions
- VIATRA Homepage — Query & transformation tool
- Eclipse Modeling Tools — EMF & VIATRA IDE
- EMF/XMI Standard — Data format specification
For Setup Issues:
- See PREREQUISITES.md troubleshooting section
- Check Windows firewall (CARLA uses ports 2000-2001)
For Usage Questions:
- See QUICKSTART.md for common workflows
See LICENSE file.