Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSM device: questionable TTC and PET values #5527

Closed
m-kro opened this issue Apr 26, 2019 · 49 comments
Closed

SSM device: questionable TTC and PET values #5527

m-kro opened this issue Apr 26, 2019 · 49 comments

Comments

@m-kro
Copy link
Contributor

m-kro commented Apr 26, 2019

I evaluate conflict situations at a signalized intersection using the SSM device. Recently I have come across some strange values for TTC and PET measures I don't think they are intended:

  • min TTC of 0 is calculated for some vehicles when they approach the queue in front of the traffic light. However from looking at the GUI they do not collide. But minGap violation is not considered here, right?
  • very negative PET values (probably "-INVALID"?) are printed to the output value

Both phenomenons can be observed in the same example simulation attached...
results_K048_Festzeit_Nullfall1_ssm.zip

@namdre
Copy link
Contributor

namdre commented Apr 26, 2019

Thanks for the input example. From the description alone it looks like a duplicate of #4569 and #5033.

@m-kro
Copy link
Contributor Author

m-kro commented Apr 27, 2019

Some indication from the "ssm.trajectories" output: TTC=0 happens when both vehicles have come to a standstill (velocity vector -0.000,-0.000). For most time steps, "NA" is returned, but 0 for others. All in all looks like a numerical problem.

@namdre namdre self-assigned this Apr 27, 2019
@m-kro
Copy link
Contributor Author

m-kro commented Apr 29, 2019

Update:

  • computeTTC is called with negative gap values which triggers ttc=0.
  • These gaps result from eInfo.egoConflictEntryDist / eInfo.foeConflictEntryDist set in MSDevice_SSM::classifyEncounter
  • The origin of the error (at least for an example case) is a wrong position info given by MSVehicle::getBackPositionOnLane() on an internal lane: The current position of the vehicle on the lane is far too low and gets negative when the vehicle length is substracted.

@m-kro
Copy link
Contributor Author

m-kro commented Apr 29, 2019

We're getting closer: It seems SSM device does not consider split connections properly when calculating the distance. In my example, the gap between two vehicles drops sharply when the first touches the ped crossing. The variable egoDistToConflictLane stays at 0 for an ego vehicle waiting at the traffic light upstream.

@m-kro
Copy link
Contributor Author

m-kro commented Apr 30, 2019

Snippet of the SSM DEBUG output showing the last timestep with NA value and the first with TTC=0. Veh. Pkw1.4 wants to follow Pkw1.2 and turn right but stops at the red signal. Pkw1.2 reaches the stopping position at the pedestrian crossing.

135.80 updateEncounter() of vehicles 'Pkw.1.4' and 'Pkw.1.2'
classifyEncounter() called.
135.80 findFoeConflictLane() for foe 'Pkw.1.2' on lane ':K048_Nord_0_0' (with eg
oConflictLane=:K048_Nord_0_0)
foeBestLanes: NULL gneE54_0 -gneE7_0
Potential conflict on junction 'K048_Nord
egoConflictLane: ':K048_Nord_0_0'
foeConflictLane: ':K048_Nord_0_0'
Ego's distance to conflict lane: 0.00
Foe's distance to conflict lane: -20.59
-> Encounter type: Ego 'Pkw.1.4' on lane 'gneE50_0' follows foe 'Pkw.1.2' on lan
e ':K048_Nord_0_0' (gap = 16.97, egoDistToCOnflictLane = 0.00)
135.80 estimateConflictTimes() for ego 'Pkw.1.4' and foe 'Pkw.1.2'
    encounter type: FOLLOWING_FOLLOWER
    egoConflictEntryDist=16.969, foeConflictEntryDist=NA
    ego speed=0.00, foe speed=1.06
    encouter type FOLLOWING_FOLLOWER -> no entry/exit times to be calculated.
135.80 checkConflictEntryAndExit() for encounter of vehicles 'Pkw.1.4' and 'Pkw.
1.2'
135.80 determineConflictPoint()
    Conflict at 32.23,150.21
