eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.48k stars 1.4k forks source link

Check route traci #12321

Closed hassanidoudi closed 1 year ago

hassanidoudi commented 1 year ago

Hi all,

I want to check if a route exists between a beginning edge and an end edge using Traci. so get the result of verification.

Regards Hassan

m-kro commented 1 year ago

If you do not open/close lanes during the simulation, then you could use sumolib instead of TraCI: For example sumolib.net.getShortestPath. You can instatiate the sumolib net object like this:

net = sumolib.net.readNet(pathToNet)
route = net.getShortestPath("startEdgeID", "endEdgeID")
namdre commented 1 year ago

https://sumo.dlr.de/pydoc/traci._simulation.html#SimulationDomain-findRoute

hassanidoudi commented 1 year ago

Hi all I am programming with c++ and I need a function in traci not sumolib or how can import sumolib in c++.

Findroute returns a stage object not the bool that I need. Regards Hassan

namdre commented 1 year ago

You can use function Simulation.findRoute from C++: https://sumo.dlr.de/docs/Libsumo.html https://sumo.dlr.de/docs/Libtraci.html

There is currently no C++ equivalent for sumolib.

hassanidoudi commented 1 year ago

Hi all,

Can I use sumolib inside veins omnet++?

Regards Hassan

m-kro commented 1 year ago

As fas as I know, Veins means C++, thus no. Please look into Simulation.findRoute (see post above).

hassanidoudi commented 1 year ago

Hi all,

using veins I cannot use simulation.findroute because veins are already connected to sumo with traci and I couldn't implement a function called findroute in veins to connect with the traci findroute because of the return type (stage object)

Regards, Hassan

namdre commented 1 year ago

At this point your best approach is probably to engage with the Veins developers on Stackoverflow: https://veins.car2x.org/documentation/faq/

m-kro commented 1 year ago

Veins has its own interface to generate and process TraCI messages, limited to the functions the developers deem useful. See TraCICommandInterface in their github repo.