If you want to share a single traci connection between two threads you must
handle the locking yourself.
Alternatively, you can connect two clients with seperate processes. See
http://sumo.dlr.de/wiki/TraCI#SUMO_startup (--num-clients)

regards,
Jakob

Am Fr., 7. Dez. 2018 um 10:30 Uhr schrieb Muktadir R Chowdhury (mrchwdhr) <
[email protected]>:

> I have the following Traci Client program.
>
>
> #include <iostream>
>
> #include <stdlib.h>
>
> #include <string>
>
> #include "TraCIAPI.h"
>
>
> class Client : public TraCIAPI {
>
> public:
>
>     Client() {};
>
>     ~Client() {};
>
> };
>
>
> int main(int argc, char* argv[]) {
>
>     Client client;
>
>     int order = atoi(argv[1]);
>
>
>     client.connect("localhost", 47000);
>
>
>     std::cout << "run 5 steps ...\n";
>
>
>     TraCIAPI::VehicleScope vehicleScope(client);
>
>
>     while(true ) {
>
>         client.simulationStep();
>
>         libsumo::TraCIPosition pos =
> vehicleScope.getPosition(std::to_string(order));
>
>         std::cout << pos.x << ", " << pos.y  << std::endl;
>
>     }
>
>
>     std::cout << "time in ms: " << client.simulation.getCurrentTime() << "
> \n";
>
>     client.close();
>
> }
>
> Here in the while() loop I am advancing the simulation and getting vehicle
> information. My question is, is it possible to advance the simulation in
> one place (like in another thread) and get vehicle position in another
> place ?
>
>
> -Muktadir
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to