From ddfd1c67630f551292a72635e6a78db65e5616da Mon Sep 17 00:00:00 2001 From: "David V. Lu!!" Date: Mon, 16 May 2022 11:56:16 -0400 Subject: [PATCH] [MSA] Merge main into feature/msa (Part III) (#1249) --- .../moveit_setup_app_plugins/CMakeLists.txt | 1 + .../moveit_setup_app_plugins/src/simulation_widget.cpp | 4 ++-- .../moveit_setup_framework/CMakeLists.txt | 1 + .../data/package_settings_config.hpp | 2 +- .../moveit_setup_framework/data/urdf_config.hpp | 10 ++++++++++ .../qt/xml_syntax_highlighter.hpp | 4 ++++ .../src/xml_syntax_highlighter.cpp | 6 +++++- .../moveit_setup_simulation/xml_manipulation.hpp | 8 ++++++-- .../moveit_setup_simulation/src/xml_manipulation.cpp | 6 +++--- .../moveit_setup_srdf_plugins/default_collisions.hpp | 3 ++- 10 files changed, 35 insertions(+), 10 deletions(-) diff --git a/moveit_setup_assistant/moveit_setup_app_plugins/CMakeLists.txt b/moveit_setup_assistant/moveit_setup_app_plugins/CMakeLists.txt index bd7b6dbc2e..baa7b8ddd4 100644 --- a/moveit_setup_assistant/moveit_setup_app_plugins/CMakeLists.txt +++ b/moveit_setup_assistant/moveit_setup_app_plugins/CMakeLists.txt @@ -29,6 +29,7 @@ add_library(${PROJECT_NAME} src/perception_config.cpp src/perception.cpp src/perception_widget.cpp + src/xml_manipulation.cpp ${MOC_FILES} ) target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/moveit_setup_assistant/moveit_setup_app_plugins/src/simulation_widget.cpp b/moveit_setup_assistant/moveit_setup_app_plugins/src/simulation_widget.cpp index 95fa4c3957..6c8989bc2c 100644 --- a/moveit_setup_assistant/moveit_setup_app_plugins/src/simulation_widget.cpp +++ b/moveit_setup_assistant/moveit_setup_app_plugins/src/simulation_widget.cpp @@ -36,8 +36,8 @@ // SA #include "simulation_widget.h" #include "header_widget.h" -#include "../tools/xml_syntax_highlighter.h" -#include +#include +#include // Qt #include diff --git a/moveit_setup_assistant/moveit_setup_framework/CMakeLists.txt b/moveit_setup_assistant/moveit_setup_framework/CMakeLists.txt index c7503616b4..1e876e2bc5 100644 --- a/moveit_setup_assistant/moveit_setup_framework/CMakeLists.txt +++ b/moveit_setup_assistant/moveit_setup_framework/CMakeLists.txt @@ -38,6 +38,7 @@ add_library(${PROJECT_NAME} src/rviz_panel.cpp src/data_warehouse.cpp src/templates.cpp + src/xml_syntax_highlighter.cpp ${MOC_FILES} ) target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/package_settings_config.hpp b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/package_settings_config.hpp index f51254e384..2153a1eb3b 100644 --- a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/package_settings_config.hpp +++ b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/package_settings_config.hpp @@ -39,7 +39,7 @@ namespace moveit_setup_framework { -const std::string SETUP_ASSISTANT_FILE = ".setup_assistant"; +static const std::string SETUP_ASSISTANT_FILE = ".setup_assistant"; class PackageSettingsConfig : public SetupConfig { diff --git a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/urdf_config.hpp b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/urdf_config.hpp index cfcb234871..6ba18129fc 100644 --- a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/urdf_config.hpp +++ b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/urdf_config.hpp @@ -68,6 +68,16 @@ class URDFConfig : public SetupConfig return urdf_model_; } + std::string getURDFPackageName() const + { + return urdf_pkg_name_; + } + + std::string getURDFContents() const + { + return urdf_string_; + } + std::string getURDFPath() const { return urdf_path_; diff --git a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/qt/xml_syntax_highlighter.hpp b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/qt/xml_syntax_highlighter.hpp index cd48b70238..48149e15a5 100644 --- a/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/qt/xml_syntax_highlighter.hpp +++ b/moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/qt/xml_syntax_highlighter.hpp @@ -40,6 +40,8 @@ #include #include +namespace moveit_setup_framework +{ /** XML SyntaxHighlighter allowing nested highlighting of XML tags */ class XmlSyntaxHighlighter : public QSyntaxHighlighter { @@ -63,3 +65,5 @@ class XmlSyntaxHighlighter : public QSyntaxHighlighter Rules::const_iterator highlight(Rules::const_iterator active, QStringRef text, int start, bool search_end, int& end); }; + +} // namespace moveit_setup_framework diff --git a/moveit_setup_assistant/moveit_setup_framework/src/xml_syntax_highlighter.cpp b/moveit_setup_assistant/moveit_setup_framework/src/xml_syntax_highlighter.cpp index 60703f8da8..a9adc7f300 100644 --- a/moveit_setup_assistant/moveit_setup_framework/src/xml_syntax_highlighter.cpp +++ b/moveit_setup_assistant/moveit_setup_framework/src/xml_syntax_highlighter.cpp @@ -34,9 +34,11 @@ /* Author: Robert Haschke */ -#include "xml_syntax_highlighter.h" +#include #include +namespace moveit_setup_framework +{ XmlSyntaxHighlighter::XmlSyntaxHighlighter(QTextDocument* parent) : QSyntaxHighlighter(parent) { } @@ -122,3 +124,5 @@ void XmlSyntaxHighlighter::highlightBlock(const QString& text) active = highlight(active, QStringRef(&text, 0, text.size()), 0, active != rules.cend(), unused); setCurrentBlockState(active != rules.cend() ? active->first : -1); } + +} // namespace moveit_setup_framework diff --git a/moveit_setup_assistant/moveit_setup_simulation/include/moveit_setup_simulation/xml_manipulation.hpp b/moveit_setup_assistant/moveit_setup_simulation/include/moveit_setup_simulation/xml_manipulation.hpp index 05017f502f..f198865903 100644 --- a/moveit_setup_assistant/moveit_setup_simulation/include/moveit_setup_simulation/xml_manipulation.hpp +++ b/moveit_setup_assistant/moveit_setup_simulation/include/moveit_setup_simulation/xml_manipulation.hpp @@ -35,10 +35,14 @@ /* Author: Robert Haschke */ #pragma once + +// TODO: This header uses tinyxml.h whereas moveit_setup_framework/utilities.hpp uses tinyxml2.h +// One xml library should be selected and used throughout moveit_setup_assistant + #include #include -namespace moveit_setup_assistant +namespace moveit_setup_app_plugins { struct Attribute { @@ -56,4 +60,4 @@ struct Attribute TiXmlElement* uniqueInsert(TiXmlElement& element, const char* tag, const std::vector& attributes = {}, const char* text = nullptr); -} // namespace moveit_setup_assistant +} // namespace moveit_setup_app_plugins diff --git a/moveit_setup_assistant/moveit_setup_simulation/src/xml_manipulation.cpp b/moveit_setup_assistant/moveit_setup_simulation/src/xml_manipulation.cpp index 55093ff9c7..dad27a8925 100644 --- a/moveit_setup_assistant/moveit_setup_simulation/src/xml_manipulation.cpp +++ b/moveit_setup_assistant/moveit_setup_simulation/src/xml_manipulation.cpp @@ -34,9 +34,9 @@ /* Author: Robert Haschke */ -#include +#include -namespace moveit_setup_assistant +namespace moveit_setup_app_plugins { namespace { @@ -81,4 +81,4 @@ TiXmlElement* uniqueInsert(TiXmlElement& element, const char* tag, const std::ve return result; } -} // namespace moveit_setup_assistant +} // namespace moveit_setup_app_plugins diff --git a/moveit_setup_assistant/moveit_setup_srdf_plugins/include/moveit_setup_srdf_plugins/default_collisions.hpp b/moveit_setup_assistant/moveit_setup_srdf_plugins/include/moveit_setup_srdf_plugins/default_collisions.hpp index 50d6402113..f618dd76e9 100644 --- a/moveit_setup_assistant/moveit_setup_srdf_plugins/include/moveit_setup_srdf_plugins/default_collisions.hpp +++ b/moveit_setup_assistant/moveit_setup_srdf_plugins/include/moveit_setup_srdf_plugins/default_collisions.hpp @@ -44,7 +44,8 @@ struct CollisionPairLess { bool operator()(const srdf::Model::CollisionPair& left, const srdf::Model::CollisionPair& right) const { - return left.link1_ < right.link1_ && left.link2_ < right.link2_; + // use std::pair's operator<: (left.link1_, left.link2_) < (right.link1_, right.link2_) + return left.link1_ < right.link1_ || (!(right.link1_ < left.link1_) && left.link2_ < right.link2_); } };