michele-segata / plexe-pyapi

Python APIs to control Plexe models in SUMO
49 stars 14 forks source link

Creat Intersection with Plex extesion #7

Closed TrinhTuanHung2021 closed 2 years ago

TrinhTuanHung2021 commented 2 years ago

Hi. I want to create an intersection to test Platoon's influence. In the examples above I see only creating 1 Platoon going in a certain direction. So is there a way to make multiple Platoons go in different directions? Thank you. I tried the code but it didn't work

michele-segata commented 2 years ago

Hi, sure, you just need to assign vehicles belonging to a platoon to a different route. First of all, create a new route. In this file, you see there's only one: https://github.com/michele-segata/plexe-pyapi/blob/2ebf3765be1d97eefde3895f5e927066fc21c009/examples/cfg/freeway.rou.xml#L15 Change the routes according to your scenario.

Then, you need to either change or create your own method to inject vehicles. As you can see in the following method inside utils.py https://github.com/michele-segata/plexe-pyapi/blob/2ebf3765be1d97eefde3895f5e927066fc21c009/examples/utils.py#L60 every vehicle that gets added to the simulation is assigned with the platoon_route route defined above. You have to change that depending on the vehicle you are injecting.