Skip to content

Commit

Permalink
Fixed handling of Weather in OSC
Browse files Browse the repository at this point in the history
Fixed an issue introduced 3 commits before (#656)
  • Loading branch information
yaknostoyok authored and fabianoboril committed Oct 19, 2020
1 parent 60d6c15 commit 4cc5903
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions srunner/tools/openscenario_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ def get_friction_from_env_action(xml_tree, catalogs):
returns:
friction (float)
"""
if xml_tree.find("EnvironmentAction") is not None:
set_environment = next(xml_tree.iter("EnvironmentAction"))

if xml_tree.findall('.//EnvironmentAction'):
node = xml_tree.findall('.//EnvironmentAction')[0]
set_environment = next(node.iter("EnvironmentAction"))
else:
return 1.0

Expand Down Expand Up @@ -301,8 +303,10 @@ def get_weather_from_env_action(xml_tree, catalogs):
returns:
Weather (srunner.scenariomanager.weather_sim.Weather)
"""
if xml_tree.find("EnvironmentAction") is not None:
set_environment = next(xml_tree.iter("EnvironmentAction"))

if xml_tree.findall('.//EnvironmentAction'):
node = xml_tree.findall('.//EnvironmentAction')[0]
set_environment = next(node.iter("EnvironmentAction"))
else:
return Weather(carla.WeatherParameters())

Expand Down

0 comments on commit 4cc5903

Please sign in to comment.