Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

urdf: switch from TinyXML to TinyXML2 #205

Closed
wants to merge 1 commit into from

Conversation

rojkov
Copy link

@rojkov rojkov commented Jun 14, 2017

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

depends on ros/urdfdom#99

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

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
@v4hn
Copy link

v4hn commented Jun 14, 2017

tinyxml 1 is horribly obsolete and was always a pain to package for distribution maintainers, so I fully agree that we should finally move to tinyxml2 in ROS.

CI failed to find the tinyxml2 package in this request.

Is there a serious problem with using the old tinyxml in kinetic?
This patch changes public API, so I believe it would be better to target ROS lunar.
(Although personally I wouldn't mind if this would be changed in kinetic).

@sloretz
Copy link
Contributor

sloretz commented Jun 14, 2017

04:59:14 CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
04:59:14   Could NOT find TinyXML2 (missing: TinyXML2_LIBRARY TinyXML2_INCLUDE_DIR)
04:59:14 Call Stack (most recent call first):
04:59:14   /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
04:59:14   /opt/ros/kinetic/share/cmake_modules/cmake/Modules/FindTinyXML2.cmake:65 (find_package_handle_standard_args)
04:59:14   CMakeLists.txt:11 (find_package)

I believe the build failed because tinyxml2 was not added as a dependency in the package.xml

Copy link
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request. The switch to TinyXML2 will have to wait until ROS M because the APIs use TinyXML objects.

I intend to move urdf and urdf_parser_plugin to a new repo. Once I move it and create a ROS M branch, would you be willing to open a pull request there?

/// \brief Load Model from TiXMLElement
bool initXml(TiXmlElement *xml);
/// \brief Load Model from TiXMLDocument
bool initXml(TiXmlDocument *xml);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these constructors in kinetic would break API/ABI compatibility. This change would have to wait until the next Ros release (ROS M).

/// \brief Load Model from XMLElement
bool initXml(tinyxml2::XMLElement *xml);
/// \brief Load Model from XMLDocument
bool initXml(tinyxml2::XMLDocument *xml);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can retarget this pull request to ROS M, I'd be in favor of tinyxml2 not being visible in the APIs at all.

@@ -25,7 +25,7 @@ add_compile_options(-std=c++11)

catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include ${TinyXML_INLCLUDE_DIRS} ${CATKIN_DEVEL_PREFIX}/include
INCLUDE_DIRS include ${TinyXML2_INLCLUDE_DIRS} ${CATKIN_DEVEL_PREFIX}/include
CATKIN_DEPENDS rosconsole_bridge roscpp
DEPENDS urdfdom_headers urdfdom Boost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think TinyXML2 would have to be added to the DEPENDS list.

@@ -25,7 +25,7 @@ add_compile_options(-std=c++11)

catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include ${TinyXML_INLCLUDE_DIRS} ${CATKIN_DEVEL_PREFIX}/include
INCLUDE_DIRS include ${TinyXML2_INLCLUDE_DIRS} ${CATKIN_DEVEL_PREFIX}/include
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather we change the APIs to not expose TinyXML2 so its headers don't need to be exported.

@rojkov
Copy link
Author

rojkov commented Jun 15, 2017

@sloretz Yes, I can resubmit the PR to a new repo. And I agree it's not wise to expose TinyXML in public API especially if the TinyXML values get converted to strings anyway. Are these methods needed at all by the way? Since there's already Model::initString() existing.

If the methods can be dropped there's no need to depend on TinyXML(2).

@sbarthelemy
Copy link

And I agree it's not wise to expose TinyXML in public API

such lower level API were probably meant to enable users to parse URDF extensions. But maybe they shall be supported only in urdf_parser.h

especially if the TinyXML values get converted to strings anyway. Are these methods needed at all by the way? Since there's already Model::initString() existing.

By the way, the API

bool initFile(const std::string& filename);

is quite poor since it won't work on on Windows if the filename contains non-ascii chars.
If tinyxml2 supports it, it would be better practice (more orthogonal design) to have

bool initFromStream(std::istream& is);

And let the user pass a std::ifstream, boost::filesystem::ifstream, std::stringstream or wathever stream fits her need.

bool initString(const std::string& xmlstring);

would be redundant then (but could be maintained),

@sloretz
Copy link
Contributor

sloretz commented Dec 18, 2017

@rojkov The urdf packages have been moved to their own repo as part of #195. Would you mind moving this to https://github.com/ros/urdf?

@rojkov
Copy link
Author

rojkov commented Dec 19, 2017

Resubmitted as ros/urdf#4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants