Closed alizz-99 closed 8 months ago
Artery uses a random port for TraCI by default, see the traci/PosixLauncher
module. You can set it to a fixed port number by setting the module's port
parameter in your omnetpp.ini.
Thank you for the quick response! But I have added to my omnetpp.ini: *.traci.launcher.port = 8813, and I still can't access that port from the python file. The error persists.
Hi! I have managed to customize the port number, but I guess since artery uses traci, sumo by default only accepts one client connection. I have seen that you can modify this value with --num-clients. I don't know if it is possible to modify this value in artery.
You can use *.traci.launcher.extraOptions
to pass any option you want to SUMO.
Perfect thank you! I get sumo to wait for two clients to connect. One connects automatically from artery and the second one I connect from the python file getting this response in the sumo logs: Starting server on port 8000 waiting for 2 clients... client connected client connected but it gets stuck there and does nothing. If I try to do traci.simulationStep() I get an error.
Hello! I finally reached my goal using *.traci.launcher.extraOptions thank you very much! Now another question, I've created a service that I have equipped to a static rsu, which processes the data of the vehicles and I would like to control the traffic lights from this code and I do not know how. I am trying to reach this data with
std::shared_ptr<traci::API> m_traci;
auto& trafficlights_api = m_traci->trafficlights;
but I got nothing, it returns a dumped core.
Your m_traci
shared pointer is empty and thus dereferencing it crashes the program. Just because code compiles does not mean it is correct.
You can retrieve a valid traci::API
object by looking up the NodeManager
object usually located at module path World.traci.nodes. The NodeManager
has a getAPI
getter method for exactly your purpose.
I'm trying to do something like that but it doesn't work either... I'm not sure if I understood you correctly:
std::shared_prt<traci::NodeManager> manager;
auto api = manager->getAPI()->trafficlights;
errors:
Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).
Segmentation fault (core dumped)
Hello again! I would just like to know if it is possible to create a service for RSUs, and inside this service to have access to the traffic lights of the scene by traci, as it is done in cars with mVehiclecontroller.
Hi! I am trying to connect to the traci server from an external python file. I have read that by default traci is connected to port 8813 but when i try this in the script: traci.connect(port=8813) it returns the following error: Could not connect to TraCI server at localhost:8813 [Errno 111] Connection refused. I have also tried to modify the sumo configuration file and put , but I can't connect either.
Thank you!