Python API mode: allow using an external CARLA server (e.g. Docker) without killing it
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
Research direction
Start with utils/environment.py, where the issue identifies launch_env() and close_ros_and_simulators() as the relevant entry points. Check how Python API mode handles CARLA shutdown and reads CARLA_ROOT; the proposed change should allow an externally managed server to remain running without requiring that variable. Verify the reported Docker reproduction and relevant environment-launch tests; an open linked pull request (#742) is already working on this issue.
Written by the indexing model from the issue text.
Description
Expected behavior
In Python API mode (ROS_VERSION=None), Behavior Metrics should be able to connect to a CARLA server that is already running and managed outside Behavior Metrics (for example in a Docker container), without stopping it and without requiring CARLA_ROOT.
Actual behavior
launch_env() calls close_ros_and_simulators(), which runs killall -9 CarlaUE4.sh and killall -9 CarlaUE4-Linux-Shipping. The CARLA processes inside a Docker container are visible from the host, so the container's server is killed. In addition, launch_env() reads os.environ["CARLA_ROOT"] unconditionally and fails with KeyError: 'CARLA_ROOT' even when CARLA is already running.
Steps to reproduce
docker run -d --name carla-bm --gpus all --net=host carlasim/carla:0.9.15 ./CarlaUE4.sh -world-port=2000export ROS_VERSION=None(without CARLA_ROOT)python3 driver_carla.py -c configs/CARLA/default_carla_api.yml -g- The CARLA server in the container is killed, then
KeyError: 'CARLA_ROOT'.
Environment
Kubuntu 26.04.1 (Ubuntu base, X11 session), kernel 7.0, Intel i9-12900K, 32 GB RAM, NVIDIA RTX 5070 12 GB (driver 580.178.04), Python 3.10, CARLA 0.9.15 (carlasim/carla:0.9.15 Docker image), Behavior Metrics noetic-devel (dec1502), Python API mode.
Possible cause
close_ros_and_simulators() always kills CARLA, and CARLA_ROOT is read before checking whether CARLA is already running.
Possible solution
An opt-in environment variable BM_EXTERNAL_CARLA=1 that skips killing CARLA, and read CARLA_ROOT with os.environ.get() so it is only required when Behavior Metrics has to launch CARLA itself. I have a small patch ready (only utils/environment.py) and can open a PR, plus a documentation section for the install page.
Related: #672 (running CARLA on remote or cloud GPUs also benefits from an externally managed server).
- Dominant language
- Python
- Stars
- 65
- Forks
- 53
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JdeRobot/BehaviorMetrics
-
Python API mode: lane keeping and steering stability metrics (right lane percentage, steering zero crossings)Possibly taken @amateusr claimed this 20 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
JdeRobot/BehaviorMetrics#746 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
JdeRobot/BehaviorMetrics#745 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
JdeRobot/BehaviorMetrics#744 ·
-
Broken links in Quick start CARLA on BehaviorMetrics websitePossibly taken @canveo claimed this 293 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
JdeRobot/BehaviorMetrics#724 · 2 comments ·
-
Add reward-based metric for policy evaluation in CARLAMay be free again @Satyamgupta2365 claimed this 284 days ago, and no pull request is open. Open
Difficulty 5/5 Over a week Newbie friendliness 30/100
JdeRobot/BehaviorMetrics#723 · 4 comments ·
All issues in JdeRobot/BehaviorMetrics
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Maintainer] task area:visualizer
Difficulty 1/5 Under an hour Newbie friendliness 78/100
RailtownAI/railtracks#1824 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
apache/datafusion#27688 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
heasarc/heasarc-tutorials#317 ·
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
mloda-ai/mloda-registry#1664 ·
Maintainers usually reply within 1 day