[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[sumo-user] getSubscriptionResults in libtraci / C++
|
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()
for vehicle_id in results[tc.VAR_ARRIVED_VEHICLES_IDS]:
# process vehicle_id
This can be converted to C++ like this:
libsumo::TraCIResults results = libtraci::Simulation::getSubscriptionResults();
//std::map<int, std::shared_ptr<libsumo::TraCIResult> > libsumo::TraCIResults
for (auto entry : results) {
int i = 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