pyoscx / scenariogeneration

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

Warning: id 3 has already been used for another Signal ...auto-generating unique id. #224

Open johschmitz opened 4 months ago

johschmitz commented 4 months ago

I am getting this warning

Warning: id 3 has already been used for another Signal ...auto-generating unique id.

when I use the library the second time. Is there some kind of memory for the IDs that I need to reset somehow before doing that? Or can I somehow disable this behavior and avoid changing the IDs? Strange enough this same problem does not happen with roads.

dongfeng2134 commented 4 months ago

I'm having the same problem,After understanding this causes and solutions are as follows

Reason

  1. The opendrive standard requires signal and object ids to be Unique ID within database. https://publications.pages.asam.net/standards/ASAM_OpenDRIVE/ASAM_OpenDRIVE_Specification/latest/specification/13_objects/13_01_introduction.html image

  2. So in the code implemented here, class _SignalObjectBase sets up that the id needs to be unique, and if it's not then a new id is automatically created. image and both class Signal and class Object are integrated from class _SignalObjectBase. image

How to

My solution so far is to use a global id setting, e.g. set it in the config file or set the starting id of the object and signal to differ by 100 and then add 1 for each execution.