Closed Kipt closed 3 years ago
Hey @Kipt. That is indeed the case. However, this isn't an SR problem but a CARLA one, as we are only inheriting from that class. I'm moving to the CARLA repository
A similar error is found when executing the tutorial.py from the PythonAPI examples. In my case I runned the client on localhost and port 2000.
~]$ python tutorial.py
created vehicle.audi.etron
destroying actors
Traceback (most recent call last):
File "tutorial.py", line 76, in main
vehicle.set_autopilot(True)
RuntimeError: trying to create rpc server for traffic manager; but the system failed to create because of bind error.
Hope it helps!
Seeing this in CARLA 0.9.8 when I run more than one CARLA PythonAPI client script on the same node.
Looks like client.get_trafficmanager(port)
only creates a new TM and leaves the old one running on port 8000, worse, other clients see there is already a TM port listening and will connect to it if I'm reading the documentation correct.
Meaning, if one is running multiple carla servers with different client scripts connecting to each server, this doesn't sound good: https://carla.readthedocs.io/en/0.9.8/adv_traffic_manager/#multiclient-and-multitm-management
@qhaas I'm experiencing the same issue. Any fixes? So far I have to manually kill all Python processes before running another script again.
No, one is going to have to edit the C++ side of the TM code to address this, I believe.
My fix so far is to kill all Python process' and run the code again. Don't know why it happens, but it happens.
@jackbart94 can you have a look at this please?
Please, could you let me know if this is happening with current dev, or at least CARLA 0.9.11?
Here is a simple test with CARLA 0.9.11, seems to keep on using port 8000:
#!/bin/python3
import socket
import traceback
import time
import carla
try:
client = carla.Client('127.0.0.1', 2000)
tm = client.get_trafficmanager(6000)
world = client.get_world()
blueprint_library = world.get_blueprint_library()
transform = world.get_map().get_spawn_points()[0]
vehicle = world.spawn_actor(blueprint_library.filter('vehicle')[0], transform)
vehicle.set_autopilot(True)
time.sleep(1)
for i in [22,3000,6000,8000]:
testSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result='inactive'
if testSocket.connect_ex(('127.0.0.1',i)) == 0:
result='active'
print('{}: {}'.format(i,result))
testSocket.close()
except:
traceback.print_exc()
The results with CARLA 0.9.11:
22: active
3000: inactive
6000: active
8000: active
UPDATE: With newer versions of CARLA, we can set a port number for autopilot. Thus by changing the above to vehicle.set_autopilot(True, 6000)
, we get:
22: active
2000: active
3000: inactive
6000: active
8000: inactive
Which 'fixes' the issue, but I'd argue that the default port for TM used by autopilot should be whatever the client is set to via get_trafficmanager(PORT)
.
UPDATE 2: Here is a backport patch (i.e. just copied relevant snippets from 0.9.11 to 0.9.8) of the relevant CARLA 0.9.11 API to CARLA 0.9.8 that passes the port, for those (like us) that are stuck on CARLA 0.9.8:
carla_issue_3543.txt
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm running several Carla instances through Docker and map the Traffic Manager port, but _manualcontrol.py includes the _manualcontrol.py in the examples folder that uses default port. This causes a runtime error in
KeyboardControl
constructor,world.player.set_autopilot(self._autopilot_enabled)
.Steps to reproduce:
--host
,--port
and--trafficManagerPort
arguments.manual_control.py
.Expected behavior pygame window appearing with a vehicle to control.
Actual behavior Crash with message: