修复数据记录问题
This commit is contained in:
parent
f002e38be3
commit
87d292b2b0
|
|
@ -81,10 +81,19 @@ class SUMOEdgeVSLEnvironment:
|
||||||
for edge_id in self.control_edges:
|
for edge_id in self.control_edges:
|
||||||
ei = self.parser.edge_info.get(edge_id)
|
ei = self.parser.edge_info.get(edge_id)
|
||||||
if ei and ei.detectors:
|
if ei and ei.detectors:
|
||||||
# 获取第一组检测器(pos_index=0)的所有交通车道
|
# 使用该 edge 实际存在的最小 pos_index,兼容从 metrics_1 开始编号的检测器
|
||||||
|
available_pos_indices = sorted({
|
||||||
|
pos_index
|
||||||
|
for (lane_idx, pos_index) in ei.detectors
|
||||||
|
if lane_idx in ei.traffic_lane_indices
|
||||||
|
})
|
||||||
|
if not available_pos_indices:
|
||||||
|
continue
|
||||||
|
|
||||||
first_group_dets = []
|
first_group_dets = []
|
||||||
|
first_pos_index = available_pos_indices[0]
|
||||||
for lane_idx in ei.traffic_lane_indices:
|
for lane_idx in ei.traffic_lane_indices:
|
||||||
det_id = ei.detectors.get((lane_idx, 0))
|
det_id = ei.detectors.get((lane_idx, first_pos_index))
|
||||||
if det_id:
|
if det_id:
|
||||||
first_group_dets.append(det_id)
|
first_group_dets.append(det_id)
|
||||||
self.edge_detector_map[edge_id] = first_group_dets
|
self.edge_detector_map[edge_id] = first_group_dets
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue