metadriverse / scenarionet

ScenarioNet: Scalable Traffic Scenario Management System for Autonomous Driving

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scenarionet.sim error in nuplan dataset

CarlDegio opened this issue · comments

My env: python3.9, nuplan-devkit check successful, metadrive 0.4.1.2 test successful.
I run python -m scenarionet.sim -d ~/nuplan/scenario_net --render 3D after converting nuplan dataset, but with error:

Known pipe types:
  glxGraphicsPipe
(1 aux display modules not yet loaded.)
Traceback (most recent call last):
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/scenarionet/sim.py", line 52, in <module>
    env.reset(seed=index if args.scenario_index is None else args.scenario_index)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/envs/base_env.py", line 476, in reset
    self.engine.reset()
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/engine/base_engine.py", line 294, in reset
    manager.reset()
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/manager/scenario_map_manager.py", line 40, in reset
    new_map = ScenarioMap(map_index=seed)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/map/scenario_map.py", line 18, in __init__
    super(ScenarioMap, self).__init__(dict(id=self.map_index), random_seed=random_seed)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/map/base_map.py", line 57, in __init__
    self._generate()
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/map/scenario_map.py", line 32, in _generate
    block.construct_block(self.engine.worldNP, self.engine.physics_world, attach_to_world=True)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/block/base_block.py", line 133, in construct_block
    success = self._sample_topology()
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/scenario_block/scenario_block.py", line 40, in _sample_topology
    lane = ScenarioLane(lane_id, self.map_data, self.need_lane_localization)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/lane/scenario_lane.py", line 43, in __init__
    width=self.get_lane_width(lane_id, map_data),
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/component/lane/scenario_lane.py", line 106, in get_lane_width
    return max(sum(map_data[lane_id]["width"][0]), self.VIS_LANE_WIDTH)
KeyError: 'width'

Maybe there are still some formatting issues?

supplement: I found this map_data is:

{'type': 'LANE_SURFACE_STREET',
 'polyline': array([[-133.39504793,    4.46195791],
        [-133.39769158,    4.71194356],
        [-133.40181841,    4.96190913],
        [-133.40742827,    5.21184582],
        [-133.41452096,    5.46174482],
        [-133.42309623,    5.71159734],
        [-133.43315379,    5.96139458],
        [-133.44114621,    6.14402199]]),
 'entry_lanes': ['69004', '69985'],
 'exit_lanes': [],
 'left_neighbor': [],
 'right_neighbor': [],
 'polygon': array([[-136.37195491,   -7.96611503],
        [-125.68178997,   -7.9613382 ],
        [-126.86524811,   -6.55469659],
        [-128.22144533,   -4.80540963],
        [-129.02879057,   -3.30085262],
        [-129.61351513,   -1.7177102 ],
        [-129.82762106,   -0.67074242],
        [-130.11904544,    1.13875256],
        [-130.33613772,    3.60028601],
        [-130.44235647,    7.54115289],
        [-136.3086335 ,    7.50745135],
        [-136.30514196,   -7.22451779],
        [-136.30267684,   -7.67788929],
        [-136.37195491,   -7.96611503]])}

It does not have a width key word

And can not find lane for traffic light. occur in metadrive/manager/scenario_light_manager.py, line 33.

WARNING:/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/manager/scenario_light_manager.py:Can not find lane for this traffic light. Skip!
Traceback (most recent call last):
  File "/home/lzh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/232.9559.58/plugins/python/helpers/pydev/pydevd.py", line 1500, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/lzh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/232.9559.58/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/lzh/PycharmProjects/scenarionet/scenarionet/sim.py", line 53, in <module>
    env.reset(seed=index if args.scenario_index is None else args.scenario_index)
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/envs/base_env.py", line 476, in reset
    self.engine.reset()
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/engine/base_engine.py", line 303, in reset
    manager.after_reset()
  File "/home/lzh/miniconda3/envs/metadrive/lib/python3.9/site-packages/metadrive/manager/scenario_light_manager.py", line 38, in after_reset
    raise ValueError(
ValueError: Can not find lane for this traffic light. Set skip_missing_light=True for skipping missing light!

I set it as True and then run successful, but there are no traffic light in the simulation. Maybe there are some mistakes in line 33?
if str(scenario_lane_id) not in self.engine.current_map.road_network.graph

Hi,

For the first issue, please install MetaDrive from the github repo instead of PyPI. We fixed this issue already.

For the second issue, it is raised by the data itself. The traffic light's lane is not in the map feature thus we don't know where to put that light. We are going to relax this restriction. If there are no corresponding lanes, we will not construct the light rather than throw the error.

I think the scenario you are testing has lights at the edge of the map, which are skipped as no lane is found for them.

Hi,

For the first issue, please install MetaDrive from the github repo instead of PyPI. We fixed this issue already.

For the second issue, it is raised by the data itself. The traffic light's lane is not in the map feature thus we don't know where to put that light. We are going to relax this restriction. If there are no corresponding lanes, we will not construct the light rather than throw the error.

Thank you for your advice, the first issue has been solved. Maybe the second problem is that you mentioned, but I can't see the traffic light in the metadrive scene so can't be sure about this.

Moreover, I found the texture of scene (ground) is incomplete. I'm not sure if other datasets have this problem.
image

Thank you for the feedback. It is highly likely it is a bug. Now we use a new way to build the terrain in the latest main branch, which may help with this issue, I believe

Yes, the simulation picture is much better now. Very quick fix!
image