list_road_users.py
Tested 2026-11-30 · Python 3.15.2 · standard library only
# List every road user in a RoadData.AI scenario: class, when it is tracked, and how far it moves.
# usage: python list_road_users.py roaddata-scenario-starter/sc_3ebeafb59c
import json, math, sys
d = json.load(open(f"{sys.argv[1]}/tracks.json"))
print("event", d["event"]["name"])
for name, a in d["actors"].items():
(x0, y0), (x1, y1) = a["xy"][0], a["xy"][-1]
print(f'{name:<12} {a["cls"]:<10} {a["t"][0]:5.1f}-{a["t"][-1]:5.1f} s moved {math.hypot(x1 - x0, y1 - y0):5.1f} m')python list_road_users.py roaddata-scenario-starter/sc_3ebeafb59c
What it printed when we ran it
event sc_3ebeafb59c
Bicycle1 bicycle 0.4- 13.0 s moved 20.5 m
Bicycle2 bicycle 2.7- 5.4 s moved 0.6 m
Bicycle3 bicycle 0.0- 13.8 s moved 22.5 m
Bicycle4 bicycle 12.3- 12.9 s moved 0.2 m
Person5 person 1.9- 6.9 s moved 1.4 m
...