Skip to content

Commit

Permalink
meta-refkit-industrial: switch ROS to TinyXML2
Browse files Browse the repository at this point in the history
since it's maintained better than deprecated TinyXML.

The patch set is not going to be merged to the upstream ROS
layer because only ROS Indigo release is maintained in the layer
currently.

In ros/rospack#62 it was suggested that
the packages in the ROS Indigo release are not going to switch
to TinyXML2, but it may happen in future releases.
Also a comment in ros/urdfdom_headers#35
suggests that the switch is precluded by the fact TinyXML types
are widely used in urdfdom's public API thus requires fixing all
downstream packages which can be difficult if possible at all.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
  • Loading branch information
Dmitry Rozhkov committed Jun 14, 2017
1 parent 8a407c7 commit 3fbd7af
Show file tree
Hide file tree
Showing 19 changed files with 3,028 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From d0771d1bd974abc8b3f793b63a360c4d21bcc1b7 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Date: Fri, 3 Jun 2016 14:29:45 +0300
Subject: [PATCH] Add FindTinyXML2 module

Upstream-Status: Accepted [available since v0.4.1]

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
---
cmake/Modules/FindTinyXML2.cmake | 74 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
create mode 100644 cmake/Modules/FindTinyXML2.cmake

diff --git a/cmake/Modules/FindTinyXML2.cmake b/cmake/Modules/FindTinyXML2.cmake
new file mode 100644
index 0000000..87ff2fb
--- /dev/null
+++ b/cmake/Modules/FindTinyXML2.cmake
@@ -0,0 +1,74 @@
+##################################################################################################
+#
+# CMake script for finding TinyXML2.
+#
+# Input variables:
+#
+# - TinyXML2_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
+# ${TinyXML2_ROOT_DIR}/include
+# ${TinyXML2_ROOT_DIR}/libs
+# respectively, and the default CMake search order will be ignored. When unspecified, the default
+# CMake search order is used.
+# This variable can be specified either as a CMake or environment variable. If both are set,
+# preference is given to the CMake variable.
+# Use this variable for finding packages installed in a nonstandard location, or for enforcing
+# that one of multiple package installations is picked up.
+#
+#
+# Cache variables (not intended to be used in CMakeLists.txt files)
+#
+# - TinyXML2_INCLUDE_DIR: Absolute path to package headers.
+# - TinyXML2_LIBRARY: Absolute path to library.
+#
+#
+# Output variables:
+#
+# - TinyXML2_FOUND: Boolean that indicates if the package was found
+# - TinyXML2_INCLUDE_DIRS: Paths to the necessary header files
+# - TinyXML2_LIBRARIES: Package libraries
+#
+#
+# Example usage:
+#
+# find_package(TinyXML2)
+# if(NOT TinyXML2_FOUND)
+# # Error handling
+# endif()
+# ...
+# include_directories(${TinyXML2_INCLUDE_DIRS} ...)
+# ...
+# target_link_libraries(my_target ${TinyXML2_LIBRARIES})
+#
+##################################################################################################
+
+# Get package location hint from environment variable (if any)
+if(NOT TinyXML2_ROOT_DIR AND DEFINED ENV{TinyXML2_ROOT_DIR})
+ set(TinyXML2_ROOT_DIR "$ENV{TinyXML2_ROOT_DIR}" CACHE PATH
+ "TinyXML2 base directory location (optional, used for nonstandard installation paths)")
+endif()
+
+# Search path for nonstandard package locations
+if(TinyXML2_ROOT_DIR)
+ set(TinyXML2_INCLUDE_PATH PATHS "${TinyXML2_ROOT_DIR}/include" NO_DEFAULT_PATH)
+ set(TinyXML2_LIBRARY_PATH PATHS "${TinyXML2_ROOT_DIR}/lib" NO_DEFAULT_PATH)
+endif()
+
+# Find headers and libraries
+find_path(TinyXML2_INCLUDE_DIR NAMES tinyxml2.h PATH_SUFFIXES "tinyxml2" ${TinyXML2_INCLUDE_PATH})
+find_library(TinyXML2_LIBRARY NAMES tinyxml2 PATH_SUFFIXES "tinyxml2" ${TinyXML2_LIBRARY_PATH})
+
+mark_as_advanced(TinyXML2_INCLUDE_DIR
+ TinyXML2_LIBRARY)
+
+# Output variables generation
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TinyXML2_LIBRARY
+ TinyXML2_INCLUDE_DIR)
+
+set(TinyXML2_FOUND ${TINYXML2_FOUND}) # Enforce case-correctness: Set appropriately cased variable...
+unset(TINYXML2_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args
+
+if(TinyXML2_FOUND)
+ set(TinyXML2_INCLUDE_DIRS ${TinyXML2_INCLUDE_DIR})
+ set(TinyXML2_LIBRARIES ${TinyXML2_LIBRARY})
+endif()
--
2.7.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI_append_refkit-industrial = "\
file://0001-Add-FindTinyXML2-module.patch \
"

Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
From 25484577d6a7ad0266fe50415d3b123ef19783e8 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Date: Tue, 14 Mar 2017 15:57:18 +0200
Subject: [PATCH] Switch from TinyXML to TinyXML2

The library TinyXML is considered to be unmaintained and
since all future development is focused on TinyXML2 this
patch updates kdl_parser to use TinyXML2.

Upstream-Status: Submitted [https://github.com/ros/kdl_parser/pull/2]

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
---
CMakeLists.txt | 8 ++++----
include/kdl_parser/kdl_parser.hpp | 8 ++++----
src/kdl_parser.cpp | 9 +++++----
3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c96e55..1acad20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,9 +10,9 @@ find_package(catkin REQUIRED
)
find_package(orocos_kdl REQUIRED)
find_package(Eigen3 REQUIRED)
-find_package(TinyXML REQUIRED)
+find_package(TinyXML2 REQUIRED)

-include_directories(include ${EIGEN3_INCLUDE_DIR} ${orocos_kdl_INCLUDE_DIRS} ${TinyXML_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
+include_directories(include ${EIGEN3_INCLUDE_DIR} ${orocos_kdl_INCLUDE_DIRS} ${TinyXML2_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})

link_directories(${catkin_LIBRARY_DIRS})
link_directories(${orocos_kdl_LIBRARY_DIRS})
@@ -24,12 +24,12 @@ catkin_package(
LIBRARIES ${PROJECT_NAME} ${KDL_LIBRARY}
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp rosconsole urdf
- DEPENDS orocos_kdl TinyXML
+ DEPENDS orocos_kdl TinyXML2
)

add_library(${PROJECT_NAME} src/kdl_parser.cpp)
target_link_libraries(${PROJECT_NAME}
- ${TinyXML_LIBRARIES} ${orocos_kdl_LIBRARIES} ${catkin_LIBRARIES}
+ ${TinyXML2_LIBRARIES} ${orocos_kdl_LIBRARIES} ${catkin_LIBRARIES}
)

add_executable(check_kdl_parser src/check_kdl_parser.cpp )
diff --git a/include/kdl_parser/kdl_parser.hpp b/include/kdl_parser/kdl_parser.hpp
index 68a6456..3dd89d3 100644
--- a/include/kdl_parser/kdl_parser.hpp
+++ b/include/kdl_parser/kdl_parser.hpp
@@ -40,7 +40,7 @@
#include <kdl/tree.hpp>
#include <string>
#include <urdf_model/model.h>
-#include <tinyxml.h>
+#include <tinyxml2.h>

namespace kdl_parser{

@@ -65,12 +65,12 @@ bool treeFromParam(const std::string& param, KDL::Tree& tree);
*/
bool treeFromString(const std::string& xml, KDL::Tree& tree);

-/** Constructs a KDL tree from a TiXmlDocument
- * \param xml_doc The TiXmlDocument containting the xml description of the robot
+/** Constructs a KDL tree from a XMLDocument
+ * \param xml_doc The XMLDocument containting the xml description of the robot
* \param tree The resulting KDL Tree
* returns true on success, false on failure
*/
-bool treeFromXml(TiXmlDocument *xml_doc, KDL::Tree& tree);
+bool treeFromXml(tinyxml2::XMLDocument *xml_doc, KDL::Tree& tree);

/** Constructs a KDL tree from a URDF robot model
* \param robot_model The URDF robot model
diff --git a/src/kdl_parser.cpp b/src/kdl_parser.cpp
index 7031247..07c02e5 100644
--- a/src/kdl_parser.cpp
+++ b/src/kdl_parser.cpp
@@ -41,6 +41,7 @@

using namespace std;
using namespace KDL;
+using namespace tinyxml2;

namespace kdl_parser{

@@ -154,8 +155,8 @@ bool addChildrenToTree(boost::shared_ptr<const urdf::Link> root, Tree& tree)

bool treeFromFile(const string& file, Tree& tree)
{
- TiXmlDocument urdf_xml;
- urdf_xml.LoadFile(file);
+ XMLDocument urdf_xml;
+ urdf_xml.LoadFile(file.c_str());
return treeFromXml(&urdf_xml, tree);
}

@@ -171,12 +172,12 @@ bool treeFromParam(const string& param, Tree& tree)

bool treeFromString(const string& xml, Tree& tree)
{
- TiXmlDocument urdf_xml;
+ XMLDocument urdf_xml;
urdf_xml.Parse(xml.c_str());
return treeFromXml(&urdf_xml, tree);
}

-bool treeFromXml(TiXmlDocument *xml_doc, Tree& tree)
+bool treeFromXml(XMLDocument *xml_doc, Tree& tree)
{
urdf::Model robot_model;
if (!robot_model.initXml(xml_doc)){
--
2.7.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI_append_refkit-industrial = "\
file://0001-Switch-from-TinyXML-to-TinyXML2.patch \
"
DEPENDS_remove_refkit-industrial = "libtinyxml"
DEPENDS_append_refkit-industrial = " libtinyxml2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
From 2795d7515acfbd23723429ee5b611de88404d324 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Date: Wed, 25 Jan 2017 11:06:58 +0200
Subject: [PATCH 2/2] moveit_ros/planning: Use TinyXML2 instead of TinyXML

The library TinyXML is considered to be unmaintained and
since all future development is focused on TinyXML2 this
patch updates moveit_ros_planning to use TinyXML2.

Upstream-Status: Submitted [https://github.com/ros-planning/moveit/pull/527]

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
---
rdf_loader/include/moveit/rdf_loader/rdf_loader.h | 4 ++--
rdf_loader/src/rdf_loader.cpp | 4 +++-
.../include/moveit/robot_model_loader/robot_model_loader.h | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/rdf_loader/include/moveit/rdf_loader/rdf_loader.h b/rdf_loader/include/moveit/rdf_loader/rdf_loader.h
index a313e1b..0999963 100644
--- a/rdf_loader/include/moveit/rdf_loader/rdf_loader.h
+++ b/rdf_loader/include/moveit/rdf_loader/rdf_loader.h
@@ -41,7 +41,7 @@
#include <urdf/model.h>
#include <srdfdom/model.h>
#include <boost/shared_ptr.hpp>
-#include <tinyxml.h>
+#include <tinyxml2.h>

namespace rdf_loader
{
@@ -62,7 +62,7 @@ public:
RDFLoader(const std::string& urdf_string, const std::string& srdf_string);

/** \brief Initialize the robot model from a parsed XML representation of the URDF and SRDF */
- RDFLoader(TiXmlDocument* urdf_doc, TiXmlDocument* srdf_doc);
+ RDFLoader(tinyxml2::XMLDocument* urdf_doc, tinyxml2::XMLDocument* srdf_doc);

/** @brief Get the resolved parameter name for the robot description */
const std::string& getRobotDescription() const
diff --git a/rdf_loader/src/rdf_loader.cpp b/rdf_loader/src/rdf_loader.cpp
index a814124..0185714 100644
--- a/rdf_loader/src/rdf_loader.cpp
+++ b/rdf_loader/src/rdf_loader.cpp
@@ -38,6 +38,8 @@
#include <moveit/profiler/profiler.h>
#include <ros/ros.h>

+using namespace tinyxml2;
+
rdf_loader::RDFLoader::RDFLoader(const std::string& robot_description)
{
moveit::tools::Profiler::ScopedStart prof_start;
@@ -104,7 +106,7 @@ rdf_loader::RDFLoader::RDFLoader(const std::string& urdf_string, const std::stri
}
}

-rdf_loader::RDFLoader::RDFLoader(TiXmlDocument* urdf_doc, TiXmlDocument* srdf_doc)
+rdf_loader::RDFLoader::RDFLoader(XMLDocument* urdf_doc, XMLDocument* srdf_doc)
{
moveit::tools::Profiler::ScopedStart prof_start;
moveit::tools::Profiler::ScopedBlock prof_block("RDFLoader(XML)");
diff --git a/robot_model_loader/include/moveit/robot_model_loader/robot_model_loader.h b/robot_model_loader/include/moveit/robot_model_loader/robot_model_loader.h
index 988ea73..7c88c0a 100644
--- a/robot_model_loader/include/moveit/robot_model_loader/robot_model_loader.h
+++ b/robot_model_loader/include/moveit/robot_model_loader/robot_model_loader.h
@@ -67,7 +67,7 @@ public:
{
}

- Options(TiXmlDocument* urdf_doc, TiXmlDocument* srdf_doc)
+ Options(tinyxml2::XMLDocument* urdf_doc, tinyxml2::XMLDocument* srdf_doc)
: urdf_doc_(urdf_doc), srdf_doc_(srdf_doc), load_kinematics_solvers_(true)
{
}
@@ -82,7 +82,7 @@ public:
std::string urdf_string_, srdf_string_;

/** @brief The parsed XML content of the URDF and SRDF documents. */
- TiXmlDocument *urdf_doc_, *srdf_doc_;
+ tinyxml2::XMLDocument *urdf_doc_, *srdf_doc_;

/** @brief Flag indicating whether the kinematics solvers should be loaded as well, using specified ROS parameters
*/
--
2.7.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI_append_refkit-industrial = "\
file://0002-moveit_ros-planning-Use-TinyXML2-instead-of-TinyXML.patch \
"
DEPENDS_remove_refkit-industrial = "libtinyxml"
DEPENDS_append_refkit-industrial = " libtinyxml2"
Loading

0 comments on commit 3fbd7af

Please sign in to comment.