Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prefix to object before spawning to avoid object registered twice in engine #659

Merged
merged 3 commits into from
Mar 1, 2024

Conversation

pengzhenghao
Copy link
Member

What changes do you make in this PR?

  • Please describe why you create this PR

now I add a prefix to Scenariotrafficlight manager's objects. From '162' to 'traffic_light_162'. This is because the Scenariotrafficmanager will also generate a traffc vehicle with name '162'. They will use the same name in the engine's registry. So when clear_objects from engine, the trafficmanager will remove '162'. Later when ScenarioTrafficLight manager want to remove '162', error will be raised in engine as the object already removed.

WE MIGHT ALSO WANT TO ADD PREFIX TO ALL OBJECTS SPAWN BY MANAGERS?

Checklist

  • I have merged the latest main branch into current branch.
  • I have run bash scripts/format.sh before merging.
  • Please use "squash and merge" mode.

@pengzhenghao pengzhenghao added the Merge after all tests pass Merge this PR when all tests pass! label Feb 23, 2024
@pengzhenghao
Copy link
Member Author

I actually come up with a better solution maybe when registering the object in the engine, we can ask the engine to append a prefix to the object name in so that the engine will remember which manager registered the objects

@pengzhenghao
Copy link
Member Author

@QuanyiLi Is it possible that this PR will break save & restore scenarios utility? I am not sure.. If it LGTY then please merge.

@QuanyiLi
Copy link
Member

QuanyiLi commented Feb 28, 2024

It should be fine to do so. I wonder if we need to do this in engine.spawn_object where the object id can be obj.__class__.__name__ + uuid.

@pengzhenghao pengzhenghao merged commit 6578760 into main Mar 1, 2024
14 checks passed
@pengzhenghao pengzhenghao deleted the fix-duplicated-agent-name branch March 1, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge after all tests pass Merge this PR when all tests pass!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants