diff --git a/moveit_setup_assistant/moveit_setup_assistant/src/collisions_updater.cpp b/moveit_setup_assistant/moveit_setup_assistant/src/collisions_updater.cpp index 48babb454c..e30581f92e 100644 --- a/moveit_setup_assistant/moveit_setup_assistant/src/collisions_updater.cpp +++ b/moveit_setup_assistant/moveit_setup_assistant/src/collisions_updater.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) auto package_settings = config_data->get("package_settings"); try { - package_settings->loadExisting(config_pkg_path); + package_settings->loadExisting(config_pkg_path.string()); } catch (const std::runtime_error& e) { @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) RCLCPP_ERROR_STREAM(LOGGER, "Please provide config package or URDF and SRDF path"); return 1; } - else if (rdf_loader::RDFLoader::isXacroFile(srdf_path) && output_path.empty()) + else if (rdf_loader::RDFLoader::isXacroFile(srdf_path.string()) && output_path.empty()) { RCLCPP_ERROR_STREAM(LOGGER, "Please provide a different output file for SRDF xacro input file"); return 1; diff --git a/moveit_setup_assistant/moveit_setup_assistant/src/setup_assistant_widget.cpp b/moveit_setup_assistant/moveit_setup_assistant/src/setup_assistant_widget.cpp index 2f9a76f5e4..e5e7f4bd70 100644 --- a/moveit_setup_assistant/moveit_setup_assistant/src/setup_assistant_widget.cpp +++ b/moveit_setup_assistant/moveit_setup_assistant/src/setup_assistant_widget.cpp @@ -71,7 +71,7 @@ SetupAssistantWidget::SetupAssistantWidget(const rviz_common::ros_integration::R // Setting the window icon auto icon_path = getSharePath("moveit_ros_visualization") / "icons/classes/MotionPlanning.png"; - this->setWindowIcon(QIcon(icon_path.c_str())); + setWindowIcon(QIcon(icon_path.string().c_str())); // Basic widget container ----------------------------------------- QHBoxLayout* layout = new QHBoxLayout(); diff --git a/moveit_setup_assistant/moveit_setup_core_plugins/include/moveit_setup_core_plugins/configuration_files.hpp b/moveit_setup_assistant/moveit_setup_core_plugins/include/moveit_setup_core_plugins/configuration_files.hpp index bfca1e8d62..3d3f3ab386 100644 --- a/moveit_setup_assistant/moveit_setup_core_plugins/include/moveit_setup_core_plugins/configuration_files.hpp +++ b/moveit_setup_assistant/moveit_setup_core_plugins/include/moveit_setup_core_plugins/configuration_files.hpp @@ -80,7 +80,7 @@ class ConfigurationFiles : public SetupStep bool shouldGenerate(const GeneratedFilePtr& file) const { - std::string rel_path = file->getRelativePath(); + std::string rel_path = file->getRelativePath().string(); auto it = should_generate_.find(rel_path); if (it == should_generate_.end()) { diff --git a/moveit_setup_assistant/moveit_setup_core_plugins/src/configuration_files_widget.cpp b/moveit_setup_assistant/moveit_setup_core_plugins/src/configuration_files_widget.cpp index 9c76fc1d52..61be0be608 100644 --- a/moveit_setup_assistant/moveit_setup_core_plugins/src/configuration_files_widget.cpp +++ b/moveit_setup_assistant/moveit_setup_core_plugins/src/configuration_files_widget.cpp @@ -294,7 +294,7 @@ void ConfigurationFilesWidget::changeCheckedState(QListWidgetItem* item) } // Enable/disable file - setup_step_.setShouldGenerate(gen_file->getRelativePath(), generate); + setup_step_.setShouldGenerate(gen_file->getRelativePath().string(), generate); } // ****************************************************************************************** @@ -303,7 +303,7 @@ void ConfigurationFilesWidget::changeCheckedState(QListWidgetItem* item) void ConfigurationFilesWidget::focusGiven() { // Pass the package path from start screen to configuration files screen - stack_path_->setPath(setup_step_.getPackagePath()); + stack_path_->setPath(setup_step_.getPackagePath().string()); setup_step_.loadFiles(); @@ -350,7 +350,7 @@ void ConfigurationFilesWidget::showGenFiles() auto gen_file = gen_files[i]; // Create a formatted row - QListWidgetItem* item = new QListWidgetItem(QString(gen_file->getRelativePath().c_str()), action_list_, 0); + QListWidgetItem* item = new QListWidgetItem(QString(gen_file->getRelativePath().string().c_str()), action_list_, 0); // Checkbox item->setCheckState(setup_step_.shouldGenerate(gen_file) ? Qt::Checked : Qt::Unchecked); @@ -478,7 +478,7 @@ bool ConfigurationFilesWidget::generatePackage() // Error occurred QMessageBox::critical(this, "Error Generating File", QString("Failed to generate folder or file: '") - .append(gen_file->getRelativePath().c_str()) + .append(gen_file->getRelativePath().string().c_str()) .append("' at location:\n") .append(absolute_path.c_str())); return false; diff --git a/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen.cpp b/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen.cpp index ff6827d6ff..b0550b1e90 100644 --- a/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen.cpp +++ b/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen.cpp @@ -70,7 +70,7 @@ std::filesystem::path StartScreen::getPackagePath() void StartScreen::loadExisting(const std::filesystem::path& package_path) { - package_settings_->loadExisting(package_path); + package_settings_->loadExisting(package_path.string()); } bool StartScreen::isXacroFile() diff --git a/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen_widget.cpp b/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen_widget.cpp index 70bae9ddc9..50b25ab2e1 100644 --- a/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen_widget.cpp +++ b/moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen_widget.cpp @@ -205,7 +205,7 @@ void StartScreenWidget::focusGiven() std::filesystem::path pkg_path = setup_step_.getPackagePath(); if (!pkg_path.empty()) { - stack_path_->setPath(pkg_path); + stack_path_->setPath(pkg_path.string()); select_mode_->btn_exist_->click(); return; } @@ -213,7 +213,7 @@ void StartScreenWidget::focusGiven() std::filesystem::path urdf_path = setup_step_.getURDFPath(); if (!urdf_path.empty()) { - urdf_file_->setPath(urdf_path); + urdf_file_->setPath(urdf_path.string()); select_mode_->btn_new_->click(); } } @@ -316,7 +316,7 @@ bool StartScreenWidget::loadPackageSettings(bool show_warnings) try { - setup_step_.loadExisting(package_path_input); + setup_step_.loadExisting(package_path_input.string()); return true; } catch (const std::runtime_error& e) diff --git a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/srdf_config.hpp b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/srdf_config.hpp index 4b3fae3440..c6a28092e7 100644 --- a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/srdf_config.hpp +++ b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/srdf_config.hpp @@ -262,7 +262,7 @@ class SRDFConfig : public SetupConfig bool write(const std::filesystem::path& path) { - return srdf_.writeSRDF(path); + return srdf_.writeSRDF(path.string()); } std::filesystem::path getPath() const diff --git a/moveit_setup_assistant/moveit_setup_framework/src/srdf_config.cpp b/moveit_setup_assistant/moveit_setup_framework/src/srdf_config.cpp index 716c12da96..57b1475445 100644 --- a/moveit_setup_assistant/moveit_setup_framework/src/srdf_config.cpp +++ b/moveit_setup_assistant/moveit_setup_framework/src/srdf_config.cpp @@ -88,7 +88,7 @@ void SRDFConfig::loadSRDFFile(const std::filesystem::path& srdf_file_path, const loadURDFModel(); std::string srdf_string; - if (!rdf_loader::RDFLoader::loadXmlFileToString(srdf_string, srdf_path_, xacro_args)) + if (!rdf_loader::RDFLoader::loadXmlFileToString(srdf_string, srdf_path_.string(), xacro_args)) { throw std::runtime_error("SRDF file not found: " + srdf_path_.string()); } diff --git a/moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp b/moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp index 290c9e8a2a..ed42b83281 100644 --- a/moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp +++ b/moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp @@ -116,7 +116,13 @@ void URDFConfig::setPackageName() void URDFConfig::loadFromPackage(const std::filesystem::path& package_name, const std::filesystem::path& relative_path, const std::string& xacro_args) { - urdf_pkg_name_ = package_name; + const std::filesystem::path package_path = getSharePath(package_name.string()); + if (package_path.empty()) + { + throw std::runtime_error("URDF/COLLADA package not found: ''" + package_name.string()); + } + + urdf_pkg_name_ = package_name.string(); urdf_pkg_relative_path_ = relative_path; xacro_args_ = xacro_args; @@ -129,12 +135,12 @@ void URDFConfig::load() RCLCPP_DEBUG_STREAM(*logger_, "URDF Package Name: " << urdf_pkg_name_); RCLCPP_DEBUG_STREAM(*logger_, "URDF Package Path: " << urdf_pkg_relative_path_); - if (!rdf_loader::RDFLoader::loadXmlFileToString(urdf_string_, urdf_path_, xacro_args_vec_)) + if (!rdf_loader::RDFLoader::loadXmlFileToString(urdf_string_, urdf_path_.string(), xacro_args_vec_)) { throw std::runtime_error("URDF/COLLADA file not found: " + urdf_path_.string()); } - if (urdf_string_.empty() && rdf_loader::RDFLoader::isXacroFile(urdf_path_)) + if (urdf_string_.empty() && rdf_loader::RDFLoader::isXacroFile(urdf_path_.string())) { throw std::runtime_error("Running xacro failed.\nPlease check console for errors."); } @@ -144,7 +150,7 @@ void URDFConfig::load() { throw std::runtime_error("URDF/COLLADA file is not a valid robot model."); } - urdf_from_xacro_ = rdf_loader::RDFLoader::isXacroFile(urdf_path_); + urdf_from_xacro_ = rdf_loader::RDFLoader::isXacroFile(urdf_path_.string()); // Set parameter parent_node_->set_parameter(rclcpp::Parameter("robot_description", urdf_string_)); @@ -154,7 +160,7 @@ void URDFConfig::load() bool URDFConfig::isXacroFile() const { - return rdf_loader::RDFLoader::isXacroFile(urdf_path_); + return rdf_loader::RDFLoader::isXacroFile(urdf_path_.string()); } bool URDFConfig::isConfigured() const @@ -172,7 +178,7 @@ void URDFConfig::collectVariables(std::vector& variables) std::string urdf_location; if (urdf_pkg_name_.empty()) { - urdf_location = urdf_path_; + urdf_location = urdf_path_.string(); } else { diff --git a/moveit_setup_assistant/moveit_setup_framework/src/utilities.cpp b/moveit_setup_assistant/moveit_setup_framework/src/utilities.cpp index 51e207f0d8..145f39fda8 100644 --- a/moveit_setup_assistant/moveit_setup_framework/src/utilities.cpp +++ b/moveit_setup_assistant/moveit_setup_framework/src/utilities.cpp @@ -62,7 +62,7 @@ bool extractPackageNameFromPath(const std::filesystem::path& path, std::string& // Default package name to folder name package_name = sub_path.filename().string(); tinyxml2::XMLDocument package_xml_file; - auto is_open = package_xml_file.LoadFile((sub_path / "package.xml").c_str()); + auto is_open = package_xml_file.LoadFile((sub_path / "package.xml").string().c_str()); if (is_open == tinyxml2::XML_SUCCESS) { auto name_potential =