Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] How to subscribe to nearby vehicles

Hi Devon,

to get close-by vehicles to your (moving) EV, try Context Subscriptions [1]. That will give you all vehicles within a certain range of your vehicle. Set that to your blue-light device and that should get you forward. Note that this only considers euclidean distance, so you might want to check for the same (or connected) edge as the EV is on, otherwise vehicles on the close-by bridge crossing the EV's path might break as well.

The rest of your approach sounds reasonable. The trick will be in the details, I assume.

Best,
Dominik

[1] https://sumo.dlr.de/daily/pydoc/traci._vehicle.html#VehicleDomain-subscribeContext

On 02.09.22 19:35, Devon Fazekas wrote:

I have a simple multi-lane road where all vehicles start from the leftmost edge and drive to the rightmost edge. All the traffic is made of civilian vehicles with the exception of a single Emergency Vehicle (EV) that enters the network 10 seconds into the simulation.

I need vehicles to pull over and slow down to a complete stop when the EV approaches them from behind, enabling the EV to pass by. I understand that this behaviour is not native in SUMO, that EVs only cause civilians to slow down but does not cause them to halt.

I believe I can use the traci.vehicle.slowDown() method to achieve a similar result (slowing vehicles gradually to a complete stop), but I need help with targeting the nearby civilian vehicles. EVs use a blue-light device which has a built-in signal range, illustrated below.

The blue-light signal range on an Emergency Vehicle.

 

I believe the following process should work to achieve the desired behaviour.

  1. Subscribe to the EV.
  2. Listen for any civilian vehicle at least 50-meters in front of the EV (regardless of lane).
  3. Use traci.vehicle.slowDown() on those vehicles to bring them to a halt.
  4. Once the EV is 50-meters ahead of the halted vehicle, resume their original speed.

I’ve never used subscriptions before and I’m having difficulty finding code examples. Please point out any errors in my approach and/or code examples on how to achieve this process.

 


_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top