Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def find_weather_presets():
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]
def find_weather_presets():
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]
def __init__(self, filename, client):
self.xml_tree = ET.parse(filename)
self._filename = filename
self._validate_openscenario_configuration()
self.client = client
self.catalogs = {}
self.other_actors = []
self.ego_vehicles = []
self.trigger_points = []
self.weather = carla.WeatherParameters()
self.storyboard = self.xml_tree.find("Storyboard")
self.story = self.storyboard.find("Story")
self.init = self.storyboard.find("Init")
logging.basicConfig()
self.logger = logging.getLogger("[SR:OpenScenarioConfiguration]")
self._set_parameters()
self._parse_openscenario_configuration()
def find_weather_presets():
"""
Get weather presets from CARLA
"""
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]
def find_weather_presets():
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]
def find_weather_presets():
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]
def parse_weather(route):
"""
Returns a carla.WeatherParameters with the corresponding weather for that route. If the route
has no weather attribute, the default one is triggered.
"""
route_weather = route.find("weather")
if route_weather is None:
weather = carla.WeatherParameters(sun_altitude_angle=70)
else:
weather = carla.WeatherParameters()
for weather_attrib in route.iter("weather"):
if 'cloudiness' in weather_attrib.attrib:
weather.cloudiness = float(weather_attrib.attrib['cloudiness'])
if 'precipitation' in weather_attrib.attrib:
weather.precipitation = float(weather_attrib.attrib['precipitation'])
if 'precipitation_deposits' in weather_attrib.attrib:
weather.precipitation_deposits = float(weather_attrib.attrib['precipitation_deposits'])
if 'wind_intensity' in weather_attrib.attrib:
weather.wind_intensity = float(weather_attrib.attrib['wind_intensity'])
if 'sun_azimuth_angle' in weather_attrib.attrib:
weather.sun_azimuth_angle = float(weather_attrib.attrib['sun_azimuth_angle'])
if 'sun_altitude_angle' in weather_attrib.attrib:
def find_weather_presets():
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), x) for x in presets]
def weathers():
list_weathers = [carla.WeatherParameters.ClearNoon,
carla.WeatherParameters.CloudyNoon,
carla.WeatherParameters.SoftRainSunset
]
return list_weathers
def find_weather_presets():
rgx = re.compile('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)')
name = lambda x: ' '.join(m.group(0) for m in rgx.finditer(x))
presets = [x for x in dir(carla.WeatherParameters) if re.match('[A-Z].+', x)]
return [(getattr(carla.WeatherParameters, x), name(x)) for x in presets]