Implementation:CARLA simulator Carla Config Tool
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Configuration, Utility |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
Comprehensive command-line utility script for configuring and inspecting a running CARLA simulator instance, supporting map loading, rendering control, frame rate settings, and simulation inspection.
Description
This script (config.py) is the primary configuration tool for the CARLA simulator. It provides the following functions: get_ip() resolves the local IP address, list_options() displays available maps, list_blueprints() shows available blueprints matching a filter, and inspect() prints a detailed summary of the simulation state including address, version, current map, elapsed time, frame rate, rendering mode, sync mode, and actor counts by type. The main() function supports a wide range of command-line arguments for loading maps (-m), reloading maps (-r), loading OpenDRIVE files (-x), loading OpenStreetMap files (--osm-path), enabling/disabling rendering (--rendering/--no-rendering), disabling sync mode (--no-sync), setting fixed delta seconds (--delta-seconds) or FPS (--fps), configuring tile streaming distance, and setting actor active distance for large maps.
Usage
Use this tool as the primary means of configuring a running CARLA simulator from the command line. It replaces manual configuration through the Python API for common operations.
Code Reference
Source Location
- Repository: CARLA
- File: PythonAPI/util/config.py
Signature
def get_ip(host):
"""Resolve local IP address."""
def list_options(client):
"""Print available maps."""
def list_blueprints(world, bp_filter):
"""Print available blueprints matching filter."""
def inspect(args, client):
"""Print detailed simulation status."""
def main():
"""Parse args and apply configuration changes."""
Import
# Run as a command-line tool:
python config.py --host localhost -p 2000 -m Town01
I/O Contract
| Argument | Type | Default | Description |
|---|---|---|---|
| --host | str | localhost | CARLA server IP address |
| -p, --port | int | 2000 | CARLA server TCP port |
| -l, --list | flag | False | List available maps |
| -b, --list-blueprints | str | None | List blueprints matching filter |
| -m, --map | str | None | Load a specific map |
| -r, --reload-map | flag | False | Reload current map |
| --delta-seconds | float | None | Set fixed delta seconds (0 for variable) |
| --fps | float | None | Set fixed FPS (0 for variable) |
| --rendering | flag | False | Enable rendering |
| --no-rendering | flag | False | Disable rendering |
| --no-sync | flag | False | Disable synchronous mode |
| -i, --inspect | flag | False | Print simulation status |
| -x, --xodr-path | str | None | Load OpenDRIVE map file |
| --osm-path | str | None | Load OpenStreetMap file |
| --tile-stream-distance | float | None | Tile streaming distance (large maps) |
| --actor-active-distance | float | None | Actor active distance (large maps) |
Usage Examples
# Inspect current simulation state
python config.py -i
# List available maps
python config.py -l
# Load a specific map
python config.py -m Town03
# Set fixed FPS and enable synchronous rendering
python config.py --fps 30 --rendering
# Load an OpenDRIVE map
python config.py -x /path/to/custom_map.xodr
# Disable rendering for headless simulation
python config.py --no-rendering