Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] I can’t set libsumo library

Here is something that was still in my code:

  auto r = Simulation::start({"sumo", "-c", "main.sumocfg"}, -1, 60, "default", true);

So you'll need the 'main.sumocfg' file in your current directory.
The code I actually use (the above does compile but I haven't test it) is something like this:

  int prefSumoPort=8813;
  bool prefSumoVerbose=true;
  int num_retries=60;
  bool prefSumoGui=true;
  std::string cfg_name="main.sumocfg";
  std::vector<std::string> cmd;
  // Standard installation location
  if (prefSumoGui)
    cmd.push_back("sumo-gui");
  else
    cmd.push_back("sumo");

  // Configuration to load
  cmd.push_back("-c");
  cmd.push_back(cfg_name);
  auto r = Simulation::start(cmd, prefSumoPort, num_retries, "default", prefSumoVerbose);

Hope that helps,
Ruud


On Wed, Feb 28, 2024 at 2:40 PM Milad Sasha <milad.sasha70@xxxxxxxxx> wrote:
Thank you very much for your answer. I think I am wrong with Fstring.please forget about it.

Instead, Could please kindly fill the red arguments with an imaginary example:
Simulation::start({"sumo","-n", "net.net.xml"});

I have become puzzled with the arguments and what to put instead of “sumo” and “net.net.xml” .




On Wed, Feb 28, 2024 at 4:08 AM Ruud van Gaal <r.vangaal@xxxxxxxxxx> wrote:
Hi Milad,

FString may not be compatible. Look at this piece of code on how to make a std::string out of it:

FString test = "MyTest";
std::string test2 = std::string(TCHAR_TO_UTF8(*test));

Cheers,
Ruud


On Wed, Feb 28, 2024 at 8:29 AM Mirko Barthauer via sumo-user <sumo-user@xxxxxxxxxxx> wrote:

Dear Milad,

 

what exactly does not work or what is the error message when you try to run the code? Btw libsumo works with normal std::string values, not sure what happens if you use Unreal FString.

 

Best regards

Mirko

 

 

 

-----Original-Nachricht-----

Betreff: I can’t set libsumo library

Datum: 2024-02-28T01:44:19+0100

Von: "Milad Sasha" <milad.sasha70@xxxxxxxxx>

An: "Mirko Barthauer" <m.barthauer@xxxxxxxxxxx>, "sumo-user@xxxxxxxxxxx" <sumo-user@xxxxxxxxxxx>

 

 

 

Good morning dear Mirko Barthauer,

 

I hope you are well. I tried to include libsumo header in .h and .cpp of my visual studio project.

there is an error in this line of the example code:

Simulation::start({"sumo","-n", "net.net.xml"});

 

Do I need to give the path for sumogui.exe and the path to my network.xml like this:

FString SumoExecutablePath = "C:\\path\\to\\sumo.exe"; FString NetworkFilePath = "C:\\path\\to\\your\\network.net.xml";

Simulation::start({SumoExecutablePath, "-n", NetworkFilePath});

 

Actually, I cannot start the simulation since I cannot run the mentioned line of code. Could you please help me with this?

If there is no need to address "sumogui.exe" file and my network please let me know. Thank you so much in advance.

 

Best Regards,

Milad


_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top