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 LightManager API Spec

From Leeroopedia
Knowledge Sources
Domains Simulation, Lighting, API Specification
Last Updated 2026-02-15 05:00 GMT

Overview

YML specification file that defines lighting-related classes in the CARLA Python API, including LightGroup, LightState, Light, and LightManager (currently commented out and in development).

Description

This YML file specifies the lighting system classes for controlling scene illumination in the CARLA simulator. The classes are currently defined as commented-out specifications indicating an API under development. LightGroup categorizes lights into groups (None, Vehicle, Street, Building, Other) usable as enum flags. LightState encapsulates light attributes (intensity in lumens, color, group, active state). Light exposes individual scene lights with properties for color, id, intensity, is_on, location, light_group, and light_state, along with methods like turn_on(), turn_off(), set_color(), set_intensity(), set_light_group(), and set_light_state(). LightManager provides batch operations via is_active(), turn_on(), and turn_off() for lists of lights, retrieved through carla.World.get_lightmanager(). Vehicle lights are managed separately through carla.Vehicle and carla.VehicleLightState.

Usage

Use these classes to query and control scene lighting in CARLA simulations. The LightManager enables batch operations on groups of lights, useful for day/night cycle management and ambient lighting control.

Code Reference

Source Location

  • Repository: CARLA
  • File: PythonAPI/docs/light_manager.yml

Signature

- module_name: carla
  classes:
  # - class_name: LightGroup
  #   instance_variables:
  #   - var_name: None       # All lights
  #   - var_name: Vehicle
  #   - var_name: Street
  #   - var_name: Building
  #   - var_name: Other

  # - class_name: LightState
  #   instance_variables:
  #   - var_name: intensity  # type: float (lumens)
  #   - var_name: color      # type: carla.Color
  #   - var_name: group      # type: carla.LightGroup
  #   - var_name: active     # type: bool

  # - class_name: Light
  #   methods:
  #   - def_name: turn_off
  #   - def_name: turn_on
  #   - def_name: set_color
  #   - def_name: set_intensity
  #   - def_name: set_light_group
  #   - def_name: set_light_state

  # - class_name: LightManager
  #   methods:
  #   - def_name: is_active(lights)   # return: list(bool)
  #   - def_name: turn_off(lights)
  #   - def_name: turn_on(lights)

Import

import carla
world = client.get_world()
light_manager = world.get_lightmanager()

I/O Contract

Class Key Properties/Methods Description
LightGroup None, Vehicle, Street, Building, Other Enum categorizing light groups
LightState intensity, color, group, active Encapsulates light state parameters
Light color, id, intensity, is_on, location Individual scene light control
LightManager is_active(), turn_on(), turn_off() Batch light operations

Usage Examples

import carla

client = carla.Client('localhost', 2000)
world = client.get_world()

# Get the light manager
light_manager = world.get_lightmanager()

# Get all street lights
street_lights = light_manager.get_all_lights(carla.LightGroup.Street)

# Turn off all street lights
light_manager.turn_off(street_lights)

# Set a specific light's color
for light in street_lights:
    light.set_color(carla.Color(255, 200, 150))
    light.set_intensity(5000.0)

Related Pages

Page Connections

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