esmini icon indicating copy to clipboard operation
esmini copied to clipboard

VehicleCatalog bug when changing the name of the vehicle models description file.

Open StephenHU-sh opened this issue 1 year ago • 4 comments

Dear all,

There are some defined vehicles models in a path named "xosc/Catalogs/Vehicles/VehicleCatalog".If i changed the name of the model description file in the folder and use the new name(VehicleCatalog20230322) in the xosc file . Then the xosc file runs incorrectly. But when i changed the model description name back to "VehicleCatalog", the xosc file works fine.

Interestingly, when i used the simple vehicle model,such as "car_white","car_red" in the xosc, none of them has a problem. But last few models will have problem, such as "semi_truck","car_white_with_trailer","semi_truck_with_extra_trailer", and so on.

image image

StephenHU-sh avatar Mar 22 '23 06:03 StephenHU-sh

Can't reproduce, or my misunderstanding.

My starting point is Windows demo package of release v2.30.1. This is my steps and results,

Test 1:

  1. Rename catalog from VehicleCatalog.xosc to VehicleCatalog2.xosc
  2. Run: ./bin/esmini --window 60 60 800 400 --osc ./resources/xosc/cut-in.xosc
  3. Result: Exception: Couldn't locate catalog file: VehicleCatalog (expected, since referred catalog does not exist)

Test 2:

  1. In cut-in.xosc, change line 36 from <CatalogReference catalogName="VehicleCatalog" entryName="$HostVehicle"/> to <CatalogReference catalogName="VehicleCatalog2" entryName="$HostVehicle"/> and line 38 from <CatalogReference catalogName="VehicleCatalog" entryName="$TargetVehicle"/> to <CatalogReference catalogName="VehicleCatalog2" entryName="$TargetVehicle"/>
  2. Run: ./bin/esmini --window 60 60 800 400 --osc ./resources/xosc/cut-in.xosc
  3. Result: No error (expected, since catalog names match)

Test 3:

  1. Rename catalog from VehicleCatalog2.xosc to VehicleCatalog.xosc
  2. Run: ./bin/esmini --window 60 60 800 400 --osc ./resources/xosc/cut-in.xosc
  3. Result: Exception: Couldn't locate catalog file: VehicleCatalog2 (expected, since referred catalog does not exist)

I guess your issue involves some additional step. Can you please write exact steps from a known starting state (e.g. a release), leading to the error? Then we can reproduce and hopefully fix 👍

eknabevcc avatar Mar 25 '23 10:03 eknabevcc

Dear Knabe, Perhaps you can reproduce this problem based on the files and paths I provided. restructured the folder structure according to the needs of the project, as shown in the figure below. image

Test 1:

  1. Based on the picture above, restructure the folder.
  2. In [cut-in.xosc],change line 16 to <ParameterDeclaration name="HostVehicle" parameterType="string" value="semi_truck"/>
  3. change line 26 to <Directory path="../RezeroXosc/Catalogs/Vehicles"/>
  4. change line 30 to <LogicFile filepath="../RezeroXodr/e6mini.xodr"/>
  5. change line 35 to <CatalogReference catalogName="VehicleCatalog_202303161018091134" entryName="$HostVehicle"/>
  6. change line 38 to <CatalogReference catalogName="VehicleCatalog_202303161018091134" entryName="$TargetVehicle"/> 1679894654368
  7. Run .\bin\esmini.exe --osc .\resources\RezeroXosc\cut-in.xosc --window 30 30 600 300
  8. Result: Couldn't locate catalog file: VehicleCatalog. No document element found.

Test2: 9. if you change line 16 to <ParameterDeclaration name="HostVehicle" parameterType="string" value="car_white"/> , just select another car. 1679894858769 10. Run again, .\bin\esmini.exe --osc .\resources\RezeroXosc\cut-in.xosc --window 30 30 600 300 . 11. Result: No error.

Test3: 12. if you change line 16 to <ParameterDeclaration name="HostVehicle" parameterType="string" value="semi_truck"/>. 13. In the folder Catalogs/Vehicles, copy the VehicleCatalog_202303161018091134.xosc folder and rename it to VehicleCatalog. 1679895915678 15. change line 35 and 38 to <CatalogReference catalogName="VehicleCatalog" entryName="$HostVehicle"/> 1679895215280 16. Run again, .\bin\esmini.exe --osc .\resources\RezeroXosc\cut-in.xosc --window 30 30 600 300 . 17. Result: No Error.

Test4: 18. If you undo the code on lines 35 and 38, it's still <CatalogReference catalogName="VehicleCatalog_202303161018091134" entryName="$HostVehicle"/> and <CatalogReference catalogName="VehicleCatalog_202303161018091134" entryName="$TargetVehicle"/>. 1679896025007 20. Run again. .\bin\esmini.exe --osc .\resources\RezeroXosc\cut-in.xosc --window 30 30 600 300 . 21. Result: No error.

If you delete the relevant changes and restart the computer. Re-test1, the problem still exists.

StephenHU-sh avatar Mar 27 '23 05:03 StephenHU-sh

The files I am using are as follows: resources.zip

StephenHU-sh avatar Mar 27 '23 05:03 StephenHU-sh

Thanks for detailed information!

I see a potential root cause: In esmini catalog name is given by the catalog filename, not the Catalog name attribute. The attribute catalogName in <Trailer> element (used in semi_truck for example) is referring to specific a catalog, name given by it's filename.

So when you rename the catalog file, the <CatalogReference catalogName="VehicleCatalog" ...> is not found.

The solution is to make sure the catalog name references and catalog filenames are matching. See this modified catalog file: VehicleCatalog_202303161018091134.xosc.txt

And for avoiding confusion, whenever renaming a catalog file, also the <Catalog name=> attribute should be updated.

See more info in this old issue comment: https://github.com/esmini/esmini/issues/124#issuecomment-855658089

eknabevcc avatar Mar 27 '23 06:03 eknabevcc