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
https://sumo.dlr.de/pydoc/traci._vehicle.html#VehicleDomain-getStops, for
all other attributes, see
https://sumo.dlr.de/docs/Definition_of_Vehicles%2C_Vehicle_Types%2C_and_Routes.html#stops
(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 <
[email protected]>:

> Hello,
>
> 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:
> https://gitanswer.com/has-sumo-a-method-to-block-part-of-the-lane-1007148310
> . 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:
>
> <edges>
>
> <edge id="1f2" from="1" to="2" speed="30" numLanes="3"
>> spreadType="center"/>
>
> </edges>
>>
>
> Route file:
>
> <routes>
>
> <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" />
>
> </routes>
>
>
> In TraCI (Python):
>
> step = 0
>> traci.vehicle.add(vehID='ghost', routeID='', typeID='veh', depart=0,
>> departLane=0, departSpeed='random')
>> traci.vehicle.setColor(vehID='ghost',color=(0,255,0))
>>
>> while step < 1000:
>>     traci.simulationStep()
>>     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)
>>     step+=1
>> traci.close()
>
>
> 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.
>
> Sincerely,
> Hriday.
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to