Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CARLA simulator Carla Manage Environment Objects Tool

From Leeroopedia
Knowledge Sources
Domains Simulation, Environment, Utility
Last Updated 2026-02-15 05:00 GMT

Overview

Command-line utility script that enables, disables, and visualizes environment objects in a CARLA simulation by label or individual ID.

Description

This script (manage_environment_objects.py) provides comprehensive management of static environment objects in the CARLA scene. It defines an OBJECT_LABELS dictionary mapping 23 label names to carla.CityObjectLabel enum values (Buildings, Fences, Pedestrians, Poles, Roads, Sidewalks, Vehicles, TrafficSigns, TrafficLight, etc.). The script supports operations by individual object ID (--id) or by label category (-l/--label). Features include: --summary prints object counts per label, --show draws bounding boxes, points, and text labels in the scene for the specified duration, and --action (enable/disable) toggles object visibility via world.enable_environment_objects(). The visualization renders object locations as blue points, bounding boxes as blue wireframes, and identification text above each object.

Usage

Use this tool to manage scene complexity by enabling or disabling categories of environment objects, or to debug specific objects by visualizing their bounding boxes and metadata.

Code Reference

Source Location

  • Repository: CARLA
  • File: PythonAPI/util/manage_environment_objects.py

Signature

OBJECT_LABELS = {
    'Buildings': carla.CityObjectLabel.Buildings,
    'Fences': carla.CityObjectLabel.Fences,
    'Pedestrians': carla.CityObjectLabel.Pedestrians,
    'Roads': carla.CityObjectLabel.Roads,
    'Vehicles': carla.CityObjectLabel.Car,
    'TrafficLight': carla.CityObjectLabel.TrafficLight,
    'Any': carla.CityObjectLabel.Any,
    # ... 23 labels total
}

def main():
    """Parse args and manage environment objects by label or ID."""

Import

# Run as a command-line tool:
python manage_environment_objects.py -l Buildings --action disable

I/O Contract

Argument Type Default Description
--host str 127.0.0.1 CARLA server IP address
-p, --port int 2000 CARLA server TCP port
-l, --label str Any Object label category to manage
--id int None Specific object ID to manage
--show float None Duration to visualize object data (seconds)
--action choice None "enable" or "disable" the object(s)
--summary flag False Print object count summary per label

Usage Examples

# Print summary of all object labels and counts
python manage_environment_objects.py --summary

# Disable all buildings
python manage_environment_objects.py -l Buildings --action disable

# Enable a specific object by ID
python manage_environment_objects.py --id 12345 --action enable

# Visualize a specific object for 30 seconds
python manage_environment_objects.py --id 12345 --show 30

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment