Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Setting a stop duration with traci.vehicle.setBusStop does not work

Dear all, hi Jakob,

currently I want to use  traci.vehicle.setBusStop to set a new duration for a bus stop.

This is my function

def extendCurrentStop(vehID, newDuration, stopData = None):
    try:
        if stopData == None:
            stopData = traci.vehicle.getStops(vehID, 1)
        traci.vehicle.setBusStop(vehID, stopData[0].stoppingPlaceID,
                                 duration=newDuration)
        newStopData = traci.vehicle.getStops(vehID, 1)
        printVehicleMessage(vehID, 'new %s' % newStopData)
        if newStopData[0].duration != newDuration:
          printVehicleMessage(vehID, 'setting of duration does not work')
        else:
          printVehicleMessage(vehID, 'setting of duration does work')
    except Exception as ex:
        printVehicleMessage(vehID, 'error %s' % (str(ex)))
        printVehicleMessage(vehID, 'stopData old %s' % (stopData[0]))

and this are the print outs

time  4993s vehicle 6 new StopData(lane=DeltaLoop26_1, startPos=2.41, endPos=12.31, stoppingPlaceID=busStop_DeltaLoop26_1_5, stopFlags=8)
time  4993s vehicle 6 setting of duration does not work
time  4993s vehicle 6 new duration -1073741824

It seems, that this is working if duration was previously set, but not if duration was never set.

I used setStop in the past, but the conversion from lane to edgesand the adding of the position is extra code, which I want to avoid.

Regards, Harald


Back to the top