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

Method getVehInfo

limsim/simModel/fixedScene/model.py:355–389  ·  view source on GitHub ↗
(self, veh: Vehicle)

Source from the content-addressed store, hash-verified

353 return self.allvTypes[vtid]
354
355 def getVehInfo(self, veh: Vehicle):
356 vid = veh.id
357 if veh.vTypeID:
358 max_decel = veh.maxDecel
359 else:
360 vtypeid = traci.vehicle.getTypeID(vid)
361 if '@' in vtypeid:
362 vtypeid = vtypeid.split('@')[0]
363 vtins = self.getvTypeIns(vtypeid)
364 veh.maxAccel = vtins.maxAccel
365 veh.maxDecel = vtins.maxDecel
366 veh.length = vtins.length
367 veh.width = vtins.width
368 veh.maxSpeed = vtins.maxSpeed
369 veh.vTypeID = vtypeid
370 veh.routes = traci.vehicle.getRoute(vid)
371 veh.LLRSet, veh.LLRDict, veh.LCRDict = veh.getLaneLevelRoute(
372 self.nb)
373
374 routes = ' '.join(veh.routes)
375 self.putVehicleInfo(vid, vtins, routes)
376 max_decel = veh.maxDecel
377 veh.yawAppend(traci.vehicle.getAngle(vid))
378 x, y = traci.vehicle.getPosition(vid)
379 veh.xAppend(x)
380 veh.yAppend(y)
381 veh.speedQ.append(traci.vehicle.getSpeed(vid))
382 if max_decel == traci.vehicle.getDecel(vid):
383 accel = traci.vehicle.getAccel(vid)
384 else:
385 accel = -traci.vehicle.getDecel(vid)
386 veh.accelQ.append(accel)
387 laneID = traci.vehicle.getLaneID(vid)
388 veh.routeIdxAppend(laneID)
389 veh.laneAppend(self.nb)
390
391 def vehMoveStep(self, veh: Vehicle):
392 # control vehicles after update its data

Callers 1

getSceMethod · 0.95

Calls 8

getvTypeInsMethod · 0.95
putVehicleInfoMethod · 0.95
getLaneLevelRouteMethod · 0.80
yawAppendMethod · 0.80
xAppendMethod · 0.80
yAppendMethod · 0.80
routeIdxAppendMethod · 0.80
laneAppendMethod · 0.80

Tested by

no test coverage detected