Skip to content

Commit

Permalink
Use os.environ.get('ROS_DISTRO') instead
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Mar 23, 2024
1 parent 2cf8c02 commit c4013ef
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ def _get_parameter_controller_names(node, node_name):
parameter_names = call_list_parameters(node=node, node_name=node_name)
suffix = ".type"
# @note: The versions conditioning is added here to support the source-compatibility with Humble
try:
if os.environ.get('ROS_DISTRO') == "humble":
# for humble, ros2param < 0.20.0
return [n[: -len(suffix)] for n in parameter_names if n.endswith(suffix)]
else:
return [
n[: -len(suffix)] for n in parameter_names.result().result.names if n.endswith(suffix)
]
except:
# for humble, ros2param < 0.20.0
return [n[: -len(suffix)] for n in parameter_names if n.endswith(suffix)]

0 comments on commit c4013ef

Please sign in to comment.