Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] How to subscribe to nearby vehicles
  • From: Devon Fazekas <thomas-d@xxxxxxxxxx>
  • Date: Fri, 2 Sep 2022 17:35:27 +0000
  • Accept-language: en-CA, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lSfrZ29BG5RpjXpUXA1Ntz/qJoSqSPFlDWLo+xrgq5k=; b=awy+wks4gZsQA8dnpTZQv7yCPzdsaY64KTmydTjfJfFzGBk3tGVN1/MJqNHwtIW373MD4rKWyWJyHP1/rG39bMVXyABv4pt/y2uR2N12T8ZSEu71Rd9QJiKc6Af29jTOiwnorR+iGjvNPDzjlg//CUiW8OAnOWEm0g8p4IJi1Iuaw4Q3/h118q0bpd5714PrKekiMIjp3ZZEisw3j9+MNj9dF+SRcCFaLLw+kyigq1MW7azFvOx/QCoDHUc77hgg1V4ZuXRXjpVG63DaDWKRZNooriseNMuTHh/LXN1wWlQ70eYyErp6AF17zxfkGVbOpeJWaYUfwTjEo8CYqdTq6A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VgimGUJfuPjGFErP5aec6Pa9hrumoCBkc1cCHWjyD4hPMmjxVj/OlIYsF7X2kFm/tCoBE06ibzeAHiQe3qupyc8fwA/AuuLN8Cm4vAoXshFEWiioqSq9d5mQr2bTop8lrxYtoUJW7O5ceq1vsjiPKP2M75ObOXK92r4QFdwRKu2Bw8+t8aQGtK8iJjiYgv6cZa5maw1sdSp9HaoFgMavGDWF7kvBtUmR126Mwsl5pvBdchPHlZEmT5R1+Jrf/QJyFSzSUKAdy1SbA3VCklNw/f8rTlBUEY3ZwoWRsfzxniivbSc0kJpT+Yly8GSrvTYkYWNY/RWxemdBOVvTdlhdaw==
  • Delivered-to: sumo-user@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/sumo-user/>
  • List-help: <mailto:sumo-user-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHYvvIiQHUgvDnd7Eq1PBb0hwF1wQ==
  • Thread-topic: How to subscribe to nearby vehicles

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.

 


Back to the top