135.80 computeSSMs() for vehicles 'Pkw.1.4' and 'Pkw.1.2'
135.80 determineTTCandDRAC() for encounter of vehicles 'Pkw.1.4' and 'Pkw.1.2' (
type = FOLLOWING_FOLLOWER)
computeTTC() with gap=16.97, followerSpeed=0.00, leaderSpeed=1.06
ttc=INVALID, drac=INVALID
135.80 determinePET() for encounter of vehicles 'Pkw.1.4' and 'Pkw.1.2'(type: FO
LLOWING_FOLLOWER)
computeSSMs() for encounter of vehicles 'Pkw.1.4' and 'Pkw.1.2':
  ttc=INVALID, drac=INVALID, pet=INVALID
135.80 Adding data point for encounter of 'Pkw.1.4' and 'Pkw.1.2':
type=FOLLOWING_FOLLOWER, egoDistToConflict=16.969, foeDistToConflict=NA,
ttc=NA, drac=NA, pet=NA

135.90 updateEncounter() of vehicles 'Pkw.1.4' and 'Pkw.1.2'
classifyEncounter() called.
135.90 findFoeConflictLane() for foe 'Pkw.1.2' on lane ':K048_Nord_9_0' (with eg
oConflictLane=:K048_Nord_0_0)
foeBestLanes: NULL gneE54_0 -gneE7_0
Potential conflict on junction 'K048_Nord
egoConflictLane: ':K048_Nord_0_0'
foeConflictLane: ':K048_Nord_9_0'
Ego's distance to conflict lane: 0.00
Foe's distance to conflict lane: -0.02
-> Encounter type: Ego 'Pkw.1.4' on lane 'gneE50_0' follows foe 'Pkw.1.2' on lan
e ':K048_Nord_9_0' (gap = -3.60, egoDistToCOnflictLane = 0.00)
135.90 estimateConflictTimes() for ego 'Pkw.1.4' and foe 'Pkw.1.2'
    encounter type: FOLLOWING_FOLLOWER
    egoConflictEntryDist=-3.601, foeConflictEntryDist=NA
    ego speed=0.00, foe speed=1.30
    encouter type FOLLOWING_FOLLOWER -> no entry/exit times to be calculated.
135.90 checkConflictEntryAndExit() for encounter of vehicles 'Pkw.1.4' and 'Pkw.
1.2'
135.90 determineConflictPoint()
    Conflict at 32.11,150.15
135.90 computeSSMs() for vehicles 'Pkw.1.4' and 'Pkw.1.2'
135.90 determineTTCandDRAC() for encounter of vehicles 'Pkw.1.4' and 'Pkw.1.2' (
type = FOLLOWING_FOLLOWER)
computeTTC() with gap=-3.60, followerSpeed=0.00, leaderSpeed=1.30
ttc=0.000, drac=INVALID
135.90 determinePET() for encounter of vehicles 'Pkw.1.4' and 'Pkw.1.2'(type: FO
LLOWING_FOLLOWER)
computeSSMs() for encounter of vehicles 'Pkw.1.4' and 'Pkw.1.2':
  ttc=0.000, drac=INVALID, pet=INVALID
135.90 Adding data point for encounter of 'Pkw.1.4' and 'Pkw.1.2':
type=FOLLOWING_FOLLOWER, egoDistToConflict=-3.601, foeDistToConflict=NA,
ttc=0.000, drac=NA, pet=NA

@namdre
Copy link
Contributor

namdre commented Apr 30, 2019

@m-kro I have trouble reproducing the situation above. When calling manual.sumofg with version 1.1, 1.2 or the latest development version, the vehicles are far past the junction at time 135. Any idea why that could be?

@m-kro
Copy link
Contributor Author

m-kro commented Apr 30, 2019

Sorry, I have used a slightly different configuration (see below) for that output. Essentially, the traffic demand from other than the northern aproach has been deleted to concentrate on the described error case.
results_K048_Festzeit_Nullfall1_v2.zip

