How to use the traci.vehicle.setParameter function in traci

To help you get started, we’ve selected a few traci examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse / sumo / tests / complex / sumo / ToCDevice / output / request_MRMs / runner.py View on Github external
def requestMRM(vehID):
    traci.vehicle.setParameter(vehID, "device.toc.requestMRM", "")
github eclipse / sumo / tests / complex / sumo / ToCDevice / LC_during_MRM / runner.py View on Github external
def requestToC(vehID, timeTillMRM):
    traci.vehicle.setParameter(vehID, "device.toc.requestToC", str(timeTillMRM))
github eclipse / sumo / tests / complex / traci / vehicle / vehicle / runner.py View on Github external
traci.vehicle.setShapeClass(vehID, "bicycle")
traci.vehicle.setMinGap(vehID, 1.1)
traci.vehicle.setWidth(vehID, 1.1)
traci.vehicle.setHeight(vehID, 1.6)
traci.vehicle.setMinGapLat(vehID, 0.5)
traci.vehicle.setMaxSpeedLat(vehID, 1.5)
traci.vehicle.setColor(vehID, (255, 0, 0, 255))
traci.vehicle.setLine(vehID, "S46")
traci.vehicle.setVia(vehID, ["3o", "4o"])
traci.vehicle.setAdaptedTraveltime(vehID, "1o", 55, 0, 1000)
traci.vehicle.setEffort(vehID, "1o", 54, 0, 1000)
if not traci.isLibsumo():
    # legacy API
    traci.vehicle.setAdaptedTraveltime(vehID, 0, 1000, "1o", 55)
    traci.vehicle.setEffort(vehID, 0, 1000, "1o", 54)
traci.vehicle.setParameter(vehID, "foo", "bar")
traci.vehicle.setParameter(vehID, "laneChangeModel.lcStrategic", "2.0")
traci.vehicle.setSignals(vehID, 12)
traci.vehicle.setRoutingMode(vehID, traci.constants.ROUTING_MODE_AGGREGATED)
traci.vehicle.setStop(vehID, "2fi", pos=55.0, laneIndex=0, duration=2, flags=1)
sys.stderr.flush()

