-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrender_road_coverage.py
32 lines (26 loc) · 1.33 KB
/
render_road_coverage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys, os; sys.path.insert(0, os.getcwd())
import functools
from pathlib import Path
import pyglet
from commonroad_geometric.dataset.extraction.road_network.implementations import LaneletGraph, LaneletGraphConverter
from commonroad_geometric.dataset.scenario.iteration.scenario_iterator import ScenarioIterator
from commonroad_geometric.dataset.scenario.preprocessing.preprocessors.implementations import SegmentLaneletsPreprocessor
pyglet.options['headless'] = True
if __name__ == "__main__":
os.environ["PYGLET_HEADLESS"] = "1"
# if this script crashes with an OpenGlException try running it with the PYGLET_HEADLESS environment variable set
# PYGLET_HEADLESS=1 python tutorials/render_road_coverage.py
scenario_iter = ScenarioIterator(
directory=Path('data', 'other'),
preprocessor=SegmentLaneletsPreprocessor(lanelet_max_segment_length=20.0),
)
for scenario_bundle in scenario_iter:
print(scenario_bundle.preprocessed_scenario.scenario_id)
lanelet_graph = LaneletGraph.from_scenario(
scenario_bundle.preprocessed_scenario,
graph_conversion_steps=[
functools.partial(LaneletGraphConverter.render_road_coverage, size=35,
lanelet_depth=6, lanelet_orientation_buckets=0),
],
)
lanelet_graph.plot()