-
Notifications
You must be signed in to change notification settings - Fork 85
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
Displaced lane support in traffic light simulation #1392
Comments
@krzychu124, I've thought about this more based on our conversation on Discord, reexamined my use cases, and had a good look at the code. Controlling traffic lights by lane would be really cool, but it's not realistic since the existing code treats it as a directional problem. But in reality, crossovers are a directional problem anyway, and reexamining my use cases confirms that. I could offer you some great use cases for traffic light control by lane, but this is not one of them. A crossover is, in terms of traffic control, almost exactly the same thing as a far turn, and it should be treated as such. Both movements conflict with oncoming traffic, which is why they require a separate traffic light phase. I will rewrite this feature request based on these findings. |
Regarding lane traffic crossing in the junction causing conflict points: #4 |
If this is implemented, Adaptive Networks should probably be given some related flag support. Not needed for this enhancement, but useful for asset creators. |
Could you clarify the terminology here:
Is |
"Position" means the value of the Position field in the editor. "Forward" and "Backward" are the directions as indicated in the editor. |
I have added definitions for Position, Forward Lane, and Backward Lane. |
I'm wondering if this feature could also provide a good opportunity to experiment with new traffic light editing UI? Rather than using the floating traffic light icons, would it be better to 'highlight lanes' on the map, showing red/green (plus some other visual cue, such as fill or border style, for color blind users)? Toggling traffic light state for the lane would involve simply clicking the lane and would give immediate on-lane feedback (eg. the 'lane highlight' would change colour/etc)...? |
I would create at least simplified version of overlaymanager mentioned in other issue. Btw, I've been experimenting with animated shader texture (scrollable texture that follows shape of path) to display custom animated thingy as we see entering into traffic routes view (or via Traffic Report mod) |
Yesssss :) The arrows would start flowing when the light goes green. Want! |
Seems like a good idea on the one hand. On the other hand, maybe best not to needlessly link two features of significant effort that could exist independently of each other? |
This feature is being implemented here: https://github.com/Elesbaan70/TMPE/tree/lane-grouping |
An additional requirement has been added this issue's main description, for the RoutingManager to prevent lane changes across oncoming traffic. |
The date shown is when it was originally posted. If you click on "edited" it will show the edit history. The change is under the "Lane Transitions" heading and states that it only applies on nodes with two segments. |
Note - This issue has been completely rewritten, and so some comments before 27-March-2022 may be outdated and irrelevant. A more extensive discussion of this issue can be found at #1428
Description
Detect lanes that run in a nonstandard direction, and use them as a basis for traffic light grouping.
There are three use cases already identified for displaced lanes: Continuous Flow Intersections and Turnaround Lanes (both pictured below), and also Contraflow Interchanges. Diverging Diamond Interchanges are not an example of displaced lanes, because they involve only lane reversal, not a complex mixture of lane directions.
Entry into and exit from displaced lanes needs separate traffic light regulation for these scenarios:
A theoretical condition exists where near-turning traffic turns into or out of a displaced lane. However, there seem to be no real-world use cases for this, so it is being omitted to avoid strange traffic light groupings that would be difficult to represent clearly in the UI.
Definitions
Forward Lane - A lane for which the value of Lane.m_direction is Forward, Both, or AvoidBackward. This is represented in the asset editor by the Direction field.
Backward Lane - A lane for which the value of Lane.m_direction is Backward, Both, or AvoidForward. This is represented in the asset editor by the Direction field.
Standard Road - A road that is either one-way or that has exactly two sets of lanes, one forward and the other backward. Forward and backward may be reversed, and for the purposes of lane displacement that is still a standard road.
Complex Road - A road that has three or more sets of lanes in alternating directions.
Standard Lane - Any lane on a Standard Road. On a complex road, any lane that exists in the standard position in relation to opposing traffic. If there is only one set of lanes going in a given direction, they are always Standard lanes.
Displaced Lane - On a complex road, any lane that exists in a nonstandard position in relation to opposing traffic, when other lanes going the same direction are in the standard position. If there is only one set of lanes going in a given direction, they are never Displaced Lanes.
Cross Left - A traffic light lane grouping for forward-moving traffic that crosses into a displaced lane (out of a displaced lane in LHT).
Cross Right - A traffic light lane grouping for forward-moving traffic that crosses out of a displaced lane (into a displaced lane in LHT).
Forward Displaced - A traffic light lane grouping for forward-moving traffic that is in a displaced lane both before and after the node.
Turn Into Displaced - A traffic light lane grouping for far-turning traffic that enters a displaced lane.
Turn Out of Displaced -- A traffic light lane grouping for far-turning traffic that leaves a displaced lane.
Examples
Continuous Flow Intersection
Sometimes called a Displaced Left Turn
Turnaround Lane
A slip lane that connects pairs of one-way roads to facilitate U-turns
Displaced Lane Identification
Conceptually, lane displacement is based on identifying sets of lanes that run in opposing directions, and that is how they are described here and covered in unit tests. The implementation will be mathematical.
One-way and simple two-way roads
If only one or two sets of lanes exist, they are always Standard Lanes, even if they are reversed as in the case of a Diverging Diamond Interchange.
Roads with three sets of lanes in alternating directions
In this scenario, one direction will have two sets of lanes, and the other direction will have only one. In the direction with two sets of lanes, the set that is in a nonstandard position in relation to opposing traffic are considered displaced lanes.
Roads with four sets of lanes in alternating directions.
In this scenario, each direction has two distinct sets of lanes. They may be configured in one of two ways:
More than four sets of lanes
This implementation will not support more than four sets of lanes on a single prefab.
Traffic Light Grouping
Traffic light grouping for displaced lanes will be based on the Lane Connector tool. This is based on the assumption that this type of intersection always involves the intentional assignment of lane connections. In the future, we could explore basing these lane groupings on the traffic AI's default behavior in the absence of explicit lane connections.
The traffic light simulation will attempt to eliminate groupings based on displaced lanes when they do not represent a distinct movement. For example, at the central node of a Continuous Flow Intersection, the left turns are Turn Out of Displaced, but since this applies to all of the left-turning lanes on a segment, the distinct grouping would not add functionality but would only make the UI more confusing.
Lane Transitions
At a node where the Lane Connector tool has not been used, lane transitions between displaced and non-displaced lanes will be disallowed for all vehicle types when the node has only two segments AND the segments have matching displaced lane layouts. The number of lanes does not have to match, only the overall pattern of standard and displaced lanes.
Graphics
CrossLeft, CrossRight
TurnOutOfDisplaced (RHT, LHT)
TurnIntoDisplaced (RHT, LHT)
ForwardDisplaced (RHT, LHT)
Tasks
NetInfo
extensionsLaneEndManager
.Also listens for LaneConnectionManager events to reset its cached data.
This needs a rollout plan in case there are unknown/surprise dependencies.
CustomSegmentLights
groups lights by bothExtVehicleInfo
andNetLaneFlags
.Displacement-based groupings are folded into the main group if they don't conflict.
xml-persistence
branchCustomSegmentLightModel
to includeNetLaneFlags
LaneConnectionManager
LaneConnectionManager
to be queried during load regardless of enabled stateRoutingManager
RoutingManager
instead ofLaneConnectionManager
for TTL lane groupingsThe text was updated successfully, but these errors were encountered: