esmini
esmini copied to clipboard
VehicleCatalog bug when changing the name of the vehicle models description file.
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.
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:
- Rename catalog from
VehicleCatalog.xosc
toVehicleCatalog2.xosc
- Run:
./bin/esmini --window 60 60 800 400 --osc ./resources/xosc/cut-in.xosc
- Result:
Exception: Couldn't locate catalog file: VehicleCatalog
(expected, since referred catalog does not exist)
Test 2:
- 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"/>
- Run:
./bin/esmini --window 60 60 800 400 --osc ./resources/xosc/cut-in.xosc
- Result: No error (expected, since catalog names match)
Test 3:
- Rename catalog from
VehicleCatalog2.xosc
toVehicleCatalog.xosc
- Run:
./bin/esmini --window 60 60 800 400 --osc ./resources/xosc/cut-in.xosc
- 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 👍
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.
Test 1:
- Based on the picture above, restructure the folder.
- In [cut-in.xosc],change line 16 to
<ParameterDeclaration name="HostVehicle" parameterType="string" value="semi_truck"/>
- change line 26 to
<Directory path="../RezeroXosc/Catalogs/Vehicles"/>
- change line 30 to
<LogicFile filepath="../RezeroXodr/e6mini.xodr"/>
- change line 35 to
<CatalogReference catalogName="VehicleCatalog_202303161018091134" entryName="$HostVehicle"/>
- change line 38 to
<CatalogReference catalogName="VehicleCatalog_202303161018091134" entryName="$TargetVehicle"/>
- Run
.\bin\esmini.exe --osc .\resources\RezeroXosc\cut-in.xosc --window 30 30 600 300
- 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.
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.
15. change line 35 and 38 to
<CatalogReference catalogName="VehicleCatalog" entryName="$HostVehicle"/>
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"/>
.
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.
The files I am using are as follows: resources.zip
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