本文整理汇总了Python中traci._sendExact函数的典型用法代码示例。如果您正苦于以下问题:Python _sendExact函数的具体用法?Python _sendExact怎么用?Python _sendExact使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_sendExact函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
def add(routeID, edges):
traci._beginMessage(tc.CMD_SET_ROUTE_VARIABLE, tc.ADD, routeID,
1+4+sum(map(len, edges))+4*len(edges))
traci._message.string += struct.pack("!Bi", tc.TYPE_STRINGLIST, len(edges))
for e in edges:
traci._message.string += struct.pack("!i", len(e)) + e
traci._sendExact()
示例2: setCompleteRedYellowGreenDefinition
def setCompleteRedYellowGreenDefinition(tlsID, tls):
"""setCompleteRedYellowGreenDefinition(string, ) -> None
.
"""
length = 1 + 4 + 1 + 4 + \
len(tls._subID) + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 4 # tls parameter
itemNo = 1 + 1 + 1 + 1 + 1
for p in tls._phases:
length += 1 + 4 + 1 + 4 + 1 + 4 + 1 + 4 + len(p._phaseDef)
itemNo += 4
traci._beginMessage(
tc.CMD_SET_TL_VARIABLE, tc.TL_COMPLETE_PROGRAM_RYG, tlsID, length)
traci._message.string += struct.pack("!Bi", tc.TYPE_COMPOUND, itemNo)
# programID
traci._message.string += struct.pack("!Bi",
tc.TYPE_STRING, len(tls._subID)) + str(tls._subID)
traci._message.string += struct.pack("!Bi", tc.TYPE_INTEGER, 0) # type
# subitems
traci._message.string += struct.pack("!Bi", tc.TYPE_COMPOUND, 0)
# index
traci._message.string += struct.pack("!Bi",
tc.TYPE_INTEGER, tls._currentPhaseIndex)
# phaseNo
traci._message.string += struct.pack("!Bi",
tc.TYPE_INTEGER, len(tls._phases))
for p in tls._phases:
traci._message.string += struct.pack("!BiBiBi", tc.TYPE_INTEGER,
p._duration, tc.TYPE_INTEGER, p._duration1, tc.TYPE_INTEGER, p._duration2)
traci._message.string += struct.pack("!Bi",
tc.TYPE_STRING, len(p._phaseDef)) + str(p._phaseDef)
traci._sendExact()
示例3: moveTo
def moveTo(vehID, laneID, pos):
traci._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE,
tc.VAR_MOVE_TO, vehID, 1 + 4 + 1 + 4 + len(laneID) + 1 + 8)
traci._message.string += struct.pack("!Bi", tc.TYPE_COMPOUND, 2)
traci._message.packString(laneID)
traci._message.string += struct.pack("!Bd", tc.TYPE_DOUBLE, pos)
traci._sendExact()
示例4: setBoundary
def setBoundary(viewID, xmin, ymin, xmax, ymax):
"""setBoundary(string, double, double, double, double) -> None
Set the current boundary for the given view (see getBoundary()).
"""
traci._beginMessage(tc.CMD_SET_GUI_VARIABLE, tc.VAR_VIEW_BOUNDARY, viewID, 1+8+8+8+8)
traci._message.string += struct.pack("!Bdddd", tc.TYPE_BOUNDINGBOX, xmin, ymin, xmax, ymax)
traci._sendExact()
示例5: setPosition
def setPosition(poiID, x, y):
"""setPosition(string, (double, double)) -> None
Sets the position coordinates of the poi.
"""
traci._beginMessage(tc.CMD_SET_POI_VARIABLE, tc.VAR_POSITION, poiID, 1+8+8)
traci._message.string += struct.pack("!Bdd", tc.POSITION_2D, x, y)
traci._sendExact()
示例6: setColor
def setColor(typeID, color):
"""setColor(string, (integer, integer, integer, integer)) -> None
Sets the color of this type.
"""
traci._beginMessage(tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_COLOR, typeID, 1+1+1+1+1)
traci._message.string += struct.pack("!BBBBB", tc.TYPE_COLOR, int(color[0]), int(color[1]), int(color[2]), int(color[3]))
traci._sendExact()
示例7: setOffset
def setOffset(viewID, x, y):
"""setOffset(string, double, double) -> None
Set the current offset for the given view.
"""
traci._beginMessage(tc.CMD_SET_GUI_VARIABLE, tc.VAR_VIEW_OFFSET, viewID, 1+8+8)
traci._message.string += struct.pack("!Bdd", tc.POSITION_2D, x, y)
traci._sendExact()
示例8: setColor
def setColor(poiID, color):
"""setColor(string, (integer, integer, integer, integer)) -> None
Sets the rgba color of the poi.
"""
traci._beginMessage(tc.CMD_SET_POI_VARIABLE, tc.VAR_COLOR, poiID, 1+1+1+1+1)
traci._message.string += struct.pack("!BBBBB", tc.TYPE_COLOR, int(color[0]), int(color[1]), int(color[2]), int(color[3]))
traci._sendExact()
示例9: moveToVTD
def moveToVTD(vehID, edgeID, lane, x, y):
traci._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_MOVE_TO_VTD, vehID, 1+4+1+4+len(edgeID)+1+4+1+8+1+8)
traci._message.string += struct.pack("!Bi", tc.TYPE_COMPOUND, 4)
traci._message.string += struct.pack("!Bi", tc.TYPE_STRING, len(edgeID)) + edgeID
traci._message.string += struct.pack("!Bi", tc.TYPE_INTEGER, lane)
traci._message.string += struct.pack("!Bd", tc.TYPE_DOUBLE, x)
traci._message.string += struct.pack("!Bd", tc.TYPE_DOUBLE, y)
traci._sendExact()
示例10: adaptTraveltime
def adaptTraveltime(edgeID, time):
"""adaptTraveltime(string, double) -> None
Adapt the travel time value (in s) used for (re-)routing for the given edge.
"""
traci._beginMessage(tc.CMD_SET_EDGE_VARIABLE, tc.VAR_EDGE_TRAVELTIME, edgeID, 1 + 4 + 1 + 8)
traci._message.string += struct.pack("!BiBd", tc.TYPE_COMPOUND, 1, tc.TYPE_DOUBLE, time)
traci._sendExact()
示例11: setEffort
def setEffort(edgeID, effort):
"""setEffort(string, double) -> None
Adapt the effort value used for (re-)routing for the given edge.
"""
traci._beginMessage(tc.CMD_SET_EDGE_VARIABLE, tc.VAR_EDGE_EFFORT, edgeID, 1 + 4 + 1 + 8)
traci._message.string += struct.pack("!BiBd", tc.TYPE_COMPOUND, 1, tc.TYPE_DOUBLE, effort)
traci._sendExact()
示例12: add
def add(poiID, x, y, color, poiType="", layer=0):
traci._beginMessage(tc.CMD_SET_POI_VARIABLE, tc.ADD, poiID, 1+4 + 1+4+len(poiType) + 1+1+1+1+1 + 1+4 + 1+8+8)
traci._message.string += struct.pack("!Bi", tc.TYPE_COMPOUND, 4)
traci._message.string += struct.pack("!Bi", tc.TYPE_STRING, len(poiType)) + poiType
traci._message.string += struct.pack("!BBBBB", tc.TYPE_COLOR, int(color[0]), int(color[1]), int(color[2]), int(color[3]))
traci._message.string += struct.pack("!Bi", tc.TYPE_INTEGER, layer)
traci._message.string += struct.pack("!Bdd", tc.POSITION_2D, x, y)
traci._sendExact()
示例13: setType
def setType(poiID, poiType):
"""setType(string, string) -> None
Sets the (abstract) type of the poi.
"""
traci._beginMessage(tc.CMD_SET_POI_VARIABLE, tc.VAR_TYPE, poiID, 1+4+len(poiType))
traci._message.string += struct.pack("!Bi", tc.TYPE_STRING, len(poiType)) + poiType
traci._sendExact()
示例14: setColor
def setColor(vehID, color):
"""setColor(string, (integer, integer, integer, integer))
sets color for vehicle with the given ID.
i.e. (255,0,0,0) for the color red.
The fourth integer (alpha) is currently ignored
"""
traci._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_COLOR, vehID, 1+1+1+1+1)
traci._message.string += struct.pack("!BBBBB", tc.TYPE_COLOR, int(color[0]), int(color[1]), int(color[2]), int(color[3]))
traci._sendExact()
示例15: setType
def setType(poiID, poiType):
"""setType(string, string) -> None
Sets the (abstract) type of the poi.
"""
traci._beginMessage(
tc.CMD_SET_POI_VARIABLE, tc.VAR_TYPE, poiID, 1 + 4 + len(poiType))
traci._message.packString(poiType)
traci._sendExact()