eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.49k stars 1.41k forks source link

Right/left turning vehicles block each other #7655

Open m-kro opened 3 years ago

m-kro commented 3 years ago

A left turning vehicle precedes the opposing right turning vehicle shortly, stops at the pedestrian crossing and remains there. Observed with v1.7.0 and current development version (Win10, 64bit version of SUMO).

In the attached example, it occurs at ca. time 2860, vehicles "Pkw.45.9" and "Pkw.37.12" are involved. After a few seconds, all the intersection is blocked. Unfortunately, I wasn't able to reduce the number of vehicles in the example simulation within a reasonable time. I tested several random numbers and it happens only with a few. When I remove vehicles from irrelevant streams, the problem disappears. results_K048_Festzeit_Nullfall1-los.zip

namdre commented 3 years ago

The following patch seems to solve the problem but I don't have time to test it thoroughly before my vacation:

diff --git a/src/microsim/MSLink.cpp b/src/microsim/MSLink.cpp
index 595381b340..69105603e4 100644
--- a/src/microsim/MSLink.cpp
+++ b/src/microsim/MSLink.cpp
@@ -174,8 +174,8 @@ MSLink::setRequestInformation(int index, bool hasFoes, bool isCont,
                 const MSLane* sibling = *it_lane;
                 const double minDist = MIN2(DIVERGENCE_MIN_WIDTH, 0.5 * (lane->getWidth() + sibling->getWidth()));
                 if (lane->getShape().back().distanceTo2D(sibling->getShape().back()) >= minDist) {
-                    // account for lateral shift by the entry links
-                    myLengthsBehindCrossing.push_back(std::make_pair(0, 0)); // dummy value, never used
+                    // indicate lack of conflict
+                    myLengthsBehindCrossing.push_back(std::make_pair(1000, 1000));
                 } else {
                     const double distAfterDivergence = computeDistToDivergence(lane, sibling, minDist, false);
                     const double lbcLane = lane->interpolateGeometryPosToLanePos(distAfterDivergence);
m-kro commented 3 years ago

The patch makes the problem disappear for this specific start seed. It happens again for other seeds and the left-turn of the opposite direction: seed 4, between "Pkw.15.1" and "Pkw.19.0". Detector outputs of the following seeds in [1;100] (using the patched SUMO) indicate similar problems:

61, 65, 76, 77, 86, 92, 96, 97

namdre commented 3 years ago

I could not observe deadlock after the latest junction logic fixes. Can you still trigger the problem with your systematic seed test?

m-kro commented 3 years ago

Yes. using the DLR development binary of today, seed 57 leeds to a deadlock. No other seed in the range [1;100] looks problematic anymore.