pyoscx / scenariogeneration

Python library to generate linked OpenDRIVE and OpenSCENARIO files
Mozilla Public License 2.0
256 stars 81 forks source link

esmini Function Path Handling and Scenario Class Recognition Issues #239

Open Wankelb opened 1 month ago

Wankelb commented 1 month ago

Hello,

I have encountered some issues while using the scenariogeneration package, specifically with the esmini function and the Scenario class. Here are the details:

Steps to Reproduce

I installed the scenariogeneration package and set up my environment as instructed. Created a Python script to generate a scenario and visualize it using esmini.

import os
from scenariogeneration import xodr, prettyprint, ScenarioGenerator, esmini, Scenario
import numpy as np

class MyScenario(ScenarioGenerator):
    def __init__(self):
        super().__init__()

    def road(self, **kwargs):
        odr = xodr.OpenDrive("myroad")

        # ... (omitting the rest for brevity)

if __name__ == "__main__":
    sce = MyScenario()
    prettyprint(sce.road().get_element())
    sce.generate(".")
    esmini_path = r"C:\Program Files\Tools\esmini\esmini"
    print(f"Using esmini path: {esmini_path}")
    esmini(sce, esminipath=esmini_path, index_to_run='first')

Issues Encountered

Path Handling Issue: When specifying the esmini_path, paths containing spaces (e.g., C:\Program Files\Tools\esmini) result in an error:

The command “C:\Program” is either misspelled or could not be found.

Could you provide guidance on how to handle paths with spaces correctly in this context?

Thank you for your assistance.

Wankelb commented 1 month ago

thank you.

eknabevcc commented 1 month ago

You found a bug, or at least shortcoming. I see no easy work-around (other than putting esmini in a non-space path). But I prepared a fix. We will discuss internally before merging it. Hopefully it will be included in next release.

Meanwhile if it is urgent, I think you can install the branch: support_spaces_in_paths

  1. Move to scenariogeneration root folder
  2. Checkout the branch: git checkout support_spaces_in_paths
  3. Uninstall any currently installed scenariogeneration: pip uninstall scenariogeneration
  4. pip install .
eknabevcc commented 3 weeks ago

The fix is now merged to main branch and will automatically be included in next release.