namdre added a commit that referenced this issue May 2, 2019
namdre added a commit that referenced this issue May 2, 2019
@namdre
Copy link
Contributor

namdre commented May 2, 2019

I'm not confident enough to close this issue as I'm still unfamiliar with the code base but the reported situation should be fixed now.

m-kro added a commit to m-kro/sumo that referenced this issue May 5, 2019
Signed-off-by: m-kro <m.barthauer@t-online.de>
@m-kro
Copy link
Contributor Author

m-kro commented May 5, 2019

You didn't consider the inverse vehicle relation (both are equipped with the SSM device). I will submit a pull request shortly.

@m-kro
Copy link
Contributor Author

m-kro commented May 5, 2019

There is at least one crossing situation with invalid TTC/PET, too. I'll try to provide you with a reproducible example. Just what happens: The foe vehicle turns left and stops in front of the ped crossing there. The ego vehicle arrives from the opposite direction and passes behind the foe vehicle. However, the conflict position is set to the front of the foe vehicle.

namdre pushed a commit that referenced this issue May 5, 2019
Signed-off-by: m-kro <m.barthauer@t-online.de>
@m-kro
Copy link
Contributor Author

m-kro commented May 5, 2019

Have a look at the following conflict using the sumocfg from the first post in this thread.
<conflict begin="1484.800" end="1499.900" ego="Pkw.20.35" foe="Pkw.15.1"> <minTTC time="1491.500" position="43.938,102.859" type="12" value="0.000"/> <PET time="1491.449" position="43.938,102.859" type="17" value="-179769313486231610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000"/> </conflict>
I cannot say more because now, SUMO crashes shortly afterwards, because MSVC has detected a failing assertion.

@m-kro
Copy link
Contributor Author

m-kro commented May 7, 2019

Reminder for another case observable within the same simulation:
<conflict begin="1870.700" end="1934.600" ego="Lkw.26.0" foe="Pkw.26.4"> <minTTC time="1912.000" position="5.829,-2.152" type="3" value="0.000"/> <PET time="NA" position="NA" type="NA" value="NA"/> </conflict>
A truck drives on the right lane and a car a little bit in front on the left lane. Exactly at the zipper downstream where both lanes merge into one, the car changes to the right and takes the right connection. A TTC of 0 is calculated as long as the car front is still on the connection. Used SUMO development version SUMO Version v1_2_0+0249-c1454c8871 / downloaded on 06.05.2019.

@m-kro
Copy link
Contributor Author

m-kro commented May 8, 2019

Current development versions now stop with an invalid operator exception:
grafik
Is there a memory leak somewhere? @namdre Could you please have a look?

@m-kro
Copy link
Contributor Author

m-kro commented May 16, 2019

In my example, two conflicts are detected during the same simulation step and are closed after a while. When they are to be sorted in the priority_queue type data structure, the invalid operator error occurs. To our knowledge, the custom compare function provided by the SSM device does not fulfil the requirements listed at C++ reference, as explained in #5387 .

@namdre
Copy link
Contributor

namdre commented May 16, 2019

Changing the definition of Encounter::compare from
return e1->begin >= e2->begin
to
return e1->begin > e2->begin
should fix the strict-weak-ordering requirement.
I currently cannot test this as I only have access to a Linux machine at the moment where the relevant check is not performed (as far as I know).

@akstrfn
Copy link

akstrfn commented May 16, 2019

That will reverse the order of items that have the same value. Though this does not mean that the old code did not have a bug.

#include <iostream>
#include <sstream>
#include <queue>

using namespace std;
struct S { int idx; int val; };

