# 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')
