TRACE transforms trajectories and road-network topology into:
- Map-enriched scenario contexts
- Semantic traffic events
- Behavioral inferences
- Human-readable explanations
- Semantic scenario databases
- Similarity-search descriptors
- OpenSCENARIO scenarios
TRACE follows a strict separation between:
- Infrastructure facts
- Route semantics
- Traffic events
- Behavioral interpretations
Infrastructure produces facts.
GoRules produces interpretations.
Python should generate context.
GoRules should generate semantics.
OpenLABEL / Trajectories
+
OpenDRIVE
+
Lanelet-Enriched Metadata
+
Homography
↓
RoadInfrastructure
↓
LaneMapViewer
↓
MapScenarioContext
↓
Scenario Engine
↓
GoRules
↓
Events
Behaviors
Insights
↓
Scenario Descriptor
↓
┌─────────────┬───────────────┬───────────────┐
↓ ↓ ↓
Similarity Explanations OpenSCENARIO
Search Export
Responsibilities:
- Module orchestration
- Data routing
- UI coordination
MainApp performs no semantic reasoning.
Authoritative owner of:
- OpenDRIVE geometry
- Lanelet-style graph topology
- Region relationships
- Junction relationships
- Routing relationships
RoadInfrastructure provides:
successors
predecessors
adjacent
shared junctions
shared future junctions
merge relationships
Topology knowledge must originate here.
No downstream module should rebuild topology.
Authoritative owner of:
Trajectory processing
Projection
Topology extraction
Route extraction
Map context generation
Semantic database generation
Similarity indexing
LaneMapViewer owns map reasoning.
LaneMapViewer does not own traffic behavior logic.
Authoritative owner of:
Context ingestion
Context enrichment
Rule input preparation
Descriptor construction
Scenario Engine prepares facts for GoRules.
Scenario Engine should avoid hardcoded traffic behavior logic.
Authoritative owner of:
Traffic events
Behavior detection
Insights
Reasoning
All semantic interpretations should originate from GoRules.
If a new traffic behavior is introduced, it should normally be implemented as a rule rather than Python code.
TRACE uses two different context objects.
Generated by LaneMapViewer.
Contains only map-derived facts.
Consumes:
trajectories
road topology
metadata
Produces:
route semantics
topology facts
interaction facts
This is the primary contract sent to Scenario Engine.
Generated by Scenario Engine and GoRules.
Contains:
events
behaviors
insights
descriptor
EngineContext is derived from MapScenarioContext.
EngineContext must never be treated as an input source.
The system reasoner, semantic database, explanations, OpenSCENARIO export and future search all operate on:
Actor A
+
Actor B
+
Coexistence Window
Example:
Vehicle 17
Vehicle 42
Frames 1200-1800
Therefore the primary context unit is a scenario.
Not a full recording.
A recording contains many tracked objects.
Example:
600 vehicles
30 minutes
Dataset is only a source of scenarios.
Dataset is not the semantic unit.
The semantic unit is:
actor pair
+
coexistence window
Example:
Vehicle 21
Vehicle 77
Frames 4200-4650
This scenario becomes:
- rule input
- explanation input
- semantic DB entry
- OpenSCENARIO candidate
- similarity-search candidate
{
"kind": "map_scenario_context",
"version": "1.0",
"scope": {...},
"actors": {...},
"interaction": {...},
"meta": {...}
}The MapScenarioContext is the authoritative contract produced by LaneMapViewer.
It contains only map-derived facts and interaction facts.
It must not contain:
- events
- behaviors
- insights
- descriptor data
- rule evaluations
Those belong to EngineContext.
{
"kind": "map_scenario_context",
"version": "1.0",
"scope": {
"actor_a": "string",
"actor_b": "string",
"start_frame": 0,
"end_frame": 0,
"duration_seconds": 0.0
},
"actors": {
"A": {
"id": "string",
"timeline": {
"frame_id": {
"region_id": "string",
"world": {
"x": 0.0,
"y": 0.0
},
"sd": {
"s": 0.0,
"d": 0.0
},
"topology": [
"FLOW"
]
}
},
"route_semantics": {
"route": [
"lane_id"
],
"transitions": [
"FOLLOW",
"LANE_CHANGE",
"DIVERGE",
"TRANSFER"
]
},
"topology_facts": {
"junctions": [
"junction_id"
],
"merge_points": [
"lane_id"
],
"diverge_points": [
"lane_id"
]
}
},
"B": {
"id": "string",
"timeline": {},
"route_semantics": {},
"topology_facts": {}
}
},
"interaction": {
"timeline": {
"frame_id": {
"distance_m": 0.0,
"delta_s": 0.0,
"delta_d": 0.0,
"relative_order": "ahead|behind",
"overlap": false
}
}
},
"interaction_topology": {
"shared_lanes": [
"lane_id"
],
"shared_lane_ratio": 0.0,
"shared_junctions": [
"junction_id"
],
"common_merge_points": [
"lane_id"
],
"common_diverge_points": [
"lane_id"
],
"common_successors": [
"lane_id"
],
"common_predecessors": [
"lane_id"
],
"shared_future_junctions": [
"junction_id"
],
"shared_route_segments": [
[
"lane_id",
"lane_id"
]
]
},
"meta": {
"lane_id": {
"type": "lane|connecting_lane",
"road_id": "string",
"junction_id": "string",
"successors": [],
"predecessors": [],
"adjacent": []
}
}
}Actors represent traffic participants within the selected coexistence window.
Current implementation uses two actors:
A
B
This keeps the contract independent from specific IDs such as:
V1
V2
Route semantics describe progression through the topology graph.
Valid transition types:
FOLLOW
LANE_CHANGE
DIVERGE
TRANSFER
These are infrastructure facts.
They are not events.
Topology facts describe graph properties.
Examples:
junctions visited
merge points visited
diverge points visited
They are independent from traffic behavior.
Interaction topology describes route relationships between actors.
Examples:
shared route
shared junction
common merge
common diverge
shared future conflict zone
These are facts available to GoRules.
They are not conclusions.
Meta contains immutable infrastructure topology.
This information originates from:
OpenDRIVE
Lanelet enrichment
Layout metadata
and is the authoritative graph representation used throughout TRACE.
The following fields shall never appear inside MapScenarioContext:
proximity
waiting
yield
gap_acceptance
dangerous_following
near_miss
connector_navigation
complex_route_navigation
These belong to EngineContext because they are produced by GoRules.
Future versions of MapScenarioContext may add:
new topology facts
new route semantics
new interaction facts
but must not add:
behavior classifications
rule outputs
semantic interpretations
The contract must remain purely factual.
---
# Scope
Defines scenario boundaries.
Example:
```python
{
"actor_a": "V1",
"actor_b": "V2",
"start_frame": 150,
"end_frame": 420
}
Contains map-derived facts for individual actors.
Example:
actors = {
"A": {
"timeline": ...,
"route_semantics": ...,
"topology_facts": ...
},
"B": {
...
}
}No events.
No behaviors.
No rule conclusions.
Contains pairwise facts.
Example:
distance
delta_s
delta_d
ttc
relative orderPlus shared topology facts.
No events.
No traffic interpretations.
Represents route progression through topology.
Example:
{
"route": [
"17",
"21",
"22"
],
"transitions": [
"FOLLOW",
"FOLLOW",
"DIVERGE"
]
}Route semantics are infrastructure facts.
They are not events.
They are not behaviors.
Produced directly from topology.
Examples:
junctions
merge_points
diverge_pointsInteraction examples:
shared_lanes
shared_lane_ratio
shared_junctions
common_merge_points
common_diverge_pointsAll topology facts must remain generic.
No roundabout-specific concepts.
No intersection-specific concepts.
Correct:
FOLLOW
DIVERGE
TRANSFER
Incorrect:
yield
merge_behavior
roundabout_entry
Behavioral interpretations belong to GoRules.
Produced by Scenario Engine.
Consumes:
MapScenarioContext
Produces:
{
"kind": "engine_context",
"events": [...],
"behaviors": [...],
"insights": [...],
"descriptor": {...}
}Generated by GoRules.
Examples:
proximity
waiting
lane_change
Events are observable traffic situations.
Generated by GoRules.
Examples:
yield
gap_acceptance
dangerous_following
connector_navigation
near_miss
Behaviors are interpretations.
Events and behaviors must remain separate.
The descriptor is the canonical searchable representation.
Built after GoRules execution.
Contains:
topology fingerprints
route fingerprints
event fingerprints
behavior fingerprints
signal summaries
Descriptor is the primary search artifact.
(Not currently the active focus.)
Similarity search operates on scenario descriptors generated after GoRules reasoning.
The searchable unit remains:
actor pair
+
coexistence window
not entire datasets.
Consumes:
MapScenarioContext
Events
Behaviors
Descriptor
Produces:
Scenario summaries
Behavior explanations
Risk observations
Traffic descriptions
No new semantics should be invented here.
Semantic database targets OpenLABEL concepts:
Objects
Relations
Contexts
Actions
Attributes
Topology and route semantics are exported as context.
Events and behaviors are stored separately.
OpenSCENARIO export consumes:
MapScenarioContext
Events
Behaviors
Routes
and generates:
Entities
Routes
Actions
Triggers
Storyboards
The exporter translates semantic reasoning but does not define it.
Rule 1
Infrastructure facts belong to RoadInfrastructure and LaneMapViewer.
Rule 2
MapScenarioContext contains facts only.
Rule 3
Scenario Engine prepares rule inputs.
Rule 4
GoRules owns events and behaviors.
Rule 5
Context must not contain rule conclusions.
Rule 6
Route semantics are not events.
Rule 7
Topology facts are not behaviors.
Rule 8
Always add infrastructure facts before adding new traffic rules.
Rule 9
Avoid map-specific semantics.
Rule 10
If a concept can be represented as a fact, place it in MapScenarioContext before considering a GoRules implementation.