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

ExtNetInfo for lane grouping #1589

Open
Tracked by #1223
Elesbaan70 opened this issue Jun 3, 2022 · 11 comments · May be fixed by #1598
Open
Tracked by #1223

ExtNetInfo for lane grouping #1589

Elesbaan70 opened this issue Jun 3, 2022 · 11 comments · May be fixed by #1598
Assignees
Labels
feature A new distinct feature in-progress The problem is being solved currently LANE ROUTING Feature: Lane arrows / connectors

Comments

@Elesbaan70
Copy link
Contributor

Elesbaan70 commented Jun 3, 2022

NetInfo objects will be paired with new ExtNetInfo objects to provide extended information. Initially this will be to group car lanes based on medians and directionality. The ExtNetInfo objects will be generated on first request, and stored in a static instance of a backported ConcurrentDictionary keyed on the NetInfo reference.

Each car lane will be assigned a set of flags:

public enum LaneGroupFlags {
    Standard = 1 << 0,
    Express = 1 << 1,
    DisplacedInner = 1 << 2,
    DisplacedOuter = 1 << 3,
    Forward = 1 << 4,
    Backward = 1 << 5,
}

Forward and Backward do not directly map to the vanilla lane direction. They identify a lane group's prevailing vehicle direction, and may not match a specific lane's direction in some cases.

The lanes are organized in these steps:

  1. Apply Forward/Backward flags to car lanes.
  2. Identify displaced lanes based on the rules described below, and apply the DisplacedInner and DisplacedOuter flags.
  3. Identify medians based on the rules described below.
  4. For all lanes that are neither DisplacedInner nor DisplacedOuter:
    1. If a lane is inside a median in relation to other lanes in the same direction, apply the Express flag.
    2. For all other lanes, apply the Standard flag.

Once this is done, a collection of lane group objects are created and stored in the ExtNetInfo object. Each lane group contains a collection of car lanes having the same LaneGroupFlags. Note there will always be one lane group for one-way roads, and at least two lane groups for two-way roads.

public class LaneGroupInfo {

    public LaneGroupFlags m_flags;

    /// <summary>Aggregate of all lane types found in this group.</summary>
    public NetInfo.LaneType m_laneType;

    /// <summary>Aggregate of all vehicle types found in this group.</summary>
    public VehicleInfo.VehicleType m_vehicleType;

    /// <summary>lane indices, sorted by position</summary>
    public int[] m_lanes;
}

Displaced Lanes

"Left" and "right" here assuming you are looking down a segment from its starting end, so that negative positions are on the left and positive positions are on the right.

Note that when the road has a simple configuration with forward lanes on the left and backward lanes on the right, these are not considered displaced lanes. They are inverted, but not displaced.

Forward Lanes

  1. A forward lane is DisplacedOuter if all of the following conditions are true:
    1. There are no backward lanes to its left.
    2. There are backward lanes to its right.
    3. There are more forward lanes on the other side of the backward lanes.
  2. A forward lane is DisplacedInner if all of the following conditions are true:
    1. There are backward lanes both to its left and to its right.
    2. There are more forward lanes on the other side of the backward lanes to the right.

Backward Lanes

Displaced backward lanes are identified by reversing the rules for displaced forward lanes.

Medians

A non-car lane is considered a Median if either of these criteria are met:

  1. The lane is at a higher vertical offset than that of the car lanes around it, but the difference does not exceed 3 meters. (The 3-meter limit will prevent false positives on certain types of mass transit.)
  2. The gap between the nearest car lanes on either side is at least as wide as the widest of those lanes.

In addition, a Median lane cannot overlap any car lane.

@Elesbaan70 Elesbaan70 added feature A new distinct feature triage Awaiting issue categorisation labels Jun 3, 2022
@Elesbaan70 Elesbaan70 self-assigned this Jun 3, 2022
@Elesbaan70 Elesbaan70 added the in-progress The problem is being solved currently label Jun 3, 2022
@kianzarrin
Copy link
Collaborator

The lane is at a higher vertical offset than that of the vehicle lanes around it, but the difference does not exceed 3 meters. (The 3-meter limit will prevent false positives on certain types of mass transit.)

what if they are both car lanes?

@kianzarrin
Copy link
Collaborator

LaneGroupFlags can be added to ExtLane from ExtLaneManager. unless if you are worried about manager's dependencies and order of operations.

@Elesbaan70
Copy link
Contributor Author

what if they are both car lanes?

That's the point. Two car lanes with a non-vehicle lane between at a higher vertical offset.

@Elesbaan70
Copy link
Contributor Author

LaneGroupFlags can be added to ExtLane from ExtLaneManager.

That would produce an insane amount of redundant data. This information is all at the NetInfo level.

@Elesbaan70
Copy link
Contributor Author

I have decided that managers are not an appropriate pattern for this, and so it will follow the basic design of the displaced lane detection code I have already written.

@Elesbaan70 Elesbaan70 changed the title Enhancement: LaneGroupManager Enhancement: ExtNetInfo for lane grouping Jun 4, 2022
@Elesbaan70 Elesbaan70 added LANE ROUTING Feature: Lane arrows / connectors and removed triage Awaiting issue categorisation labels Jun 4, 2022
@kianzarrin
Copy link
Collaborator

kianzarrin commented Jun 4, 2022

what if there are two car lanes at different heights with no lanes in between?

@Elesbaan70
Copy link
Contributor Author

what if there are two car lanes at different heights with no lanes in between?

That sounds like a use case this wasn't designed to cover. Do you have any examples?

@kianzarrin
Copy link
Collaborator

kianzarrin commented Jun 4, 2022

or this?
image

maybe in future there will be something like this?
image

That sounds like a use case this wasn't designed to cover

I mean its not technically median but cars should sill not cross lanes. so yeah sounds like out of scope. I am just want to know about all possibilities. doesn't mean we need to handle them all.

@Elesbaan70
Copy link
Contributor Author

The example where the inner lanes are above grade at the interchange seems like it would be way outside the scope of this project.

The example with the lanes running alongside but below grade looks to me like it should be separate roads.

@Elesbaan70
Copy link
Contributor Author

NYC actually has express lanes that go above or below grade at some intersections. I chose not to include that in this project because there's a lot more involved than just routing and traffic light control.

image
image

@Elesbaan70
Copy link
Contributor Author

@Elesbaan70 Elesbaan70 linked a pull request Jun 9, 2022 that will close this issue
@Elesbaan70 Elesbaan70 changed the title Enhancement: ExtNetInfo for lane grouping ExtNetInfo for lane grouping Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new distinct feature in-progress The problem is being solved currently LANE ROUTING Feature: Lane arrows / connectors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants