carla-simulator / scenario_runner

Traffic scenario definition and execution engine
https://carla-scenariorunner.readthedocs.io/en/latest/
MIT License
519 stars 358 forks source link

AttributeError: 'OSC2ScenarioConfiguration' object has no attribute 'route' 'OSC2ScenarioConfiguration' object has no attribute 'route' No more scenarios .... Exiting #1057

Open qitong-wei opened 7 months ago

qitong-wei commented 7 months ago

Describe our question or idea Hi everyone, i follow this guide https://github.com/carla-simulator/scenario_runner/blob/master/Docs/README_OpenSCENARIO_2.0.md to run the demo, but the terminal show "AttributeError: 'OSC2ScenarioConfiguration' object has no attribute 'route' 'OSC2ScenarioConfiguration' object has no attribute 'route' No more scenarios .... Exiting", please give me some advise, thanks.

Screenshots image

Desktop (please complete the following information):

gbenner commented 6 months ago

Ran into same issue. Noticed OSC2ScenarioConfiguration did not chain up the init with super. Declaring __init__ in the child discards supers __init__ where the route variable is declared.

Calling super().__init__() adds those variables to the child class.

This seems to fix it.


# osc2_scenario_configuration.py
class OSC2ScenarioConfiguration(ScenarioConfiguration):
    def __init__(self, filename, client):
        super().__init__()```