Browse Source
refactor: extend ScenarioBase with weather, max_frames, and ego_spawn_point props
refactor: extend ScenarioBase with weather, max_frames, and ego_spawn_point props
- Added ego_spawn_point for deterministic scenario starts - Implemented apply_parameters() for CLI parameter injection - Moved weather mapping logic to centralized src/utils.py - Emptied scenarios/__init__.py to prevent side-effect imports during discovery1843_integration
3 changed files with 84 additions and 4 deletions
@ -1,2 +1,2 @@ |
|||||
# scenarios package |
# scenarios package |
||||
from .showcase import ShowcaseScenario |
|
||||
|
# This file is intentionally empty to avoid side-effects when discovering modules. |
||||
@ -0,0 +1,29 @@ |
|||||
|
import carla |
||||
|
|
||||
|
def get_weather_preset(name: str): |
||||
|
""" |
||||
|
Map names (case-insensitive, partial matching) to carla.WeatherParameters. |
||||
|
""" |
||||
|
weather_presets = { |
||||
|
"Clear": carla.WeatherParameters.ClearNoon, |
||||
|
"Cloudy": carla.WeatherParameters.CloudyNoon, |
||||
|
"Wet": carla.WeatherParameters.WetNoon, |
||||
|
"SoftRain": carla.WeatherParameters.SoftRainNoon, |
||||
|
"Rain": carla.WeatherParameters.HardRainNoon, |
||||
|
"Sunset": carla.WeatherParameters.ClearSunset, |
||||
|
"Night": carla.WeatherParameters( |
||||
|
sun_altitude_angle=-90.0, |
||||
|
cloudiness=0.0, |
||||
|
precipitation=10.0, |
||||
|
precipitation_deposits=10.0, |
||||
|
wind_intensity=0.0, |
||||
|
fog_density=0.0, |
||||
|
fog_distance=0.0, |
||||
|
wetness=0.0 |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
for k, v in weather_presets.items(): |
||||
|
if k.lower() in name.lower(): |
||||
|
return v |
||||
|
return carla.WeatherParameters.ClearNoon |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue