From d0e6c33cd7435d90b460d9d0fd64dcdbc8618787 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Tue, 20 Feb 2024 17:04:50 +0100 Subject: [PATCH] check result of get_parameter(plugin_lib_names) Signed-off-by: Davide Faconti --- nav2_bt_navigator/src/bt_navigator.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nav2_bt_navigator/src/bt_navigator.cpp b/nav2_bt_navigator/src/bt_navigator.cpp index 2b2c116eeb..7ff78ac096 100644 --- a/nav2_bt_navigator/src/bt_navigator.cpp +++ b/nav2_bt_navigator/src/bt_navigator.cpp @@ -75,11 +75,17 @@ BtNavigator::on_configure(const rclcpp_lifecycle::State & /*state*/) // Libraries to pull plugins (BT Nodes) from std::vector plugin_lib_names; boost::split(plugin_lib_names, nav2::details::BT_BUILTIN_PLUGINS, boost::is_any_of(";")); - auto user_defined_plugins = get_parameter("plugin_lib_names").as_string_array(); - // append user_defined_plugins to plugin_lib_names - plugin_lib_names.insert( - plugin_lib_names.end(), user_defined_plugins.begin(), - user_defined_plugins.end()); + + rclcpp::Parameter plugins_param; + if(get_parameter("plugin_lib_names", plugins_param) && + plugins_param.get_type() == rclcpp::ParameterType::PARAMETER_STRING_ARRAY) + { + auto user_defined_plugins = plugins_param.as_string_array(); + // append user_defined_plugins to plugin_lib_names + plugin_lib_names.insert( + plugin_lib_names.end(), user_defined_plugins.begin(), + user_defined_plugins.end()); + } nav2_core::FeedbackUtils feedback_utils; feedback_utils.tf = tf_;