コード例 #1
0
ファイル: vehicletype.py プロジェクト: sequielo/sumo
    .
    """
    traci._sendDoubleCmd(
        tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_IMPERFECTION, typeID, imperfection)


def setTau(typeID, tau):
    """setTau(string, double) -> None

    Sets the driver's reaction time in s for vehicles of this type.
    """
    traci._sendDoubleCmd(
        tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_TAU, typeID, tau)


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()


getParameter, setParameter = traci.getParameterAccessors(
    tc.CMD_GET_VEHICLETYPE_VARIABLE, tc.CMD_SET_VEHICLETYPE_VARIABLE)
コード例 #2
0
    from the last time step.
    """
    return subscriptionResults.get(routeID)


def subscribeContext(routeID,
                     domain,
                     dist,
                     varIDs=(tc.ID_LIST, ),
                     begin=0,
                     end=2**31 - 1):
    traci._subscribeContext(tc.CMD_SUBSCRIBE_ROUTE_CONTEXT, begin, end,
                            routeID, domain, dist, varIDs)


def getContextSubscriptionResults(routeID=None):
    return subscriptionResults.getContext(routeID)


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)) + str(e)
    traci._sendExact()


getParameter, setParameter = traci.getParameterAccessors(
    tc.CMD_GET_ROUTE_VARIABLE, tc.CMD_SET_ROUTE_VARIABLE)
コード例 #3
0
ファイル: route.py プロジェクト: sequielo/sumo
    It is not possible to retrieve older subscription results than the ones
    from the last time step.
    """
    return subscriptionResults.get(routeID)


def subscribeContext(routeID, domain, dist, varIDs=(tc.ID_LIST,), begin=0, end=2**31 - 1):
    traci._subscribeContext(
        tc.CMD_SUBSCRIBE_ROUTE_CONTEXT, begin, end, routeID, domain, dist, varIDs)


def getContextSubscriptionResults(routeID=None):
    return subscriptionResults.getContext(routeID)


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.string += struct.pack("!Bi", tc.TYPE_STRINGLIST, len(edges))
    for e in edges:
        traci._message.string += struct.pack("!i", len(e)) + str(e)
    traci._sendExact()


getParameter, setParameter = traci.getParameterAccessors(
    tc.CMD_GET_ROUTE_VARIABLE, tc.CMD_SET_ROUTE_VARIABLE)
コード例 #4
0
ファイル: vehicletype.py プロジェクト: muntaserabd1/sumo
    .
    """
    traci._sendDoubleCmd(tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_IMPERFECTION,
                         typeID, imperfection)


def setTau(typeID, tau):
    """setTau(string, double) -> None

    Sets the driver's reaction time in s for vehicles of this type.
    """
    traci._sendDoubleCmd(tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_TAU, typeID,
                         tau)


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()


getParameter, setParameter = traci.getParameterAccessors(
    tc.CMD_GET_VEHICLETYPE_VARIABLE, tc.CMD_SET_VEHICLETYPE_VARIABLE)
コード例 #5
0
ファイル: person.py プロジェクト: aarongolliver/sumo
    Subscribe to one or more person values for the given interval.
    """
    traci._subscribe(
        tc.CMD_SUBSCRIBE_PERSON_VARIABLE, begin, end, personID, varIDs)


def getSubscriptionResults(personID=None):
    """getSubscriptionResults(string) -> dict(integer: <value_type>)

    Returns the subscription results for the last time step and the given person.
    If no person id is given, all subscription results are returned in a dict.
    If the person id is unknown or the subscription did for any reason return no data,
    'None' is returned.
    It is not possible to retrieve older subscription results than the ones
    from the last time step.
    """
    return subscriptionResults.get(personID)


def subscribeContext(personID, domain, dist, varIDs=(tc.VAR_ROAD_ID, tc.VAR_LANEPOSITION), begin=0, end=2**31 - 1):
    traci._subscribeContext(
        tc.CMD_SUBSCRIBE_PERSON_CONTEXT, begin, end, personID, domain, dist, varIDs)


def getContextSubscriptionResults(personID=None):
    return subscriptionResults.getContext(personID)


getParameter, setParameter = traci.getParameterAccessors(
    tc.CMD_GET_PERSON_VARIABLE, tc.CMD_SET_PERSON_VARIABLE)
コード例 #6
0
ファイル: person.py プロジェクト: muntaserabd1/sumo
def getSubscriptionResults(personID=None):
    """getSubscriptionResults(string) -> dict(integer: <value_type>)

    Returns the subscription results for the last time step and the given person.
    If no person id is given, all subscription results are returned in a dict.
    If the person id is unknown or the subscription did for any reason return no data,
    'None' is returned.
    It is not possible to retrieve older subscription results than the ones
    from the last time step.
    """
    return subscriptionResults.get(personID)


def subscribeContext(personID,
                     domain,
                     dist,
                     varIDs=(tc.VAR_ROAD_ID, tc.VAR_LANEPOSITION),
                     begin=0,
                     end=2**31 - 1):
    traci._subscribeContext(tc.CMD_SUBSCRIBE_PERSON_CONTEXT, begin, end,
                            personID, domain, dist, varIDs)


def getContextSubscriptionResults(personID=None):
    return subscriptionResults.getContext(personID)


getParameter, setParameter = traci.getParameterAccessors(
    tc.CMD_GET_PERSON_VARIABLE, tc.CMD_SET_PERSON_VARIABLE)