• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python traci._beginMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中traci._beginMessage函数的典型用法代码示例。如果您正苦于以下问题:Python _beginMessage函数的具体用法?Python _beginMessage怎么用?Python _beginMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_beginMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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()
开发者ID:aarongolliver,项目名称:sumo,代码行数:7,代码来源:vehicle.py


示例2: 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()
开发者ID:flemouel,项目名称:Social-Vehicular-Network,代码行数:7,代码来源:route.py


示例3: 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()
开发者ID:sequielo,项目名称:sumo,代码行数:32,代码来源:trafficlights.py


示例4: 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()
开发者ID:sequielo,项目名称:sumo,代码行数:8,代码来源:edge.py


示例5: 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()
开发者ID:p1tt1,项目名称:sumo,代码行数:8,代码来源:vehicle.py


示例6: 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()
开发者ID:nnaren1902,项目名称:Secure-Vehicle-Platoon,代码行数:8,代码来源:poi.py


示例7: 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()
开发者ID:harora,项目名称:ITS,代码行数:8,代码来源:vehicletype.py


示例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()
开发者ID:florianjomrich,项目名称:veinsSimConnectionToUnity,代码行数:8,代码来源:poi.py


示例9: 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()
开发者ID:sequielo,项目名称:sumo,代码行数:8,代码来源:edge.py


示例10: 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()
开发者ID:florianjomrich,项目名称:veinsSimConnectionToUnity,代码行数:8,代码来源:poi.py


示例11: 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()
开发者ID:cathyyul,项目名称:sumo-0.18,代码行数:8,代码来源:gui.py


示例12: 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()
开发者ID:florianjomrich,项目名称:veinsSimConnectionToUnity,代码行数:8,代码来源:poi.py


示例13: 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()
开发者ID:cathyyul,项目名称:sumo-0.18,代码行数:8,代码来源:gui.py


示例14: getEffort

def getEffort(vehID, time, edgeID):
    """getEffort(string, double, string) -> double
    
    .
    """
    traci._beginMessage(tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_EDGE_EFFORT, vehID, 1+4+1+4+1+4+len(edgeID))
    traci._message.string += struct.pack("!BiBiBi", tc.TYPE_COMPOUND, 2, tc.TYPE_INTEGER, time,
                                         tc.TYPE_STRING, len(edgeID)) + edgeID
    return traci._checkResult(tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_EDGE_EFFORT, vehID).readDouble()
开发者ID:p1tt1,项目名称:sumo,代码行数:9,代码来源:vehicle.py


示例15: getAdaptedTraveltime

def getAdaptedTraveltime(edgeID, time):
    """getAdaptedTraveltime(string, double) -> double

    Returns the travel time value (in s) used for (re-)routing 
    which is valid on the edge at the given time.
    """
    traci._beginMessage(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_TRAVELTIME, edgeID, 1 + 4)
    traci._message.string += struct.pack("!Bi", tc.TYPE_INTEGER, traci._TIME2STEPS(time))
    return traci._checkResult(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_TRAVELTIME, edgeID).readDouble()
开发者ID:sequielo,项目名称:sumo,代码行数:9,代码来源:edge.py


示例16: add

def add(routeID, edges):
    """add(string, list(string)) -> None

    Adds a new route with the given id consisting of the given list of edge IDs.
    """
    traci._beginMessage(tc.CMD_SET_ROUTE_VARIABLE, tc.ADD, routeID,
                        1 + 4 + sum(map(len, edges)) + 4 * len(edges))
    traci._message.packStringList(edges)
    traci._sendExact()
开发者ID:aarongolliver,项目名称:sumo,代码行数:9,代码来源:route.py


示例17: 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()
开发者ID:aarongolliver,项目名称:sumo,代码行数:9,代码来源:poi.py


示例18: convert2D

def convert2D(edgeID, pos, laneIndex=0, toGeo=False):
    posType = tc.POSITION_2D
    if toGeo:
        posType = tc.POSITION_LAT_LON
    traci._beginMessage(tc.CMD_GET_SIM_VARIABLE, tc.POSITION_CONVERSION, "", 1+4 + 1+4+len(edgeID)+8+1 + 1+8+8)
    traci._message.string += struct.pack("!Bi", tc.TYPE_COMPOUND, 2)
    traci._message.string += struct.pack("!Bi", tc.POSITION_ROADMAP, len(edgeID)) + edgeID
    traci._message.string += struct.pack("!dBBdd", pos, laneIndex, posType, 0., 0.)
    return traci._checkResult(tc.CMD_GET_SIM_VARIABLE, tc.POSITION_CONVERSION, "").read("!dd")
开发者ID:k0emt,项目名称:macts,代码行数:9,代码来源:simulation.py


示例19: getLeader

def getLeader(vehID, dist=0.):
    """getLeader(string, double) -> (string, double)
    
    Return the leading vehicle id together with the distance.
    The dist parameter defines the maximum lookahead, 0 calculates a lookahead from the brake gap.
    """
    traci._beginMessage(tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_LEADER, vehID, 1+8)
    traci._message.string += struct.pack("!Bd", tc.TYPE_DOUBLE, dist)
    return _readLeader(traci._checkResult(tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_LEADER, vehID))
开发者ID:p1tt1,项目名称:sumo,代码行数:9,代码来源:vehicle.py


示例20: getEffort

def getEffort(edgeID, time):
    """getEffort(string, double) -> double

    Returns the effort value used for (re-)routing 
    which is valid on the edge at the given time.
    """
    traci._beginMessage(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_EFFORT, edgeID, 1 + 4)
    traci._message.string += struct.pack("!Bi", tc.TYPE_INTEGER, traci._TIME2STEPS(time))
    return traci._checkResult(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_EFFORT, edgeID).readDouble()
开发者ID:sequielo,项目名称:sumo,代码行数:9,代码来源:edge.py



注:本文中的traci._beginMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python traci._checkResult函数代码示例发布时间:2022-05-27
下一篇:
Python tracetool.out函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap