Skip to content

Utilities

CarlaCarColor pydantic-model ¤

a: int pydantic-field ¤

b: int pydantic-field ¤

g: int pydantic-field ¤

r: int pydantic-field ¤

__config__ ¤

__json_encoder__(obj) special staticmethod ¤

to_string(self, *args, **kwargs) ¤

Source code in carla_client/util/utilities.py
def to_string(self, *args, **kwargs):
    return f"{self.r},{self.g},{self.b}"

CarlaCarColors ¤

BLACK: CarlaCarColor ¤

BLUE: CarlaCarColor ¤

GREEN: CarlaCarColor ¤

GREY: CarlaCarColor ¤

RED: CarlaCarColor ¤

WHITE: CarlaCarColor ¤

CarlaWeather pydantic-model ¤

Default weather is sunny

cloudiness: float pydantic-field ¤

fog_density: float pydantic-field ¤

fog_distance: float pydantic-field ¤

precipitation: float pydantic-field ¤

precipitation_deposits: float pydantic-field ¤

sun_altitude_angle: float pydantic-field ¤

sun_azimuth_angle: float pydantic-field ¤

wetness: float pydantic-field ¤

wind_intensity: float pydantic-field ¤

__config__ ¤

__json_encoder__(obj) special staticmethod ¤

to_carla_weather_params(self) ¤

Source code in carla_client/util/utilities.py
def to_carla_weather_params(self):
    return carla.WeatherParameters(
        cloudiness=self.cloudiness,
        precipitation=self.precipitation,
        precipitation_deposits=self.precipitation_deposits,
        wind_intensity=self.wind_intensity,
        sun_azimuth_angle=self.sun_azimuth_angle,
        sun_altitude_angle=self.sun_altitude_angle,
        fog_density=self.fog_density,
        fog_distance=self.fog_distance,
        wetness=self.wetness,
    )

CarlaWeathers ¤

create_dir_if_not_exist(path) ¤

Source code in carla_client/util/utilities.py
def create_dir_if_not_exist(path: Path):
    if not path.exists():
        path.mkdir(parents=True, exist_ok=True)

get_actor_display_name(actor, truncate=250) ¤

Source code in carla_client/util/utilities.py
def get_actor_display_name(actor, truncate=250):
    name = " ".join(actor.type_id.replace("_", ".").title().split(".")[1:])
    return (name[: truncate - 1] + "\u2026") if len(name) > truncate else name