michele-segata / plexe-pyapi

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

Platoon at signalized intersection #9

Open TrinhTuanHung2021 opened 2 years ago

TrinhTuanHung2021 commented 2 years ago

Hello

I created some platoons at the signalized intersection.

And I saw that the platoons don't stop at red lights. only the leader vehicles stop. Could you show me how to fix this? Thanks

image

image

thardes2 commented 2 years ago

this is not possible without further ado. The car following model does not handle any traffic lights or regulations such as "right before left" or similar. You can work around this by instantiating the leader as a "DRIVER" and not as an "ACC". In case of a DRIVER, the Krauss model is used and traffic lights are considered. However, you will probably get further issues as the desired acceleration (as required by CACC) cannot be calculated and transmitted to the followers.

TrinhTuanHung2021 commented 2 years ago

this is not possible without further ado. The car following model does not handle any traffic lights or regulations such as "right before left" or similar. You can work around this by instantiating the leader as a "DRIVER" and not as an "ACC". In case of a DRIVER, the Krauss model is used and traffic lights are considered. However, you will probably get further issues as the desired acceleration (as required by CACC) cannot be calculated and transmitted to the followers.

Thank you for replying to me. I changed the setSpeedMode to 31 instead of 0. traci.vehicle.setSpeedMode(vid, 31)

But only the leader car stopped abruptly, and the following cars kept going through the front car. Do you know a way to make the following cars also stop when the leader car stops? Thanks

image giphy

And you can see, the simulator is lagged when the leader of platoon hits the red line

Q-max007 commented 2 years ago

But only the leader car stopped abruptly, and the following cars kept going through the front car. Do you know a way to make the following cars also stop when the leader car stops? Thanks

Hey, Have you solved this problem?

michele-segata commented 2 years ago

But only the leader car stopped abruptly, and the following cars kept going through the front car. Do you know a way to make the following cars also stop when the leader car stops? Thanks

I guess the issue here is that, by changing the speed mode, SUMO forces the vehicle to stop, but the vehicle itself still computes an ACC desired acceleration which is shared with the others. As SUMO slows down the vehicles, the ACC algorithm will compute a positive acceleration, because it wants to speed it up to reach the desired speed. So the other vehicles believe the leader will accelerate, while it is actually slowing down. But to confirm this, you should do some debugging by printing the values exchanged between the vehicles.

TrinhTuanHung2021 commented 2 years ago

thank you for replying to me. But how to print the value exchanged between vehicles?

I only know the position, speed and acceleration of vehicles over times

thardes2 commented 2 years ago

You first have to use the right controller. This would be either "CACC" or "Ploeg". ACC is not working since it is not suitable for platooning.

In case you use one of the two, the vehicle still relies on the 'controller acceleration', which cannot be provided by a human driven vehicle. This needs to be changed in the code, e.g. you use the real acceleration for the controller acceleration as well. This will very likely not keep the platoon string stable. Thus you somehow need to change the protocol for the beacon exchange or the properties of the controller. This is up to your scenario and your overall conditions.

TrinhTuanHung2021 commented 2 years ago

You first have to use the right controller. This would be either "CACC" or "Ploeg". ACC is not working since it is not suitable for platooning.

In case you use one of the two, the vehicle still relies on the 'controller acceleration', which cannot be provided by a human driven vehicle. This needs to be changed in the code, e.g. you use the real acceleration for the controller acceleration as well. This will very likely not keep the platoon string stable. Thus you somehow need to change the protocol for the beacon exchange or the properties of the controller. This is up to your scenario and your overall conditions.

Thank you for replying to me. I modified Segata's model by adding traffic signals to the model. I would like to check the behavior of platoons when approaching the red signal. I understand that I have to change the protocol but I do not know how to change it. Could you provide examples about Plexe API with traffic signals so I can follow it? Thanks

My model here

TrinhTuanHung2021 commented 2 years ago

Platoons with traffic signals.zip

michele-segata commented 2 years ago

Sorry for my late reply. What do you mean by

I would like to check the behavior of platoons when approaching the red signal. I understand that I have to change the protocol but I do not know how to change it.

It is not really clear to me what you want to do.

prasuka4 commented 2 years ago

Hi All, Even I'm facing the same issue, while vehicle reach the Junction/intersection... Vehicles are crossing the signal irrespective of phase of signal colour. I have tried to change the driver controller as well from IDM, ACC and CACC but none of them were working fine. Could you please solve this or provide any solution that could help in solving this issue. image

michele-segata commented 1 year ago

I guess the only way is to use the plexe::DRIVER controller in MSCFModel_CC for the leader, but then you still need to modify the car following model to be able to provide the followers with the required acceleration they need for control.

way-thu commented 1 year ago

@TrinhTuanHung2021 @michele-segata @prasuka4 @Q-max007 hi all, I'm facing the same issue, vehicles do not stop at red lights at signalized intersections, have you solved this problem?

TrinhTuanHung2021 commented 1 year ago

@TrinhTuanHung2021 @michele-segata @prasuka4 @Q-max007 hi all, I'm facing the same issue, vehicles do not stop at red lights at signalized intersections, have you solved this problem?

It related to the deceleration of vehicles in the platoon. If the leader stops suddenly, the following cars can not stop in time because the gap is too small. So I set the deceleration to be high to stop the following cars immediately.

thardes2 commented 1 year ago

The initial approach suggested by @michele-segata is to utilize the plexe:: DRIVER model. This will result in a scenario utilizing the actual acceleration rather than the desired acceleration. To resolve this issue, begin by setting the *.node[*].scenario.useControllerAcceleration value in the omnetpp.ini file to false.

This gives you a scenario where the actual acceleration is used instead of the desired one. As a consequence, this leads to a situation where the vehicles behind the leader in the platoon cannot respond "immediately" to the leader's actions, which could result in collisions. One potential solution is to increase the distance between the vehicles in the platoon.

Yet, by using the actual acceleration instead of the desired one, you cannot achieve the same 'performance' as in the ACC controlled scenario, but it will allow for successful stopping at red traffic lights.

way-thu commented 1 year ago

The initial approach suggested by @michele-segata is to utilize the plexe:: DRIVER model. This will result in a scenario utilizing the actual acceleration rather than the desired acceleration. To resolve this issue, begin by setting the *.node[*].scenario.useControllerAcceleration value in the omnetpp.ini file to false.

This gives you a scenario where the actual acceleration is used instead of the desired one. As a consequence, this leads to a situation where the vehicles behind the leader in the platoon cannot respond "immediately" to the leader's actions, which could result in collisions. One potential solution is to increase the distance between the vehicles in the platoon.

Yet, by using the actual acceleration instead of the desired one, you cannot achieve the same 'performance' as in the ACC controlled scenario, but it will allow for successful stopping at red traffic lights.

much thanks for your reply, i will try

way-thu commented 1 year ago

@TrinhTuanHung2021 @michele-segata @prasuka4 @Q-max007 hi all, I'm facing the same issue, vehicles do not stop at red lights at signalized intersections, have you solved this problem?

It related to the deceleration of vehicles in the platoon. If the leader stops suddenly, the following cars can not stop in time because the gap is too small. So I set the deceleration to be high to stop the following cars immediately.

much thanks, Can we exchange a wechat or something for better communication? i saw u on github so many times

thardes2 commented 1 year ago

Sorry - I mixed up the projects... The approach would work for the OMNeT implementation.

michele-segata commented 1 year ago

As I wrote in my answer above, you should use the Plexe::DRIVER controller for the leader and change the SUMO code so that you can fetch the acceleration of the human driver model via the API. Then you have to share such value with the followers in the platoon.