public class RollingLaneStructure extends Object implements LaneStructure, Serializable
(---- a ----)(---- b ----)(---- c ----)(---- d ----)(---- e ----)(---- f ----)(---- g ----) __________ __________ / _________ 1 / _________ 2 / / / / __________/ / _______________________/ / 1 ____________ ____________ /_ _ _ _ _ _/____________ /_ _ _ _ _ _ _ _ _ _ _ _ / 0 |_ _X_ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ \____________ -1 |____________|_ _ _ _ _ _ |____________|____________| __________|____________|____________| 3 -2 / __________/ \ \ ________/ / \ \___________ 5 _________/ \____________ 4When the GTU is looking ahead, it needs to know that when it continues to destination 3, it needs to shift one lane to the right at some point, but not two lanes to the right in link b, and not later than at the end of link f. When it needs to go to destination 1, it needs to shift to the left in link c. When it has to go to destination 2, it has to shift to the left, but not earlier than at link e. At node [de], it is possible to leave the rightmost lane of link e, and go to destination 4. The rightmost lane just splits into two lanes at the end of link d, and the GTU can either continue driving to destination 3, turn right to destination 4. This means that the right lane of link d has two successor lanes.
In the data structures, lanes are numbered laterally. Suppose that the lane where vehicle X resides would be number 0. Consistent with "left is positive" for angles, the lane right of X would have number -1, and entry 5 would have number -2.
In the data structure, this can be indicated as follows (N = next, P = previous, L = left, R = right, D = lane drop, . = continued but not in this structure). The merge lane in b is considered "off limits" for the GTUs on the "main" lane -1; the "main" lane 0 is considered off limits from the exit lanes on c, e, and f. Still, we need to maintain pointers to these lanes, as we are interested in the GTUs potentially driving next to us, feeding into our lane, etc.
1 0 -1 -2 ROOT _____|_____ ___________ ___________ |_-_|_._|_R_|----|_L_|_._|_-_| |_-_|_._|_-_| a | | | _____V_____ _____V_____ _____V_____ |_-_|_N_|_R_|----|_L_|_N_|_R_|<---|_L_|_D_|_-_| b | | ___________ _____V_____ _____V_____ |_-_|_N_|_R_|<---|_L_|_N_|_R_|----|_L_|_N_|_-_| c | | | _____V_____ _____V_____ _____V_____ |_-_|_._|_-_| |_-_|_N_|_R_|----|_L_|_NN|_-_| d | ||_______________ ___________ _____V_____ _____V_____ _____V_____ |_-_|_N_|_R_|<---|_L_|_N_|_R_|----|_L_|_N_|_-_| |_-_|_N_|_-_| e | | | | _____V_____ _____V_____ _____V_____ _____V_____ |_-_|_N_|_R_|<---|_L_|_D_|_R_|----|_L_|_N_|_-_| |_-_|_._|_-_| f | | _____V_____ _____V_____ |_-_|_._|_-_| |_-_|_._|_-_| g
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
LaneStructure.Entry<T extends LaneBasedObject>
Constructor and Description |
---|
RollingLaneStructure(Length lookAhead,
Length down,
Length up,
Length downSplit,
Length upMerge,
LaneBasedGTU gtu)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T extends LaneBasedObject> |
getDownstreamObjects(Class<T> clazz,
LaneBasedGTU gtu,
RelativePosition.TYPE pos)
Retrieve objects of a specific type.
|
<T extends LaneBasedObject> |
getDownstreamObjects(RelativeLane lane,
Class<T> clazz,
LaneBasedGTU gtu,
RelativePosition.TYPE pos)
Retrieve objects on a lane of a specific type.
|
<T extends LaneBasedObject> |
getDownstreamObjectsOnRoute(Class<T> clazz,
LaneBasedGTU gtu,
RelativePosition.TYPE pos,
Route route)
Retrieve objects of a specific type.
|
<T extends LaneBasedObject> |
getDownstreamObjectsOnRoute(RelativeLane lane,
Class<T> clazz,
LaneBasedGTU gtu,
RelativePosition.TYPE pos,
Route route)
Retrieve objects on a lane of a specific type.
|
SortedSet<RelativeLane> |
getExtendedCrossSection()
Returns the extended cross-section, which includes all lanes for which a first record is present.
|
RollingLaneStructureRecord |
getFirstRecord(RelativeLane lane)
Returns the first record on the given lane.
|
LaneStructureRecord |
getRootRecord()
Returns the root record.
|
LaneStructureRecord |
getRootRecord(Time time) |
<T extends LaneBasedObject> |
getUpstreamObjects(RelativeLane lane,
Class<T> clazz,
LaneBasedGTU gtu,
RelativePosition.TYPE pos)
Retrieve objects on a lane of a specific type.
|
String |
toString() |
void |
update(DirectedLanePosition pos,
Route route,
GTUType gtuType)
Updates the underlying structure shifting the root position to the input.
|
void |
visualize(GTU gtu)
Enables visualization of this lane structure.
|
public RollingLaneStructure(Length lookAhead, Length down, Length up, Length downSplit, Length upMerge, LaneBasedGTU gtu)
lookAhead
- Length; distance over which visual objects are includeddown
- Length; downstream distance over which the structure is madeup
- Length; upstream distance over which the structure is made, should include a margin for reaction timedownSplit
- Length; downstream distance at splits (links not on route) included in the structureupMerge
- Length; upstream distance at downstream merges (links not on route) included in the structuregtu
- LaneBasedGTU; GTUpublic final void update(DirectedLanePosition pos, Route route, GTUType gtuType) throws GTUException
update
in interface LaneStructure
pos
- DirectedLanePosition; current position of the GTUroute
- Route; current route of the GTUgtuType
- GTUType; GTU typeGTUException
- on a problem while updating the structurepublic final LaneStructureRecord getRootRecord()
getRootRecord
in interface LaneStructure
public final LaneStructureRecord getRootRecord(Time time)
time
- Time; time to obtain the root atpublic final SortedSet<RelativeLane> getExtendedCrossSection()
getExtendedCrossSection
in interface LaneStructure
public final RollingLaneStructureRecord getFirstRecord(RelativeLane lane)
getFirstRecord
in interface LaneStructure
lane
- RelativeLane; lanenull
if no such recordpublic final <T extends LaneBasedObject> Map<RelativeLane,SortedSet<LaneStructure.Entry<T>>> getDownstreamObjects(Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUException
getDownstreamObjects
in interface LaneStructure
T
- type of objects to findclazz
- class of objects to findgtu
- gtupos
- relative position to start search fromGTUException
- if lane is not in current setpublic final <T extends LaneBasedObject> SortedSet<LaneStructure.Entry<T>> getDownstreamObjects(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUException
getDownstreamObjects
in interface LaneStructure
T
- type of objects to findlane
- laneclazz
- class of objects to findgtu
- gtupos
- relative position to start search fromGTUException
- if lane is not in current setpublic final <T extends LaneBasedObject> SortedSet<LaneStructure.Entry<T>> getDownstreamObjectsOnRoute(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route) throws GTUException
getDownstreamObjectsOnRoute
in interface LaneStructure
T
- type of objects to findlane
- laneclazz
- class of objects to findgtu
- gtupos
- relative position to start search fromroute
- the routeGTUException
- if lane is not in current setpublic final <T extends LaneBasedObject> Map<RelativeLane,SortedSet<LaneStructure.Entry<T>>> getDownstreamObjectsOnRoute(Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route) throws GTUException
getDownstreamObjectsOnRoute
in interface LaneStructure
T
- type of objects to findclazz
- class of objects to findgtu
- gtupos
- relative position to start search fromroute
- the routeGTUException
- if lane is not in current setpublic final <T extends LaneBasedObject> SortedSet<LaneStructure.Entry<T>> getUpstreamObjects(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUException
getUpstreamObjects
in interface LaneStructure
T
- type of objects to findlane
- laneclazz
- class of objects to findgtu
- gtupos
- relative position to start search fromGTUException
- if lane is not in current setpublic final void visualize(GTU gtu)
gtu
- GTU to animate the LaneStructure offCopyright © 2014–2018 Delft University of Technology. All rights reserved.