Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Blocking part of lane temporarily (due to roadworks)


I recently found out that the only way to simulate a blockage in a temporary part of the lane, (maybe due to construction activities) is by stopping a 'ghost' vehicle and setting its length to the intended area of effect. Source: . Please correct me if that is not the case.

How would I go about allowing the other vehicles to lane change around this 'ghost' vehicle to reach the end of a single edge with 3 lanes? Edge file:

<edge id="1f2" from="1" to="2" speed="30" numLanes="3" spreadType="center"/> 

Route file:

<vType id="veh" length="5" maxSpeed="30" lcStrategic="0" lcCooperative="0" lcSpeedGain="0" lcKeepRight="0" lcOvertakeRight="0" lcOpposite="0" lcSpeedGainLookahead="0" lcCooperativeRoundabout="0" lcSublane="0" lcPushy="0" /><route id="r0" color="1,1,0" edges="1f2" /> 

In TraCI (Python):

step = 0
traci.vehicle.add(vehID='ghost', routeID='', typeID='veh', depart=0, departLane=0, departSpeed='random')

while step < 1000:
    if step % 10 == 0:
        traci.vehicle.add(vehID='agent_{}'.format(step), routeID='r0', typeID='veh', depart='now', departLane='random', departSpeed='random', arrivalLane='random')
    # traci.vehicle.moveToXY(vehID='ghost', edgeID='1f2', lane=0, x=68.0, y=-3.3, angle=90, keepRoute=1)
    traci.vehicle.setStop(vehID='ghost', edgeID='1f2', pos=1, laneIndex=0, duration=100, flags=0, startPos=0, until=120)

The moveToXY seems to stop the 'ghost' vehicle at the specified coordinates indefinitely (until simulation ends) but the setStop command doesn't seem to make any modifications. So I was wondering if a combination of these would make it ideal for my case.

Why does the vehicle completely stop after using the moveToXY command indefinitely? Could you clarify the parameters used for the setStop command, specifically pos, duration, flags, startPos and until? I'm assuming until is from the start time of the simulation (at 0). So if I set until to 300, the vehicle should stay in the stopped state till 300 simulation time. But then I am confused because duration would mean time in seconds for the stopped state?

Also, I have already tried using TraCI's lane.setDisallowed() method, but it blocks the entire lane and not just the specified part of it.

Thank you for any assistance in advance.


Back to the top