MCPcopy Create free account
hub / github.com/PJLab-ADG/OASim / processConnection

Method processConnection

limsim/simModel/common/networkBuild.py:213–277  ·  view source on GitHub ↗
(self, child: ET.Element)

Source from the content-addressed store, hash-verified

211 ))
212
213 def processConnection(self, child: ET.Element):
214 fromEdgeID = child.attrib['from']
215 fromEdge = self.getEdge(fromEdgeID)
216 fromLaneIdx = child.attrib['fromLane']
217 fromLaneID = fromEdgeID + '_' + fromLaneIdx
218 fromLane = self.getLane(fromLaneID)
219 toEdgeID = child.attrib['to']
220 toLaneIdx = child.attrib['toLane']
221 toLaneID = toEdgeID + '_' + toLaneIdx
222 toLane = self.getLane(toLaneID)
223 if fromLane and toLane:
224 direction = child.attrib['dir']
225 junctionLaneID = child.attrib['via']
226 junctionLane = self.getJunctionLane(junctionLaneID)
227 self.dataQue.put((
228 'connectionINFO', (
229 fromLaneID, toLaneID, direction, junctionLaneID
230 ), 'INSERT'
231 ))
232 if junctionLane.sumo_length < 1:
233 fromLane.next_lanes[toLaneID] = (toLaneID, 's')
234 fromEdge.next_edge_info[toEdgeID].add(fromLaneID)
235 else:
236 # junctionLane = self.getJunctionLane(junctionLaneID)
237 if 'tl' in child.attrib.keys():
238 tl = child.attrib['tl']
239 linkIndex = int(child.attrib['linkIndex'])
240 junctionLane.tlLogic = tl
241 junctionLane.tlsIndex = linkIndex
242 self.dataQue.put((
243 'junctionLaneINFO', (
244 junctionLane.id, junctionLane.width,
245 junctionLane.speed_limit,
246 junctionLane.sumo_length,
247 junctionLane.tlLogic,
248 junctionLane.tlsIndex
249 ), 'REPLACE'
250 ))
251 center_line = []
252 for si in np.linspace(
253 fromLane.course_spline.s[-1] - OVERLAP_DISTANCE,
254 fromLane.course_spline.s[-1], num=20
255 ):
256 center_line.append(
257 fromLane.course_spline.calc_position(si))
258 for si in np.linspace(0, OVERLAP_DISTANCE, num=20):
259 center_line.append(
260 toLane.course_spline.calc_position(si)
261 )
262 junctionLane.course_spline = Spline2D(
263 list(zip(*center_line))[0], list(zip(*center_line))[1]
264 )
265 junctionLane.getPlotElem()
266 junctionLane.last_lane_id = fromLaneID
267 junctionLane.next_lane_id = toLaneID
268 fromLane.next_lanes[toLaneID] = (junctionLaneID, direction)
269 fromEdge.next_edge_info[toEdgeID].add(fromLaneID)
270 # add this junctionLane to it's parent Junction's JunctionLanes

Callers 1

getDataMethod · 0.95

Calls 8

getEdgeMethod · 0.95
getLaneMethod · 0.95
getJunctionLaneMethod · 0.95
getJunctionMethod · 0.95
affGridIDsMethod · 0.95
Spline2DClass · 0.90
calc_positionMethod · 0.80
getPlotElemMethod · 0.80

Tested by

no test coverage detected