Dear All,

Does anyone have experience, or can send a link to documentation, on how to process results from a subscription in C++ using libtraci? I need to convert the following from Python into C++. The subscription is for multiple types of variables. (not only VAR_ARRIVED_VEHICLES_IDS).

In Python the implementation is rather straightforward with the documentation (e.g. in https://sumo.dlr.de/docs/TraCI/Interfacing_TraCI_from_Python.html).


   results = traci.simulation.getSubscriptionResults()

   forvehicle_id inresults[tc.VAR_ARRIVED_VEHICLES_IDS]:

   # process vehicle_id

This can be converted to C++ like this:

libsumo::TraCIResultsresults = libtraci::Simulation::getSubscriptionResults();

//std::map<int, std::shared_ptr<libsumo::TraCIResult> > libsumo::TraCIResults

for(autoentry : results) {

inti = entry.first;

shared_ptr<libsumo::TraCIResult> result = entry.second;

How can the TraCIResults be filtered for ' libsumo::VAR_ARRIVED_VEHICLES_ID' values, and

how to get the id values from the result?

Thanks for the help,

Bart Netten
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to