sumo icon indicating copy to clipboard operation
sumo copied to clipboard

GUI support for libsumo

Open ykwd opened this issue 6 years ago • 9 comments

Currently we are using libsumo to substitute TraCI to avoid the huge TCP/IP communication overhead. The drawback of this substitution is that libsumo doesn't support GUI. So I am wondering if with reasonable amount of work we can run sumo-gui and then control it with libsumo. And if so, how can we do it?

ykwd avatar Feb 17 '20 07:02 ykwd

Currently, it is not possible to use libsumo with gui. We are aware of this and have plans to add the functionality. If you are using python as client language, the recommended workaround is to develop/test your client code with traci and switch the same code to libsumoe by either

  • adding the line import libsumo as traci
  • or setting environment variable LIBSUMO_AS_TRACI=1

namdre avatar Feb 17 '20 07:02 namdre

Thanks for your very quick reply. Actually we are using c++. So is it possible to invoke libsumo inside guisim_main.cpp?

ykwd avatar Feb 17 '20 07:02 ykwd

No. If it was that easy we'd already have fixed it. The way that the gui interacts with the simulation is a bit more complicated. You could try using the C++ traci client for development (which supports gui) and then switch to C++ libsumo for running. Our intent is outlined at #6664. Feel free to add comments to that ticket to describe things that aren't working yet.

namdre avatar Feb 17 '20 07:02 namdre

Thank you very much.

ykwd avatar Feb 17 '20 08:02 ykwd

@namdre @behrisch can I close this Ticket?

palvarezlopez avatar Jan 28 '21 12:01 palvarezlopez

@namdre @behrisch can I close this Ticket?

Please leave this open.

namdre avatar Jan 28 '21 12:01 namdre

The current state is that for more than 400 tests it seems to be successful consistently. Still missing

  • [ ] fix hangups in libsumo.gui tests
  • [ ] windows support

behrisch avatar Nov 12 '23 19:11 behrisch

Hi,

I am encountering the following issue: "Warning: Libsumo on Windows does not work with GUI, falling back to plain libsumo." Does anyone have any suggestions? I need to verify my simulation using the GUI. Thank you.

andngdtudk avatar Jul 29 '24 14:07 andngdtudk

@andngdtudk For verification use traci instead of libsumo. They are 100% API-compatible so all you need to change is the import statement in your script.

namdre avatar Jul 30 '24 15:07 namdre

So how can we use GUI with c++

UTTUBALIYAN avatar Sep 10 '24 04:09 UTTUBALIYAN

with libtraci: https://sumo.dlr.de/docs/Libtraci.html

namdre avatar Sep 10 '24 05:09 namdre

thanks for replying, basically I'm working on the source code of the sumo eclipse in which I want to use traci libraries to build my logic which I had already built in python with traci but now I need in cpp for that i need traci but with libsumo the cfg file is loading but not reflecting in the simulator and when I'm using libtraci as my namespace and start the simulation then this error is coming that libtraci is not declared.

UTTUBALIYAN avatar Sep 10 '24 05:09 UTTUBALIYAN

Since this is now deviating from the topic of this ticket, please open up a new issue to discuss it.

namdre avatar Sep 10 '24 06:09 namdre

@andngdtudk For verification use traci instead of libsumo. They are 100% API-compatible so all you need to change is the import statement in your script.

Thanks, it works well. The bug occurred because I had set the environment variable LIBSUMO_AS_TRACI

andngdtudk avatar Nov 29 '24 10:11 andngdtudk