1

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

elvenking
  • 97
  • 6

2 Answers2

0

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 )

Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35
0

If you are not using Veins, have a look here: https://sumo.dlr.de/docs/TraCI/C++TraCIAPI.html which gives an explanation how to build a client application using the C++ API. The methods you can use are documented here: https://sumo.dlr.de/daily/doxygen/d8/d1c/class_tra_c_i_a_p_i.html

You might want to use getIDList() from the VehicleScope.

Michael
  • 3,510
  • 1
  • 11
  • 23