GUI support for libsumo
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?
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
Thanks for your very quick reply. Actually we are using c++. So is it possible to invoke libsumo inside guisim_main.cpp?
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.
Thank you very much.
@namdre @behrisch can I close this Ticket?
@namdre @behrisch can I close this Ticket?
Please leave this open.
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
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 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.
So how can we use GUI with c++
with libtraci: https://sumo.dlr.de/docs/Libtraci.html
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.
Since this is now deviating from the topic of this ticket, please open up a new issue to discuss it.
@andngdtudk For verification use traci instead of libsumo. They are 100% API-compatible so all you need to change is the
importstatement in your script.
Thanks, it works well. The bug occurred because I had set the environment variable LIBSUMO_AS_TRACI