From c4013ef22ef795aa60f044ac626ce3af2fbb8517 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Sat, 23 Mar 2024 16:24:34 +0000 Subject: [PATCH] Use os.environ.get('ROS_DISTRO') instead --- .../rqt_controller_manager/controller_manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rqt_controller_manager/rqt_controller_manager/controller_manager.py b/rqt_controller_manager/rqt_controller_manager/controller_manager.py index a71a016745..0683c53a1e 100644 --- a/rqt_controller_manager/rqt_controller_manager/controller_manager.py +++ b/rqt_controller_manager/rqt_controller_manager/controller_manager.py @@ -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)]