metadriverse / metadrive

MetaDrive: Open-source driving simulator
https://metadriverse.github.io/metadrive/
Apache License 2.0
671 stars 100 forks source link

Conditional Autoparking #706

Open M0-Adel opened 2 months ago

M0-Adel commented 2 months ago

I need to program a condition to trigger autoparking; if a certain event occurs, the system should initiate autoparking, otherwise, it should remain in its default state. thanks for helping.

QuanyiLi commented 2 months ago

You need to wrap up everything in a Manager, then in the def step() function, you can tell if some conditions are satisfied are not and then you can trigger corresponding events.

A good example is: https://github.com/metadriverse/metadrive/blob/233a3a1698be7038ec3dd050ca10b547b4b3324c/metadrive/manager/traffic_manager.py#L31 It triggers traffic vehicles only when ego car is approaching them to maximize interaction.