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 WeatherParameters

From Leeroopedia
Revision as of 12:15, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/CARLA_simulator_Carla_WeatherParameters.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Weather System, RPC Serialization
Last Updated 2026-02-15 05:00 GMT

Overview

WeatherParameters is an RPC-serializable class that defines all environmental weather conditions in the CARLA simulation, including 22 built-in weather presets covering day, night, rain, and dust storm scenarios.

Description

Defined in the carla::rpc namespace across a header (~178 lines) and implementation file (~40 lines), this class provides 14 float parameters controlling the weather:

  • cloudiness, precipitation, precipitation_deposits: cloud cover and rain
  • wind_intensity: wind strength
  • sun_azimuth_angle, sun_altitude_angle: sun position
  • fog_density, fog_distance, fog_falloff: fog parameters
  • wetness: ground wetness
  • scattering_intensity, mie_scattering_scale, rayleigh_scattering_scale: atmospheric scattering
  • dust_storm: dust storm intensity

The implementation file defines 22 static preset configurations including ClearNoon, CloudyNoon, WetNoon, HardRainNoon, ClearSunset, ClearNight, HardRainNight, DustStorm, and others. Each preset specifies all 14 parameters. The class supports UE4 conversion via FWeatherParameters, equality operators, and MsgPack serialization.

Usage

Use this type to set or query the weather conditions of the simulation, either using built-in presets or custom parameter values.

Code Reference

Source Location

  • Repository: CARLA
  • File: LibCarla/source/carla/rpc/WeatherParameters.h
  • File: LibCarla/source/carla/rpc/WeatherParameters.cpp

Signature

namespace carla {
namespace rpc {

  class WeatherParameters {
  public:
    // 22 built-in presets
    static WeatherParameters Default;
    static WeatherParameters ClearNoon;
    static WeatherParameters CloudyNoon;
    static WeatherParameters HardRainNoon;
    static WeatherParameters ClearNight;
    static WeatherParameters DustStorm;
    // ... and 16 more presets

    WeatherParameters() = default;
    WeatherParameters(float cloudiness, float precipitation, ...);

    float cloudiness = 0.0f;
    float precipitation = 0.0f;
    float precipitation_deposits = 0.0f;
    float wind_intensity = 0.0f;
    float sun_azimuth_angle = 0.0f;
    float sun_altitude_angle = 0.0f;
    float fog_density = 0.0f;
    float fog_distance = 0.0f;
    float fog_falloff = 0.0f;
    float wetness = 0.0f;
    float scattering_intensity = 0.0f;
    float mie_scattering_scale = 0.0f;
    float rayleigh_scattering_scale = 0.0331f;
    float dust_storm = 0.0f;

    bool operator==(const WeatherParameters &rhs) const;
    bool operator!=(const WeatherParameters &rhs) const;

    MSGPACK_DEFINE_ARRAY(...);
  };

} // namespace rpc
} // namespace carla

Import

#include "carla/rpc/WeatherParameters.h"

I/O Contract

Field Type Default Description
cloudiness float 0.0f Cloud cover percentage (0-100)
precipitation float 0.0f Rain intensity (0-100)
precipitation_deposits float 0.0f Puddle/deposit amount (0-100)
wind_intensity float 0.0f Wind strength (0-100)
sun_azimuth_angle float 0.0f Sun horizontal angle in degrees
sun_altitude_angle float 0.0f Sun vertical angle in degrees
fog_density float 0.0f Fog density
fog_distance float 0.0f Fog starting distance
fog_falloff float 0.0f Fog falloff rate
wetness float 0.0f Ground wetness (0-100)
dust_storm float 0.0f Dust storm intensity (0-100)

Weather Presets

Preset Time Condition Key Differences
ClearNoon Day (45 deg) Clear Low cloudiness, no precipitation
HardRainNoon Day (45 deg) Heavy rain 100% precipitation, high fog
ClearNight Night (-90 deg) Clear High fog density, negative altitude
DustStorm Day (45 deg) Dust 100% dust_storm, 100% wind

Usage Examples

#include "carla/rpc/WeatherParameters.h"

// Use a preset
auto weather = carla::rpc::WeatherParameters::ClearNoon;

// Or customize
weather.precipitation = 50.0f;
weather.fog_density = 10.0f;

// Apply weather to the simulation
world->SetWeather(weather);

Related Pages

Page Connections

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