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
fabianoboril committed Oct 20, 2020
1 parent 06ec3ac commit 5ca1878
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 @@ -284,8 +284,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 @@ -316,8 +318,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 5ca1878

Please sign in to comment.