BerkeleyLearnVerify / Scenic

A compiler and scenario generator for the Scenic scenario description language.
https://scenic-lang.org/
Other
258 stars 93 forks source link

Run on Customized Maps #207

Closed Ezharjan closed 3 months ago

Ezharjan commented 6 months ago

While generating the scenarios on our customized map that is smaller and simpler than CARLA's official map, none of the given examples works. Even some very simple examples like badlyParkedCarPullingIn.scenic do not work properly on customized maps. The ego vehicle often stucks on the road then the whole program will stop with RejectionException, though we have checked that our road map is correct and can be used very smoothly while running CARLA's official generate_traffic.py.

Way to Reproduce

  1. Change the first and second line in badlyParkedCarPullingIn.scenic to the path of a customized map:
    param map = localPath('../../tests/formats/opendrive/maps/CARLA/AU.xodr') # changed to customized map
    param carla_map = 'AU'  # changed to customized map
    param time_step = 1.0/10
    ...
    # Codes from badlyParkedCarPullingIn.scenic
    ...
    require monitor StopAfterInteraction()
    terminate after 15 seconds   # in case ego never breaks
  2. Open CARLAUE4_CustomizedMapIntegrated and run ./CARLAUE4.sh
  3. Run the example with our customized map:
    scenic examples/carla/badlyParkedCarPullingIn.scenic --2d --simulate  --model scenic.simulators.carla.model  --time 20000 -b
  4. The ego vehicle inside the generated scenario will stuck in the map and the program will show RejectionException. The whole output is as follows:
    
    pygame 2.5.2 (SDL 2.28.2, Python 3.8.18)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    Loading cached version of road network...
    Loaded cached network in 0.05 seconds.
    Pruning scenario...
    Region containment constraint pruned 62.6% of space.
    Pruned scenario in 0.005756 seconds.
    Scenario constructed in 0.68 seconds.
    Connecting to CARLA on port 2000
    WARNING: No InMemoryMap cache found. Setting up local map. This may take a while... 
    Map loaded in simulator.
    Generated scene in 51 iterations, 0.1179 seconds.
    Beginning simulation of top-level scenario...
    Ran simulation in 1.085 seconds.
    Traceback (most recent call last):
    File "/home/alex/Documents/Scenic/src/scenic/core/scenarios.py", line 417, in generateBatch
    scene, iterations = self._generateInner(remainingIts, verbosity, feedback)
    File "/home/alex/Documents/Scenic/src/scenic/core/scenarios.py", line 445, in _generateInner
    raise RejectionException(
    scenic.core.distributions.RejectionException: failed to generate scenario in 2000 iterations

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/alex/anaconda3/envs/scenic/bin/scenic", line 5, in from scenic.main import dummy File "/home/alex/Documents/Scenic/src/scenic/main.py", line 270, in scene, _ = generateScene() File "/home/alex/Documents/Scenic/src/scenic/main.py", line 213, in generateScene scene, iterations = errors.callBeginningScenicTrace( File "/home/alex/Documents/Scenic/src/scenic/core/errors.py", line 282, in callBeginningScenicTrace return func() File "/home/alex/Documents/Scenic/src/scenic/main.py", line 214, in lambda: scenario.generate(maxIterations=maxIterations, verbosity=args.verbosity) File "/home/alex/Documents/Scenic/src/scenic/core/scenarios.py", line 387, in generate scenes, iterations = self.generateBatch(1, maxIterations, verbosity, feedback) File "/home/alex/Documents/Scenic/src/scenic/core/scenarios.py", line 421, in generateBatch raise RejectionException( scenic.core.distributions.RejectionException: failed to generate scenario in 2000 iterations



### Environment
1. Linux Ubuntu 20.04 LTS (also reproducible on Windows 10 and Windows 11)
2. Python 3.8.18
3. carla==0.9.13
4. `Scenic 3.0.0b2` (also reproducible on other versions)
Eric-Vin commented 3 months ago

To debug this I suspect we'll need to have access to the custom map. Is that something you can share with us?

Eric-Vin commented 3 months ago

Closed as stale. Please re-open if this is still an issue.