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

fix uturn policy on T junctions #1212

Merged
merged 3 commits into from
Dec 4, 2021
Merged

fix uturn policy on T junctions #1212

merged 3 commits into from
Dec 4, 2021

Conversation

kianzarrin
Copy link
Collaborator

@kianzarrin kianzarrin commented Dec 2, 2021

fixes #347
fixes #900

2 commits:
1st commit : simplifies code without any effective change the code.
2nd commit: fixes the u-turn issue

here U-turn routing of type LaneEndTransitionType.Default happens if it is a junction with 2 segments but not when it is a junction with 3 segments.

bool canTurn = !nextIsRealJunction || nextIsEndOrOneWayOut || hasFarTurnArrow;

note : nextIsRealJunction = nextNode.CountSegments() >= 3

So basically what this means is we have the picture bellow:
image
an orange relaxed u-turn routing on one side and a green default u-turn routing on the other side


How to test:

TMPE build: https://ci.appveyor.com/api/projects/krzychu124/tmpe/artifacts/TMPE.zip?branch=T-uturn-347

We can use bus stops to see if u-turn is possible. By using the "Buses may ignore lane arrows" policy we can test relaxed/default lane routing.
Buses may Ignore lane arrows policy (in original TMPE. this PR fixes this) = off
image
image

Buses may Ignore lane arrows policy = on
image

@kianzarrin kianzarrin added BUG Defect detected JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors U-Turn labels Dec 2, 2021
@kianzarrin kianzarrin self-assigned this Dec 2, 2021
@@ -1968,7 +1967,7 @@ bool laneChangesAllowed
// force u-turns to happen on the innermost lane
++compatibleLaneDist;
nextCompatibleTransitionDatas[nextTransitionIndex].type =
LaneEndTransitionType.Relaxed;
LaneEndTransitionType.Relaxed; // TODO : normal when u-turn allowed
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this. I deleted this comment in the next commit

Copy link
Member

@krzychu124 krzychu124 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok, not tested in game yet

@kianzarrin kianzarrin added this to the 11.6.0 milestone Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors U-Turn
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking path finding on cul-de-sacs T Junctions don't seem to have u-turns occur
4 participants