Skip to content

MetaDrive Sumo Map Not Found #331

@oliverc1623

Description

@oliverc1623

System Details

  1. Python 3.8.20
  2. Scenic 3.1.0a1
  3. Operating System Apple M2 macOS Sonoma 14.6.1
  4. metadrive-simulator 0.4.3

Detailed Description

  1. MetaDriveSimulator instantiation bug. When initializing MetaDriveSimulator, not specifying a SumoMap causes the error below.
  2. Calling MetaDriveSimulator() causes TypeError.
  3. Calling MetaDriveSimulator(sumo_map="../../assets/maps/CARLA/Town05.net.xml") works fine.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/w0/3ttb6cs14rq8l4ggd5r1v9440000gn/T/ipykernel_25460/2790578972.py in <cell line: 1>()
----> 1 simulator = MetaDriveSimulator()

~/Documents/tracr/Scenic/src/scenic/simulators/metadrive/simulator.py in __init__(self, timestep, render, render3D, sumo_map, real_time)
     41         self.sumo_map = sumo_map
     42         self.real_time = real_time
---> 43         self.scenic_offset, self.sumo_map_boundary = utils.getMapParameters(self.sumo_map)
     44         if self.render and not self.render3D:
     45             self.film_size = utils.calculateFilmSize(self.sumo_map_boundary, scaling=5)

~/Documents/tracr/Scenic/src/scenic/simulators/metadrive/utils.py in getMapParameters(sumo_map_path)
     39 def getMapParameters(sumo_map_path):
     40     """Retrieve the map parameters."""
---> 41     net_offset, sumo_map_boundary = extractNetOffsetAndBoundary(sumo_map_path)
     42     xmin, ymin, xmax, ymax = sumo_map_boundary
     43     center_x = (xmin + xmax) / 2

~/Documents/tracr/Scenic/src/scenic/simulators/metadrive/utils.py in extractNetOffsetAndBoundary(sumo_map_path)
     29 def extractNetOffsetAndBoundary(sumo_map_path):
     30     """Extracts the net offset and boundary from the given SUMO map file."""
---> 31     tree = ET.parse(sumo_map_path)
     32     root = tree.getroot()
     33     location_tag = root.find("location")

~/opt/anaconda3/envs/tracr/lib/python3.8/xml/etree/ElementTree.py in parse(source, parser)
   1200     """
   1201     tree = ElementTree()
-> 1202     tree.parse(source, parser)
   1203     return tree
   1204 

~/opt/anaconda3/envs/tracr/lib/python3.8/xml/etree/ElementTree.py in parse(self, source, parser)
    582         close_source = False
    583         if not hasattr(source, "read"):
--> 584             source = open(source, "rb")
    585             close_source = True
    586         try:

TypeError: expected str, bytes or os.PathLike object, not NoneType

Steps To Reproduce

  1. from scenic.simulators.metadrive import MetaDriveSimulator
  2. simulator = MetaDriveSimulator()
from scenic.simulators.metadrive import MetaDriveSimulator

simulator = MetaDriveSimulator()

Issue Submission Checklist

  • I am reporting an issue, not asking a question
  • I checked the open and closed issues, forum, etc. and have not found any solution
  • I have provided all necessary code, etc. to reproduce the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triageIssue needs to be assessedtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions