Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed handling of Weather in OSC #668

Merged
merged 2 commits into from
Oct 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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