Search code examples
c++veinssumo

How to get all currently spawned vehicles in sumo through traci


I have a question about sumo/traci.

In python there exist functions for retrieving values from sumo: sumo documentation

How do I do that in C++, specifically i need a list of all vehicles which are currently in the simulation.

Thank You


Solution

  • If you are using Veins 5.0, you can find a list of all implemented methods for interacting with SUMO in https://github.com/sommer/veins/blob/veins-5.0/src/veins/modules/mobility/traci/TraCICommandInterface.h

    Specifically, though, the list of all currently-simulated vehicles can most reliably be obtained by calling TraCIScenarioManager::getManagedHosts (see https://github.com/sommer/veins/blob/veins-5.0/src/veins/modules/mobility/traci/TraCIScenarioManager.h#L106 )