From 22d8573bd04059daf061d237e8bc8c9a27af8224 Mon Sep 17 00:00:00 2001 From: Atsushi Watanabe Date: Tue, 8 Nov 2016 17:21:34 +0900 Subject: [PATCH] Fixes urdfdom_headers version compatibility (#162) Urdf changed their shared ptr type from boost to std. This PR detects which version of urdf is installed and uses the correct ptr type. --- cartographer_ros/CMakeLists.txt | 7 +++++++ cartographer_ros/cartographer_ros/assets_writer_main.cc | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/cartographer_ros/CMakeLists.txt b/cartographer_ros/CMakeLists.txt index 2ede4d2..0a51a0c 100644 --- a/cartographer_ros/CMakeLists.txt +++ b/cartographer_ros/CMakeLists.txt @@ -53,6 +53,13 @@ find_package(PCL REQUIRED COMPONENTS common io) find_package(Eigen3 REQUIRED) find_package(Boost REQUIRED COMPONENTS system iostreams) +find_package(urdfdom_headers REQUIRED) +if(DEFINED urdfdom_headers_VERSION) + if(${urdfdom_headers_VERSION} GREATER 0.4.1) + add_definitions(-DURDFDOM_HEADERS_HAS_SHARED_PTR_DEFS) + endif() +endif() + add_subdirectory("cartographer_ros") install(DIRECTORY launch urdf configuration_files diff --git a/cartographer_ros/cartographer_ros/assets_writer_main.cc b/cartographer_ros/cartographer_ros/assets_writer_main.cc index cc1e251..8edc3cc 100644 --- a/cartographer_ros/cartographer_ros/assets_writer_main.cc +++ b/cartographer_ros/cartographer_ros/assets_writer_main.cc @@ -69,7 +69,11 @@ void ReadStaticTransformsFromUrdf(const string& urdf_filename, ::tf2_ros::Buffer* const buffer) { urdf::Model model; CHECK(model.initFile(urdf_filename)); +#if URDFDOM_HEADERS_HAS_SHARED_PTR_DEFS + std::vector links; +#else std::vector> links; +#endif model.getLinks(links); for (const auto& link : links) { if (!link->getParent() || link->parent_joint->type != urdf::Joint::FIXED) {