int main()
{
    auto print = [](auto q) {
        stringstream ss;
        cout << "idx=";
        while(!q.empty()){ 
            cout << q.top().idx;
            ss << q.top().val;
            q.pop();
        }
        cout << "\nval=" << ss.str() << endl;
    };

    vector<int> v = {1,2,3,4,3,6,3,8,3};

    auto cmp1 = [](S l, S r) { return l.val > r.val; };
    priority_queue<S, vector<S>, decltype(cmp1)> q1(cmp1);

    auto cmp2 = [](S l, S r) { return l.val >= r.val; };
    priority_queue<S, vector<S>, decltype(cmp2)> q2(cmp2);

    for (int i=0; i < v.size(); ++i){
        S tmp{i, v[i]};
        q1.push(tmp);
        q2.push(tmp);
    }

    cout << ">" << endl;
    print(q1);
    cout << ">=" << endl;
    print(q2);
}

will produce

>
idx=012648357
val=123333468
>=
idx=018246357
val=123333468

@namdre
Copy link
Contributor

namdre commented May 16, 2019

I think the order of elements with the same begin value should not matter here.
What's your take on this @leoluecken ?

@m-kro
Copy link
Contributor Author

m-kro commented May 19, 2019

Debug output from the simulation linked in the first post. An invalid TTC=0 is calculated for the ego vehicle Pkw.21.7 turning left. Only the relevant lines (last time step before and first time step with TTC=0) are displayed.

1312.70 updateEncounter() of vehicles 'Pkw.21.7' and 'Pkw.14.33'
classifyEncounter() called.
Ongoing crossing conflict will be traced by passedEncounter().
1312.70 updatePassedEncounter() for vehicles 'Pkw.21.7' and 'Pkw.14.33'
Encounter was previously classified as a crossing situation of type BOTH_ENTERED_CONFLICT_AREA.
egoConflictEntryDist = -14.07, egoConflictExitDist = -7.64
foeConflictEntryDist = -6.77, foeConflictExitDist = -0.24
Updated classification: BOTH_LEFT_CONFLICT_AREA
1312.70 estimateConflictTimes() for ego 'Pkw.21.7' and foe 'Pkw.14.33'
encounter type: BOTH_LEFT_CONFLICT_AREA
egoConflictEntryDist=-14.073, foeConflictEntryDist=-6.768
ego speed=2.35, foe speed=13.42
Conflict type: BOTH_LEFT_CONFLICT_AREA
egoConflictEntryTime=0.000, foeConflictEntryTime=0.000
1312.70 checkConflictEntryAndExit() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33'
foe left conflict area at t=1312.68
1312.70 determineConflictPoint()
Conflict at 36.27,141.08
1312.70 computeSSMs() for vehicles 'Pkw.21.7' and 'Pkw.14.33'
1312.70 determinePET() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33'(type: BOTH_ENTERED_CONFLICT_AREA)
e->egoDistsToConflict.back() = -13.84
e->egoConflictEntryTime = 1306.16
e->egoConflictExitTime = 1307.98
e->foeDistsToConflict.back() = -5.43
e->foeConflictEntryTime = 1312.19
e->foeConflictExitTime = 1312.68
Calculated PET = 4.21 (at t=1312.19)
computeSSMs() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33':
ttc=INVALID, drac=INVALID, pet=4.205
1312.70 Adding data point for encounter of 'Pkw.21.7' and 'Pkw.14.33':
type=BOTH_LEFT_CONFLICT_AREA, egoDistToConflict=-14.073, foeDistToConflict=-6.768,
ttc=NA, drac=NA, pet=4.205
1312.80 updateEncounter() of vehicles 'Pkw.21.7' and 'Pkw.14.33'
classifyEncounter() called.
1312.80 findFoeConflictLane() for foe 'Pkw.14.33' on lane ':K048_Nord_1_1' (with egoConflictLane=:K048_Nord_10_0)
foeBestLanes: NULL gneE55.0_1 gneE59_1 gneE60_1 gneE39_1 -gneE32_0
Potential conflict on junction 'K048_Nord
egoConflictLane: ':K048_Nord_10_0'
foeConflictLane: ':K048_Nord_1_1'
Ego's distance to conflict lane: -15.23
Foe's distance to conflict lane: -31.20
Determined exact conflict distances for crossing conflict.
crossingOrientation=1.00, egoCrossingAngle=2.13, foeCrossingAngle=-1.94, relativeAngle=-2.21 (foe from right)
resulting offset for conflict entry distance:
ego=0.00, foe=0.00
distToConflictLane:
ego=-21.23, foe=-31.20
distToConflictFromJunctionEntry:
ego=6.90, foe=23.08
resulting entry distances:
ego=-14.33, foe=-8.12
resulting exit distances:
ego=-7.90, foe=-1.59
real egoConflictLane: ':K048_Nord_10_0'
real foeConflictLane: ':K048_Nord_1_1'
-> Encounter type: Crossing situation of ego 'Pkw.21.7' on lane ':K048_Nord_10_0' and foe 'Pkw.14.33' on lane ':K048_Nord_1_1'
Distances to crossing-point: ego: -14.33, foe: -8.12
1312.80 estimateConflictTimes() for ego 'Pkw.21.7' and foe 'Pkw.14.33'
encounter type: CROSSING
egoConflictEntryDist=-14.328, foeConflictEntryDist=-8.121
ego speed=2.54, foe speed=13.53
Conflict type: CROSSING
egoConflictEntryTime=0.000, foeConflictEntryTime=0.000
-> foe is estimated leader at conflict entry. foeConflictExitTime=0.000
1312.80 checkConflictEntryAndExit() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33'
1312.80 determineConflictPoint()
Conflict at 28.92,146.64
1312.80 computeSSMs() for vehicles 'Pkw.21.7' and 'Pkw.14.33'
1312.80 determineTTCandDRAC() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33' (type = CROSSING_FOLLOWER)
computeTTC() with gap=-14.33, followerSpeed=2.54, leaderSpeed=0.00
ttc=0.000, drac=INVALID
1312.80 determinePET() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33'(type: BOTH_LEFT_CONFLICT_AREA)
PET unappropriate for merging and pre-crossing situations. No calculation performed.
computeSSMs() for encounter of vehicles 'Pkw.21.7' and 'Pkw.14.33':
ttc=0.000, drac=INVALID, pet=INVALID
1312.80 Adding data point for encounter of 'Pkw.21.7' and 'Pkw.14.33':
type=CROSSING_FOLLOWER, egoDistToConflict=-14.328, foeDistToConflict=-8.121,
ttc=0.000, drac=NA, pet=NA

