Skip to main content

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

1. The 'ghost'-vehicle approach is still the recommended way to block part of a lane
2. moveToXY when sent only once should not stop the vehicle indefinitely. Your code looks as if you re-issue the command every step, though.
4. setStop should only be called once. For the meaning of flags, see, for all other attributes, see (parameter 'pos' corresponds to 'endPos' in the xml input)
3. you can check whether the vehicle is in the 'stopped' state (from setStop) by right-clicking it in the gui and selecting 'show route'. Unless the gui annotates it as 'stopped' it will not trigger strategic lane changing (though it may still trigger tactical changing).

Am Mo., 10. Jan. 2022 um 12:51 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:

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.

sumo-user mailing list
To unsubscribe from this list, visit

Back to the top