check(vehID)
traci.vehicle.setAdaptedTraveltime(vehID, "1o")
traci.vehicle.setEffort(vehID, "1o")
print("reset traveltime", traci.vehicle.getAdaptedTraveltime(vehID, 0, "1o"))
print("reset effort", traci.vehicle.getEffort(vehID, 0, "1o"))
traci.vehicle.setAdaptedTraveltime(vehID, "1o", 23)
traci.vehicle.setEffort(vehID, "1o", 24)
print("set traveltime (default range)", traci.vehicle.getAdaptedTraveltime(vehID, 0, "1o"))
print("set effort (default range)", traci.vehicle.getEffort(vehID, 0, "1o"))
try:
github eclipse / sumo / tests / complex / sumo / DriverStateDevice / spec / runner.py View on Github external
traci.vehicle.setParameter(vehID, "device.driverstate.errorTimeScaleCoefficient",
                               str(new_errorTimeScaleCoefficient))
    errorTimeScaleCoefficient = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorTimeScaleCoefficient"))
    print("new errorTimeScaleCoefficient:%s (diff=%s)" %
          (errorTimeScaleCoefficient, errorTimeScaleCoefficient - new_errorTimeScaleCoefficient))

    new_errorNoiseIntensityCoefficient = 0.22
    traci.vehicle.setParameter(vehID, "device.driverstate.errorNoiseIntensityCoefficient",
                               str(new_errorNoiseIntensityCoefficient))
    errorNoiseIntensityCoefficient = float(traci.vehicle.getParameter(
        vehID, "device.driverstate.errorNoiseIntensityCoefficient"))
    print("new errorNoiseIntensityCoefficient:%s (diff=%s)" %
          (errorNoiseIntensityCoefficient, errorNoiseIntensityCoefficient - new_errorNoiseIntensityCoefficient))

    new_speedDifferenceErrorCoefficient = 0.33
    traci.vehicle.setParameter(vehID, "device.driverstate.speedDifferenceErrorCoefficient",
                               str(new_speedDifferenceErrorCoefficient))
    speedDifferenceErrorCoefficient = float(traci.vehicle.getParameter(
        vehID, "device.driverstate.speedDifferenceErrorCoefficient"))
    print("new speedDifferenceErrorCoefficient:%s (diff=%s)" %
          (speedDifferenceErrorCoefficient, speedDifferenceErrorCoefficient - new_speedDifferenceErrorCoefficient))

    new_headwayErrorCoefficient = 0.44
    traci.vehicle.setParameter(vehID, "device.driverstate.headwayErrorCoefficient", str(new_headwayErrorCoefficient))
    headwayErrorCoefficient = float(traci.vehicle.getParameter(vehID, "device.driverstate.headwayErrorCoefficient"))
    print("new headwayErrorCoefficient:%s (diff=%s)" %
          (headwayErrorCoefficient, headwayErrorCoefficient - new_headwayErrorCoefficient))

    new_speedDifferenceChangePerceptionThreshold = 0.55
    traci.vehicle.setParameter(vehID, "device.driverstate.speedDifferenceChangePerceptionThreshold",
                               str(new_speedDifferenceChangePerceptionThreshold))
    speedDifferenceChangePerceptionThreshold = float(traci.vehicle.getParameter(
github eclipse / sumo / tests / complex / sumo / DriverStateDevice / spec / runner.py View on Github external
traci.vehicle.setParameter(vehID, "device.driverstate.awareness", str(new_awareness))
    awareness = float(traci.vehicle.getParameter(vehID, "device.driverstate.awareness"))
    print("new awareness:%s (diff=%s)" % (awareness, awareness - new_awareness))

    new_errorState = 0.88
    traci.vehicle.setParameter(vehID, "device.driverstate.errorState", str(new_errorState))
    errorState = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorState"))
    print("new errorState:%s (diff=%s)" % (errorState, errorState - new_errorState))

    new_errorNoiseIntensity = 0.99
    traci.vehicle.setParameter(vehID, "device.driverstate.errorNoiseIntensity", str(new_errorNoiseIntensity))
    errorNoiseIntensity = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorNoiseIntensity"))
    print("new errorNoiseIntensity:%s (diff=%s)" % (errorNoiseIntensity, errorNoiseIntensity - new_errorNoiseIntensity))

    new_errorTimeScale = 1.11
    traci.vehicle.setParameter(vehID, "device.driverstate.errorTimeScale", str(new_errorTimeScale))
    errorTimeScale = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorTimeScale"))
    print("new errorTimeScale:%s (diff=%s)" % (errorTimeScale, errorTimeScale - new_errorTimeScale))

    new_maximalReactionTime = 5.55
    traci.vehicle.setParameter(vehID, "device.driverstate.maximalReactionTime", str(new_maximalReactionTime))
    maximalReactionTime = float(traci.vehicle.getParameter(vehID, "device.driverstate.maximalReactionTime"))
    print("new maximalReactionTime:%s (diff=%s)" % (maximalReactionTime, maximalReactionTime - new_maximalReactionTime))

    new_actionStepLength = float(traci.vehicle.getParameter(vehID, "device.driverstate.actionStepLength"))
    print("new actionStepLength:%s" % (new_actionStepLength))

    new_originalReactionTime = 3.0
    traci.vehicle.setParameter(vehID, "device.driverstate.originalReactionTime", str(new_originalReactionTime))
    originalReactionTime = float(traci.vehicle.getParameter(vehID, "device.driverstate.originalReactionTime"))
    print("new originalReactionTime:%s (diff=%s)" %
          (originalReactionTime, originalReactionTime - new_originalReactionTime))
github eclipse / sumo / tests / complex / sumo / ToCDevice / Keep_right_during_MRM / runner.py View on Github external
def requestToC(vehID, timeTillMRM):
    traci.vehicle.setParameter(vehID, "device.toc.requestToC", str(timeTillMRM))
github eclipse / sumo / tests / complex / traci / vehicle / vehicle / runner.py View on Github external
(traci.vehicle.getRoadID(parkingAreaVeh),
           traci.vehicle.getLanePosition(parkingAreaVeh),
           traci.vehicle.getStopState(parkingAreaVeh)
           ))

electricVeh = "elVeh"
traci.vehicle.addLegacy(electricVeh, "horizontal", typeID="electric")
traci.vehicle.setParameter(electricVeh, "device.battery.maximumBatteryCapacity", "40000")
traci.vehicle.setParameter(electricVeh, "device.battery.vehicleMass", "1024")
print("has battery device: %s" % traci.vehicle.getParameter(electricVeh, "has.battery.device"))
print("has vehroute device: %s" % traci.vehicle.getParameter(electricVeh, "has.vehroute.device"))
print("has rerouting device: %s" % traci.vehicle.getParameter(electricVeh, "has.rerouting.device"))
traci.vehicle.setParameter(electricVeh, "has.rerouting.device", "true")
print("has rerouting device: %s" % traci.vehicle.getParameter(electricVeh, "has.rerouting.device"))
print("routing period:", traci.vehicle.getParameter(electricVeh, "device.rerouting.period"))
traci.vehicle.setParameter(electricVeh, "device.rerouting.period", "45")
print("routing period:", traci.vehicle.getParameter(electricVeh, "device.rerouting.period"))
print("edge rerouting traveltime:", traci.vehicle.getParameter(electricVeh, "device.rerouting.edge:2si"))
traci.vehicle.setParameter(electricVeh, "device.rerouting.edge:2si", "123")
print("edge rerouting traveltime:", traci.vehicle.getParameter(electricVeh, "device.rerouting.edge:2si"))

traci.vehicle.setType(electricVeh, "long")
check(electricVeh)
traci.vehicle.setLength(electricVeh, 8)
traci.vehicle.setMaxSpeed(electricVeh, 10)
check(electricVeh)
traci.vehicle.setType(electricVeh, "long")
check(electricVeh)
traci.vehicle.setLength(electricVeh, 8)
traci.vehicle.setMaxSpeed(electricVeh, 10)
check(electricVeh)
traci.vehicle.setEmissionClass(electricVeh, "Energy/unknown")
github eclipse / sumo / tests / complex / sumo / ToCDevice / dynamic_ToC_aborted / runner.py View on Github external
def requestToC(vehID, timeTillMRM):
    traci.vehicle.setParameter(vehID, "device.toc.requestToC", str(timeTillMRM))
github eclipse / sumo / tests / complex / sumo / DriverStateDevice / spec / runner.py View on Github external
traci.vehicle.setParameter(vehID, "device.driverstate.headwayErrorCoefficient", str(new_headwayErrorCoefficient))
    headwayErrorCoefficient = float(traci.vehicle.getParameter(vehID, "device.driverstate.headwayErrorCoefficient"))
    print("new headwayErrorCoefficient:%s (diff=%s)" %
          (headwayErrorCoefficient, headwayErrorCoefficient - new_headwayErrorCoefficient))

    new_speedDifferenceChangePerceptionThreshold = 0.55
    traci.vehicle.setParameter(vehID, "device.driverstate.speedDifferenceChangePerceptionThreshold",
                               str(new_speedDifferenceChangePerceptionThreshold))
    speedDifferenceChangePerceptionThreshold = float(traci.vehicle.getParameter(
        vehID, "device.driverstate.speedDifferenceChangePerceptionThreshold"))
    print("new speedDifferenceChangePerceptionThreshold:%s (diff=%s)" % (speedDifferenceChangePerceptionThreshold,
                                                                         speedDifferenceChangePerceptionThreshold -
                                                                         new_speedDifferenceChangePerceptionThreshold))

    new_headwayChangePerceptionThreshold = 0.66
    traci.vehicle.setParameter(vehID, "device.driverstate.headwayChangePerceptionThreshold",
                               str(new_headwayChangePerceptionThreshold))
    headwayChangePerceptionThreshold = float(traci.vehicle.getParameter(
        vehID, "device.driverstate.headwayChangePerceptionThreshold"))
    print("new headwayChangePerceptionThreshold:%s (diff=%s)" %
          (headwayChangePerceptionThreshold, headwayChangePerceptionThreshold - new_headwayChangePerceptionThreshold))

    new_awareness = 0.77
    traci.vehicle.setParameter(vehID, "device.driverstate.awareness", str(new_awareness))
    awareness = float(traci.vehicle.getParameter(vehID, "device.driverstate.awareness"))
    print("new awareness:%s (diff=%s)" % (awareness, awareness - new_awareness))

    new_errorState = 0.88
    traci.vehicle.setParameter(vehID, "device.driverstate.errorState", str(new_errorState))
    errorState = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorState"))
    print("new errorState:%s (diff=%s)" % (errorState, errorState - new_errorState))
github eclipse / sumo / tests / complex / sumo / DriverStateDevice / spec / runner.py View on Github external
speedDifferenceChangePerceptionThreshold = float(traci.vehicle.getParameter(
        vehID, "device.driverstate.speedDifferenceChangePerceptionThreshold"))
    print("new speedDifferenceChangePerceptionThreshold:%s (diff=%s)" % (speedDifferenceChangePerceptionThreshold,
                                                                         speedDifferenceChangePerceptionThreshold -
                                                                         new_speedDifferenceChangePerceptionThreshold))

    new_headwayChangePerceptionThreshold = 0.66
    traci.vehicle.setParameter(vehID, "device.driverstate.headwayChangePerceptionThreshold",
                               str(new_headwayChangePerceptionThreshold))
    headwayChangePerceptionThreshold = float(traci.vehicle.getParameter(
        vehID, "device.driverstate.headwayChangePerceptionThreshold"))
    print("new headwayChangePerceptionThreshold:%s (diff=%s)" %
          (headwayChangePerceptionThreshold, headwayChangePerceptionThreshold - new_headwayChangePerceptionThreshold))

    new_awareness = 0.77
    traci.vehicle.setParameter(vehID, "device.driverstate.awareness", str(new_awareness))
    awareness = float(traci.vehicle.getParameter(vehID, "device.driverstate.awareness"))
    print("new awareness:%s (diff=%s)" % (awareness, awareness - new_awareness))

    new_errorState = 0.88
    traci.vehicle.setParameter(vehID, "device.driverstate.errorState", str(new_errorState))
    errorState = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorState"))
    print("new errorState:%s (diff=%s)" % (errorState, errorState - new_errorState))

    new_errorNoiseIntensity = 0.99
    traci.vehicle.setParameter(vehID, "device.driverstate.errorNoiseIntensity", str(new_errorNoiseIntensity))
    errorNoiseIntensity = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorNoiseIntensity"))
    print("new errorNoiseIntensity:%s (diff=%s)" % (errorNoiseIntensity, errorNoiseIntensity - new_errorNoiseIntensity))

    new_errorTimeScale = 1.11
    traci.vehicle.setParameter(vehID, "device.driverstate.errorTimeScale", str(new_errorTimeScale))
    errorTimeScale = float(traci.vehicle.getParameter(vehID, "device.driverstate.errorTimeScale"))