From 6a648856d14e2e41765b39e74f7e42bfb3b21ad4 Mon Sep 17 00:00:00 2001 From: Christoph Pohl <christoph.pohl@kit.edu> Date: Thu, 25 Apr 2024 18:12:37 +0200 Subject: [PATCH] Remove dynamic library loading --- .../RobotUnitModuleControllerManagement.cpp | 26 ------ .../RobotUnitModuleControllerManagement.h | 19 +---- .../NJointControllerClassesWidget.cpp | 81 ++++++++++--------- .../units/RobotUnit/RobotUnitInterface.ice | 6 -- 4 files changed, 43 insertions(+), 89 deletions(-) diff --git a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.cpp b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.cpp index e53bb97ef..0ac2b9ad2 100644 --- a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.cpp +++ b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.cpp @@ -302,32 +302,6 @@ namespace armarx::RobotUnitModule return nJointControllers.at(instanceName); } - bool - ControllerManagement::loadLibFromPath(const std::string& path, const Ice::Current&) - { - throwIfInControlThread(BOOST_CURRENT_FUNCTION); - ARMARX_WARNING << "Do not use this function as it has implications on the RT thread (see " - "https://git.h2t.iar.kit.edu/sw/armarx-integration/robots/armar7/" - "documentation/-/issues/85)"; - const bool result = getArmarXManager()->loadLibFromPath(path); - ARMARX_INFO << "loadLibFromPath('" << path << "') -> " << result; - return result; - } - - bool - ControllerManagement::loadLibFromPackage(const std::string& package, - const std::string& lib, - const Ice::Current&) - { - throwIfInControlThread(BOOST_CURRENT_FUNCTION); - ARMARX_WARNING << "Do not use this function as it has implications on the RT thread (see " - "https://git.h2t.iar.kit.edu/sw/armarx-integration/robots/armar7/" - "documentation/-/issues/85)"; - const bool result = getArmarXManager()->loadLibFromPackage(package, lib); - ARMARX_INFO << "loadLibFromPackage('" << package << "', '" << lib << "') -> " << result; - return result; - } - Ice::StringSeq ControllerManagement::getNJointControllerClassNames(const Ice::Current&) const { diff --git a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.h b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.h index 9541d6c79..4f81e9317 100644 --- a/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.h +++ b/source/RobotAPI/components/units/RobotUnit/RobotUnitModules/RobotUnitModuleControllerManagement.h @@ -176,24 +176,7 @@ namespace armarx::RobotUnitModule */ NJointControllerClassDescriptionSeq getNJointControllerClassDescriptions( const Ice::Current& = Ice::emptyCurrent) const override; - /** - * @brief Loads the given lib. (calls `getArmarXManager()->loadLibFromPath(path)`) - * @param path Path to the lib to load. - * @return Whether loading the lib was successful. - * @see ArmarXManager::loadLibFromPath - */ - bool loadLibFromPath(const std::string& path, - const Ice::Current& = Ice::emptyCurrent) override; - /** - * @brief Loads the given lib. (calls `getArmarXManager()->loadLibFromPath(package, lib)`) - * @param package The armarx package containing the lib - * @param lib The lib name to load. - * @return Whether loading the lib was successful. - * @see ArmarXManager::loadLibFromPackage - */ - bool loadLibFromPackage(const std::string& package, - const std::string& lib, - const Ice::Current& = Ice::emptyCurrent) override; + /** * @brief Returns the names of all available classes of \ref NJointControllerBase. * @return The names of all available classes of \ref NJointControllerBase. diff --git a/source/RobotAPI/gui-plugins/RobotUnitPlugin/QWidgets/NJointControllerClassesWidget.cpp b/source/RobotAPI/gui-plugins/RobotUnitPlugin/QWidgets/NJointControllerClassesWidget.cpp index 4a752e88e..274d42e74 100644 --- a/source/RobotAPI/gui-plugins/RobotUnitPlugin/QWidgets/NJointControllerClassesWidget.cpp +++ b/source/RobotAPI/gui-plugins/RobotUnitPlugin/QWidgets/NJointControllerClassesWidget.cpp @@ -467,45 +467,48 @@ namespace armarx void NJointControllerClassesWidget::loadLibClicked() { - if (!robotUnit) - { - return; - } - - switch (selectLibMode) - { - case SelectLibsMode::LineEdit: - { - auto lib = ui->lineEditLibrary->text().toStdString(); - if (lib.empty()) - { - return; - } - ARMARX_INFO << "requesting to load lib " << lib - << " -> " << robotUnit->loadLibFromPath(lib); - } - break; - - case SelectLibsMode::ComboBox: - { - auto package = ui->comboBoxPackage->currentText().toStdString(); - auto lib = ui->comboBoxLibrary->currentText().toStdString(); - if (lib.empty()) - { - return; - } - if (libShortNameToFileName.count(lib)) - { - lib = libShortNameToFileName.at(lib); - } - ARMARX_INFO << "requesting to load lib " << lib << " from package " << package - << " -> " << robotUnit->loadLibFromPackage(package, lib); - } - break; - default: - ARMARX_WARNING << "Load lib for given SelectLibsMode nyi"; - break; - } + ARMARX_WARNING << "The functionality of dynamically loading libraries during runtime is no longer supported. Use" + "the component properties to load additional libraries."; + return; +// if (!robotUnit) +// { +// return; +// } + +// switch (selectLibMode) +// { +// case SelectLibsMode::LineEdit: +// { +// auto lib = ui->lineEditLibrary->text().toStdString(); +// if (lib.empty()) +// { +// return; +// } +//// ARMARX_INFO << "requesting to load lib " << lib +//// << " -> " << robotUnit->loadLibFromPath(lib); +// } +// break; +// +// case SelectLibsMode::ComboBox: +// { +// auto package = ui->comboBoxPackage->currentText().toStdString(); +// auto lib = ui->comboBoxLibrary->currentText().toStdString(); +// if (lib.empty()) +// { +// return; +// } +// if (libShortNameToFileName.count(lib)) +// { +// lib = libShortNameToFileName.at(lib); +// } +//// ARMARX_INFO << "requesting to load lib " << lib << " from package " << package +//// << " -> " << robotUnit->loadLibFromPackage(package, lib); +// } +// break; +// default: +// ARMARX_WARNING << "Load lib for given SelectLibsMode nyi"; +// break; +// } } } diff --git a/source/RobotAPI/interface/units/RobotUnit/RobotUnitInterface.ice b/source/RobotAPI/interface/units/RobotUnit/RobotUnitInterface.ice index 32bfba607..97a40339d 100644 --- a/source/RobotAPI/interface/units/RobotUnit/RobotUnitInterface.ice +++ b/source/RobotAPI/interface/units/RobotUnit/RobotUnitInterface.ice @@ -282,12 +282,6 @@ module armarx void deactivateAndDeleteNJointController(string controllerInstanceName)throws InvalidArgumentException, LogicError; void deactivateAndDeleteNJointControllers(Ice::StringSeq controllerInstanceNames)throws InvalidArgumentException, LogicError; - - //loading libs - ["deprecate:loadLibFromPath(string path) has dangerous implications on the RT thread. Use the scenario config instead to load additional libraries. See https://git.h2t.iar.kit.edu/sw/armarx-integration/robots/armar7/documentation/-/issues/85"] - bool loadLibFromPath(string path); - ["deprecate:loadLibFromPackage(string package, string libname) has dangerous implications on the RT thread. Use the scenario config instead to load additional libraries. See https://git.h2t.iar.kit.edu/sw/armarx-integration/robots/armar7/documentation/-/issues/85"] - bool loadLibFromPackage(string package, string libname); }; interface RobotUnitSelfCollisionCheckerInterface { -- GitLab