@m-kro
Copy link
Contributor Author

m-kro commented May 20, 2019

Anyhow, the already passed encounter is classified again as "CROSSING_FOLLOWER". Still it is quite difficult to say where this standard case should be catched...

@namdre
Copy link
Contributor

namdre commented Jun 17, 2019

Do you think you could manage to recreate the problematic situation with fewer vehicles? That would really help in debugging.

@m-kro
Copy link
Contributor Author

m-kro commented Jun 17, 2019

Well I will try. But I fear that the number of vehicles may be a necessary condition for this to happen.

@namdre
Copy link
Contributor

namdre commented Jun 17, 2019

I found one bug related to the distance computation. The debug output looks more sensible now but I still don't see the encounter in the xml output.

@namdre
Copy link
Contributor

namdre commented Jun 18, 2019

My mistake, I did not think to increase the ttc treshold sufficiently. Now I get a value of 1.949 for the conflict between Pkw.33.4 and Pkw.25.4 (at time 1996.6)
The results are consistent between daily windows build, custom windows build and custom linux build.

@m-kro
Copy link
Contributor Author

m-kro commented Jun 19, 2019

I can confirm that. Thank you for your help! Nonetheless, I think I will explore some more runs to see whether there are more seldom error cases. It still frightens me that my debug built didn't exhibit the same behaviour...

@m-kro
Copy link
Contributor Author

m-kro commented Jun 19, 2019

