michele-segata / plexe-pyapi

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

Collisions in LOW SPEED and JUNCTION #6

Closed warm2018 closed 3 years ago

warm2018 commented 3 years ago

Hi Michele: Recently, I used the plexe-pyapi tool to simulate more complex traffic scenario, but some errors and problems confused me.

Problems descriptions: I simulate a bottleneck sceneriao which contains Autonomous Vehicles(AV) and Human Driven Vehicles(HDV): 1)AV: CC-cfmodel vehicles (ACC OR CACC) ; 2)HDV: Wideman99

When I use the plexe-pyapi tool to form AV platoons(set the CC vehicles to CACC model) dynamicly during simulation running, some longcollisions occur: 1) The ACC collide with HDV(leading CC vehicles can't brake in time, have a crash with the preceding HDV) 2) The CACC vehicles collide with CACC vehicles(CACC vehicles in the position4 OR bigger chase the preceding vehicle, but can't decelerate with proper deceleration when catch the desire gap, the collision happen, like the figure )

image

In addition to the collision, it seems that the CACC platooning vehicles will ignore the right of ways in junctions, and the platooning vehicles can't wait other vehicles which have the potential conflict with them, and they drive agressively and collisions occur in junction.

image

Note: PATH_CACC and plog_CACC are used. Both have the above problems. The SUMO1.8.0, ubuntu 18, python3.7 are used.

michele-segata commented 3 years ago

I will try to answer your question but I might need more context. First of all I don't know whether green vehicles are AVs or HDVs. I guess green are AVs. My guess is that all the problems come out from what you are saying in you last issue: AVs do not give the right of way. Indeed, it is wrong to call them AVs: they just implement longitudinal control (ACC or CACC). As in real life, an ACC doesn't give the right of way, nor it stops at a red light. It is a duty of the driver to manage such situations. Indeed in my simulations, when a car needs to enter the highway (similarly scenario to what is shown in your last figure) I let the human car following model drive the car. When the car is in the highway, I switch the control to the ACC. Could this work for you? Or do you need to simulate a more complex scenario?

warm2018 commented 3 years ago

Thanks, very useful guidance.
Yes, green are AVs, sorry for my carelessness.
Yes, the ACC or CACC controller does't have to give the right of way, because they are just a longitudinal control model.

My question in clear version is that why : When I implement the AVs as ACC model(not ACC in CC model, another ACC model in SUMO) or IDM model, the AVs behave normally near junction(approaching lane), they stop and obey the rules of right of way in junction, to avoid the colloisions. But when I implement the CACC model( CC) (using plexe-pyapi, setting thee leaders and members topology) to the same AVs, they ignore the rules, collision ocurrs, deadlock happen. As far as I know, the right of way in junction is implemented by JUNCTION model, maybe I guess that this junction model doesn't consider the CC cfmodel ?

Yes, I plan to simulate the bottleneck(two lanes change to one lane, which forms a junction, we must set the right of way of the platoons ) sceneriao under the mixed traffic, to discuss the relationship between the CACC platoons and bottleneck capacity(throughput). I plan to dynamicly change the topology of the platoon in certain rules, and get the throughput reuslts.

thank you again!

michele-segata commented 3 years ago

My question in clear version is that why : When I implement the AVs as ACC model(not ACC in CC model, another ACC model in SUMO) or IDM model, the AVs behave normally near junction(approaching lane), they stop and obey the rules of right of way in junction, to avoid the colloisions. But when I implement the CACC model( CC) (using plexe-pyapi, setting thee leaders and members topology) to the same AVs, they ignore the rules, collision ocurrs, deadlock happen. As far as I know, the right of way in junction is implemented by JUNCTION model, maybe I guess that this junction model doesn't consider the CC cfmodel ?

The reason is that the ACC model in SUMO (not the one in CC) is designed as a mix of human behavior and assisted driving. My model is specifically design to ignore such things (right of way, traffic lights, ecc) because it was thought to be as a real ACC which, if not switched off when approaching a traffic light, will simply continue straight. It is not the junction that controls the behavior of the vehicles. The SUMO logic informs the car-following model about potential obstacles ahead, asking what the model would do in such a case. The SUMO logic then picks minimum speed computed by the model under different circumstances. My ACC model always returns the speed it would like to drive at (considering slow vehicles ahead) and, as a result, it never brakes when approaching a junction or a traffic light.

Yes, I plan to simulate the bottleneck(two lanes change to one lane, which forms a junction, we must set the right of way of the platoons ) sceneriao under the mixed traffic, to discuss the relationship between the CACC platoons and bottleneck capacity(throughput). I plan to dynamicly change the topology of the platoon in certain rules, and get the throughput reuslts.

I have to say that this is not a simple scenario, because merging platoons when switching from N to N-1 lanes, is not a simple maneuver, but it requires coordination. Before a platoon can change lane, you must ensure that all members have room for doing so: it cannot be done independently by each vehicle. So I fear you need to touch the code to do what you want. I currently implement a platoon lane change logic which is "magic", meaning that, when the leader wants to change lane (because, for example, it can gain speed by doing so), it queries the status of all the platoon members and, if all can do so, then they all change lane simultaneously. You could start by looking into this logic here. This is something I could work on, but not in the immediate future. So if you come up with a solution we might revise this together.

warm2018 commented 3 years ago

Very helpful guide,and this inspired me a lot, thank you! Yes, I am totally agree with you, and my thinkings about this as follows: I think platoon can not only be used for the ordinary highway free lanes, but also the merging or diverging scenarios, even the junctions(in fact, in SUMO, and all these sceneriaos are modeled by "junction",which define the conflict streams and coordination rules). Because these are the key points and bottlenecks of whole network. If we can applicate the CACC platooning technology in those bottlenecks(especially the area which has conflict streams), the benefit of short gap and quickly response will be maximized to the throughput and energy saving. If I can implement the same logic in junction like the platoon lane changing as you mentioned above, let platoon can be seen as a control unit (like a vehicle) by junction rules(accurately:the platoon see themselves as a unit when they approaching junctions), my problems will be solved I think. More generally, we can simulate the platoon at any scenario with conflict stream.

As far as I know, the junction rules in SUMO is based on FCFS policy and priroty rules. In every simulation step, the request of vehicle are coordinated, and the vehicles judge whether if it can pass the junction safely(more details can be found in https://sumo.dlr.de/docs/Simulation/Intersections.html#waiting_within_the_intersection). So the logic can be simply represented as : If(Vehicle is HDV): Requests = one vehicle’s request(estimated time slots for the junction) If(Vehicle is CACC leader vehicle): Requests = platoon ’requests(the leader’s time slots is upper bound, the last follower’s time slot are lower bound) Of course, the implementations can’t be so easy, the length and the speed and special cases should be considered in details.

I am very happy to do this work and make the plexe in sumo is more friendly, robust for complex scenarios. But I am not familiar with the src of SUMO(Actually, I am beginner for the C++ :}). Maybe Before the implementation, I will know about more from the logic and source code for days.

michele-segata commented 3 years ago

I am very happy to do this work and make the plexe in sumo is more friendly, robust for complex scenarios. But I am not familiar with the src of SUMO(Actually, I am beginner for the C++ :}). Maybe Before the implementation, I will know about more from the logic and source code for days.

Changing the logic might be though then. The SUMO codebase is huge and pretty complicated, and with no prior C++ knowledge it is very hard to make changes. I'll wait for further notice from you. In the meanwhile, I am closing this.