metadriverse / metadrive

MetaDrive: Open-source driving simulator
https://metadriverse.github.io/metadrive/
Apache License 2.0
779 stars 110 forks source link

Rendered map doesn't match PG_MAP_FILE #676

Open mimi89999 opened 8 months ago

mimi89999 commented 8 months ago

Hello,

I noticed that the rendered map doesn't match the PG_MAP_FILE map config.

  1. Define the map_config as
    def create_map():
    return dict(
    type=MapGenerateMethod.PG_MAP_FILE,
    lane_num=2,
    lane_width=3.5,
    config=[
      {
        "id": "S",
        "pre_block_socket_index": 0,
        "length": 60,
      },
      {
        "id": "C",
        "pre_block_socket_index": 0,
        "length": 60,
        "radius": 600,
        "angle": 45,
        "dir": 0,
      },
      {
        "id": "C",
        "pre_block_socket_index": 0,
        "length": 60,
        "radius": 600,
        "angle": 45,
        "dir": 1,
      },
    ]
    )
  2. draw_top_down_map. Notice that it does match the defined config Capture d’écran du 2024-03-04 10-04-26
  3. Run MetaDrive. There, the map will end after the first left curve. Capture d’écran du 2024-03-04 10-08-11
fredyshox commented 8 months ago

This road map exceeds the default map region size of 1024. Try increasing it (max is 2048). Also by default pg map starts at point [0, 0], which is the center of the map. You can change it using map_config.start_position if you need more space.

mimi89999 commented 8 months ago

I think that would be good if MetaDrive showed a warning in such a case.

QuanyiLi commented 8 months ago

Yeah. We should at least have a warning printed. Or we can have some visualization hints to remind users about this. For example, we can print the boundary of the map_region with red color on the terrain.