And I was too fast. The collision notice in the SSM log has reappeared after some simulation runs of the same sumocfg :-( Maybe still some memory issue?

@m-kro
Copy link
Contributor Author

m-kro commented Jun 19, 2019

I have compared the logged speeds and positions for this conflict between the most recent DLR built (producing minTTC=0 at time 2002.3s) and my own debug built (minTTC=2.585s at 1996.9s). Even the ego speed and position data is slightly different from the beginning of the conflict.

@namdre
Copy link
Contributor

namdre commented Jun 19, 2019

I did notice conflict outputs change their order so I can confirm there is non-determinism somewhere.
When you send your confirmation 6 hours ago and then retracted it, I assume you got different results with the same input for different builds. Did you also get different results for the same input and same build?
If so, how stable are the results when running with the same setup

@m-kro
Copy link
Contributor Author

m-kro commented Jun 19, 2019

Yes, I also got different results for the current DLR build. That's why I first thought that the error went away when this morning I ran the first simulation on my computer. When I ran it again just to be sure, TTC=0 reappeared. All following runs also feature TTC=0. On the other hand, I managed to run it 3 times on another computer with more RAM and every time got your TTC value (1.949s).

@m-kro
Copy link
Contributor Author

m-kro commented Jun 25, 2019

@namdre: You asked for a scenario with less vehicles. At least, I can indicate one with a shorter duration: Please use seed 7. There is a conflict
<conflict begin="129.100" end="162.000" ego="Pkw.9.1" foe="Pkw.1.3"> with TTC=0 which gets printed to the SSM log. But strangely enough, a TTC=0 conflict between left-turning "Pkw.9.1" and oncoming "Pkw.2.12" was detected in Visual Studio but not in the file output. The named vehicles are in the intersection at the same time.

@m-kro
Copy link
Contributor Author

m-kro commented Jun 30, 2019

The last conflict (Pkw.9.1 vs. Pkw1.3) is due to a limitation in the SSM design: A "merging" conflict is re-classified as "following" as early as the front of the leader vehicle reaches the target lane. However, the relative back position of the leader and the position of the follower are combined into the conflict distance which influences TTC (see source). It is forgotten that the vehicles do not travel along the same route yet, given that they are still (partially) on different connections.

@namdre
Copy link
Contributor

namdre commented Jul 1, 2019

What do you think about changing the design so that the reclassification only happens when the leader has completely left the intersection?

@m-kro
Copy link
Contributor Author

m-kro commented Jul 2, 2019

I'm already looking into that. Is there any easy way to check this? Note that in this message, "leader" refers to the vehicle reaching the merging area first, "follower" to the second vehicle. Some thoughts on how to check the vehicle positions more thoroughly:

Requirements:

  1. The "leader" vehicle occupies the conflict lane partially. Depending on the vehicle length and the road network, this is more or less easy.
  2. The "leader" vehicle still occupies an (internal) edge partially where the "follower" vehicle does not pass by.
  3. The conflict has been classified as MERGING before.

Conditions:

  • Would be good if the solution worked with long vehicles spanning over multiple short intersections.

Implementation:

  • The routes can be accessed somehow using MSVehicle / BaseVehicle but I'm not sure whether this is the best way.
  • Should this situation be classified as [MERGING_LEADER|MERGING_FOLLOWER] given that the leader has reached the conflict area?

@m-kro
Copy link
Contributor Author

m-kro commented Jul 11, 2019

Next problem: TTC << 1s for vehicles at big distances like below:
grafik
SUMO calculates a TTC of 0.009s between the vehicle in the upper left and the second one in the queue in the lower right corner. This has been tested on multiple computers. Further info will follow after debugging. It is the same network, seed 27:
<conflict begin="432.800" end="448.200" ego="Pkw.12.3" foe="Pkw.5.0"> <minTTC time="440.300" position="28.707,140.526" type="11" value="0.009"/> <PET time="NA" position="NA" type="NA" value="NA"/> </conflict>

@m-kro
Copy link
Contributor Author

m-kro commented Jul 12, 2019

Looks again like the internal data structures of the SSM device get corrupted. The error from the previous post happens because the estimated conflict times are invalid at the time of TTC calculation - which they shouldn't for crossing conflicts...

@m-kro
Copy link
Contributor Author

m-kro commented Jul 12, 2019

The last problem is caused by the design of the FoeInfo data structure:

  • The vehicle scan range may cover two directly connected intersections
  • The ego vehicle heads straight through both intersections, the foe vehicle comes from the opposite direction, goes straight and then turns left
  • There are two possible FoeInfo instances: one for each intersection, leading either to a crossing encounter or being scrapped as non-conflict
  • Only one is stored in the FoeInfoCollector (see src), the other is thrown away

Strangely enough, the crossing conflict is detected at least once and then overwrites the non-conflict encounter types chosen in following time steps. For this reason, estimated conflict times are not initialised.

@namdre
Copy link
Contributor

namdre commented Jul 12, 2019

Thanks for diving into this mess. I won't have time to do anything about it for at least the next two weeks though as I'm going offline (vacation).

@m-kro
Copy link
Contributor Author

m-kro commented Jul 30, 2019

After some more time, I think it is a matter of how the scan is implemented. Currently, all foe vehicles on a junction get assigned the same ego conflict lane on the same junction. This is misleading for vehicles which have no conflict with the ego vehicle there but at another place. Both locations are marked in yellow here:
grafik
I have changed the scan to remember visited lanes instead of junctions - always only considering the foe lanes - to repair the conflict lane assignments. Almost every case of too small TTC went away. At least the debug GUI is fare slower now and I still miss some corner cases with sequential internal lanes and pedestrian lanes (even if they are relevant yet). @namdre: Is there some documentation on the internal junction structure? For example

  • how to traverse a junction upstream,
  • how to query all internal lanes leading to an outgoing edge,
  • are there differences between the first and the second internal lane
  • what about pedestrian crossings...

EDIT: The new scan order can be reviewed in my fork...

@namdre
Copy link
Contributor

namdre commented Aug 8, 2019

  • forward travelsal of the lane graph
 for (MSLink* link :  lane->getLinkCont()) {
     MSLane* next = link->getViaLaneOrLane();
     MSLane* nextNormal = link->getLane();
     MSLane* nextInteral = link->getViaLane() // maybe nullptr
 }
  • backward traversal of the lane graph:
for (auto ili : lane->getIncomingLanes()) {
   MSLane* prev = ili.lane;
   MSLink* linkFromPrev = ili.viaLink;
}
  • there are no differences between the first and second internal lane in terms of the graph structure

  • pedestrian crossings are not linked to road lanes directly. The structure is
    sidewalkLane->walkingArea->crossing->walkingArea->sidewalkLane

    to get the crossing that interacts with a given internal lane:

  MSLink* exitLink = internalLane->getLinkCont().front();
  for (MSLane* foe : exitLink->getFoeLanes()) {
       if (foe->getEdge().isCrossing()) {
         ...
       }
  } 

@rummel123
Copy link
Contributor

rummel123 commented Nov 24, 2020

I also get odd values:

  • very negative value for PET with type "111"; situation is a lane change on the junction due to a jammed vehicle on the crossing lane fixed
  • value 0.00 for PET with type "111"; situation is a left turn behind an opposite vehicle fixed
  • many negative values for TGAP, mostly between 0 and -10, but somtimes also -56000 (more than 30 times) fixed
    odd_ssm_device.zip

@namdre
Copy link
Contributor

namdre commented Nov 24, 2020

The negative tgap values were fixed yesterday via #7844

@behrisch
Copy link
Contributor

behrisch commented Jan 2, 2022

I must admit I did not read everything but can this be closed?

@namdre
Copy link
Contributor

namdre commented Jan 3, 2022

Yes. Anyone still seeing questionable values should open up a new issue.

@namdre namdre closed this as completed Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants