Skip to content

Commit

Permalink
Limit bridge threads (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbest-tri committed Dec 19, 2022
1 parent 5fec011 commit 58c01e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions carla_ros_bridge/src/carla_ros_bridge/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Class that handle communication between CARLA and ROS
"""

import multiprocessing
import os
import pkg_resources
try:
Expand Down Expand Up @@ -38,6 +38,10 @@
from rosgraph_msgs.msg import Clock


# Cyclone DDS on large core counts will not play nicely. Limit process to 16 cores.
WORKER_THREADS = 0 if multiprocessing.cpu_count() < 16 else 16


class CarlaRosBridge(CompatibleNode):

"""
Expand Down Expand Up @@ -418,7 +422,9 @@ def main(args=None):
try:
carla_client = carla.Client(
host=parameters['host'],
port=parameters['port'])
port=parameters['port'],
worker_threads=WORKER_THREADS
)
carla_client.set_timeout(parameters['timeout'])

# check carla version
Expand Down

0 comments on commit 58c01e0

Please sign in to comment.