Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion flow/core/vehicles.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@ def _multi_lane_headways_util(self, veh_id, edge_dict, num_edges, env):
"""
this_pos = self.get_position(veh_id)
this_edge = self.get_edge(veh_id)
this_lane = self.get_lane(veh_id)
num_lanes = env.scenario.num_lanes(this_edge)

# set default values for all output values
Expand All @@ -1156,7 +1157,8 @@ def _multi_lane_headways_util(self, veh_id, edge_dict, num_edges, env):

# if you are at the end or the front of the edge, the lane
# leader is in the edges in front of you
if index < len(positions) - 1:
if (lane == this_lane and index < len(positions)-1) \
or (lane != this_lane and index < len(positions)):
# check if the index does not correspond to the current
# vehicle
if ids[index] == veh_id:
Expand Down