Dear Milad,
 
I have added answers and comments directly below your questions.
 
Best regards
Mirko
 
 
 
 
-----Original-Nachricht-----
Betreff: Re: [sumo-user] I am unable to start sumo from c++ by using 
libtraci
Datum: 2024-01-16T15:17:57+0100
Von: "Milad Sasha" <[email protected]>
An: "Mirko Barthauer" <[email protected]>
 
 
 
Dear Mirko
 
Thank you so much for your help and support. Actually I have some 
misunderstandings as follows:
1- do I need to start SUMO Home in my c++ client? If so could you please 
tell me how since the example in document is for python traci not for 
libtraci and libsumo
 
"SUMO_HOME" is the identifier of an environment variable we use inside SUMO 
for retrieving the valid SUMO installation. The python interface uses it to 
import the right traci and sumolib modules. No need here, just get the 
include path to libtraci or libsumo right.
 
2- to include libsumo I include the path to the include folder in the 
header file of my c++ program and included all the include files in that 
folder except for libtraci
 
Can't help much here. Please have a look at general C++ resources or the 
help of the IDE you work with to get the paths right.
 
3- when I try to use namespace library it has an error. I think I have not 
included libtraci properly. 
 
Same as question 2.
 
4- if there is no need for arguments in start function of simulation class, 
so where should I input the path to sumo.exe?
 
This is a misunderstanding. The path to sumo.exe is part of the vector of 
string argument you give to the start function (just as in the Python 
interface and the libtraci & libsumo examples). In case the directory of 
sumo.exe is referenced in the "PATH" environment variable, you can omit the 
full path and just call the application.
 
I know my questions are a lot but I really appreciate if you can help me 
with this. Thank you so much in advance.
 
 
Best regards
Milad Sashurpour 

On Tue, Jan 16, 2024 at 2:25 AM Mirko Barthauer <[email protected]
<mailto:[email protected]> > wrote:
  Dear Milad,
   
  there are two things to consider:
      * libtraci namespace (but as long as you have libsumo installed, the
        actual code for running sumo is the same)
      * libtraci::Simulation::start will take the full call to sumo (path
        to sumo and command line arguments) - you don't separate that into
        two arguments but have to provide one vector of strings containing
        all (as in the example you adapted)
  Best regards
  Mirko
   
   
   
  -----Original-Nachricht-----
  Betreff: [sumo-user] I am unable to start sumo from c++ by using libtraci
  Datum: 2024-01-16T02:06:57+0100
  Von: "Milad Sasha via sumo-user" <[email protected]
  <mailto:[email protected]> >
  An: "[email protected] <mailto:[email protected]> " <
  [email protected] <mailto:[email protected]> >
   
   
   
  Good Morning
   
  I hope this email finds you well. I am currently trying to start sumo
  from an unreal engine c++ program. importing libtraci library was
  successful. However , I cannot start sumo based on the sample in libtraci
  documentation. here is my code:
   
   
   
   std::string sumoPath =
  "C:\Users\simone\Downloads\sumo-1.19.0\bin\sumo-gui"; 

   std::vector<std::string> sumoArgs = { "-n",
  "C:\Users\simone\Downloads\sumo-1.19.0\bin\<http://montreal1.net/> " };

  libsumo::Simulation::start(sumoPath, sumoArgs);

   // Simulate for 5 steps
   for (int i = 0; i < 5; i++) {
      libsumo::Simulation::step();
   }

    libsumo::Simulation::close();
   
   
   
  However, I think I am entering the argument wrong. What should be the
  argument of the start method?
  start({"sumo", "-n", "net.net.xml"});
   
   
  I appreciate your help and answer my question. Thank you so much.
   
  Best regards,
  Milad
   

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

Reply via email to