From 99a2790e5faa32531626c038488df3cc2a1d0b0e Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 16 Oct 2016 20:40:05 -0400 Subject: [PATCH 1/2] Support urdfdom_headers 1.0 for DART 5.1 --- CMakeLists.txt | 2 +- dart/collision/fcl/FCLTypes.h | 1 + dart/common/Deprecated.h | 4 +- dart/config.h.in | 12 ++++++ dart/utils/urdf/DartLoader.cpp | 5 ++- dart/utils/urdf/URDFTypes.h | 58 +++++++++++++++++++++++++++++ dart/utils/urdf/urdf_world_parser.h | 7 +++- 7 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 dart/utils/urdf/URDFTypes.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fe77d995ef03..757a0501f298f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,7 +290,7 @@ if(NOT BUILD_CORE_ONLY) # urdfdom find_package(urdfdom QUIET) if(urdfdom_FOUND) - message(STATUS "Looking for urdfdom - found") + message(STATUS "Looking for urdfdom - ${urdfdom_headers_VERSION} found") else() message(SEND_ERROR "Looking for urdfdom - NOT found, please install liburdfdom-dev") endif() diff --git a/dart/collision/fcl/FCLTypes.h b/dart/collision/fcl/FCLTypes.h index 08ccddbc1b18d..159e605afa602 100644 --- a/dart/collision/fcl/FCLTypes.h +++ b/dart/collision/fcl/FCLTypes.h @@ -52,6 +52,7 @@ (FCL_MINOR_VERSION < y || (FCL_MINOR_VERSION <= y)))) #if FCL_VERSION_AT_LEAST(0,5,0) +#include template using fcl_shared_ptr = std::shared_ptr; template using fcl_weak_ptr = std::weak_ptr; #else diff --git a/dart/common/Deprecated.h b/dart/common/Deprecated.h index 263103485b6d2..dc48ddfd5dc64 100644 --- a/dart/common/Deprecated.h +++ b/dart/common/Deprecated.h @@ -34,11 +34,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/config.h" - #ifndef DART_COMMON_DEPRECATED_H_ #define DART_COMMON_DEPRECATED_H_ +#include "dart/config.h" + //============================================================================== // Deprecated is used for backward compatibility between different minor // versions of DART. Every deprecated function should be removed for every major diff --git a/dart/config.h.in b/dart/config.h.in index df6b5d0e21721..c01e580f2c570 100644 --- a/dart/config.h.in +++ b/dart/config.h.in @@ -28,6 +28,18 @@ (DART_MAJOR_VERSION < x || (DART_MAJOR_VERSION <= x && \ (DART_MINOR_VERSION < y || (DART_MINOR_VERSION <= y)))) +/* urdfdom_headers Version number */ +// We define the version numbers of urdfdom_headers here since it doesn't expose +// the version numbers itself in source level. +#define URDFDOM_HEADERS_MAJOR_VERSION @urdfdom_headers_VERSION_MAJOR@ +#define URDFDOM_HEADERS_MINOR_VERSION @urdfdom_headers_VERSION_MINOR@ +#define URDFDOM_HEADERS_PATCH_VERSION @urdfdom_headers_VERSION_PATCH@ + +#define URDFDOM_HEADERS_VERSION_AT_LEAST(x,y,z) \ + (URDFDOM_HEADERS_MAJOR_VERSION > x || (URDFDOM_HEADERS_MAJOR_VERSION >= x && \ + (URDFDOM_HEADERS_MINOR_VERSION > y || (URDFDOM_HEADERS_MINOR_VERSION >= y && \ + URDFDOM_HEADERS_PATCH_VERSION >= z)))) + // Detect the compiler #if defined(__clang__) #define DART_COMPILER_CLANG diff --git a/dart/utils/urdf/DartLoader.cpp b/dart/utils/urdf/DartLoader.cpp index 1bb1ee9b40f99..8226eb6f513d1 100644 --- a/dart/utils/urdf/DartLoader.cpp +++ b/dart/utils/urdf/DartLoader.cpp @@ -21,13 +21,14 @@ #include "dart/dynamics/CylinderShape.h" #include "dart/dynamics/MeshShape.h" #include "dart/simulation/World.h" +#include "dart/utils/urdf/URDFTypes.h" #include "dart/utils/urdf/urdf_world_parser.h" -using ModelInterfacePtr = boost::shared_ptr; - namespace dart { namespace utils { +using ModelInterfacePtr = urdf_shared_ptr; + DartLoader::DartLoader() : mLocalRetriever(new common::LocalResourceRetriever), mPackageRetriever(new utils::PackageResourceRetriever(mLocalRetriever)), diff --git a/dart/utils/urdf/URDFTypes.h b/dart/utils/urdf/URDFTypes.h new file mode 100644 index 0000000000000..7c86a316b8ed7 --- /dev/null +++ b/dart/utils/urdf/URDFTypes.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_UTILS_URDF_URDFTYPES_H_ +#define DART_UTILS_URDF_URDFTYPES_H_ + +#include "dart/config.h" + +#if URDFDOM_HEADERS_VERSION_AT_LEAST(1,0,0) +#include +#else +#include "boost/shared_ptr.hpp" +#include "boost/weak_ptr.hpp" +#endif + +namespace dart { +namespace utils { + +#if URDFDOM_HEADERS_VERSION_AT_LEAST(1,0,0) +template using urdf_shared_ptr = std::shared_ptr; +template using urdf_weak_ptr = std::weak_ptr; +#else +template using urdf_shared_ptr = boost::shared_ptr; +template using urdf_weak_ptr = boost::weak_ptr; +#endif + +} // namespace utils +} // namespace dart + +#endif // DART_UTILS_URDF_URDFTYPES_H_ diff --git a/dart/utils/urdf/urdf_world_parser.h b/dart/utils/urdf/urdf_world_parser.h index d16c100e5f170..ad0ef839047b1 100644 --- a/dart/utils/urdf/urdf_world_parser.h +++ b/dart/utils/urdf/urdf_world_parser.h @@ -47,6 +47,11 @@ #include #include #include +#include + +#include "dart/common/Uri.h" +#include "dart/common/ResourceRetriever.h" +#include "dart/utils/urdf/URDFTypes.h" namespace dart { namespace utils { @@ -63,7 +68,7 @@ class Entity /// Copy over a standard urdfEntity Entity(const urdf::Entity& urdfEntity); - boost::shared_ptr model; + urdf_shared_ptr model; urdf::Pose origin; urdf::Twist twist; From 74bef16e6d0e02c16f9a1a6fcf07fe4aec2f5c14 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 16 Oct 2016 20:45:45 -0400 Subject: [PATCH 2/2] Update changelog, and bump version to 5.1.5 --- CMakeLists.txt | 2 +- Changelog.md | 5 +++++ package.xml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 757a0501f298f..90748a625e70e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ project(dart) set(DART_MAJOR_VERSION "5") set(DART_MINOR_VERSION "1") -set(DART_PATCH_VERSION "4") +set(DART_PATCH_VERSION "5") set(DART_VERSION "${DART_MAJOR_VERSION}.${DART_MINOR_VERSION}.${DART_PATCH_VERSION}") set(DART_PKG_DESC "Dynamic Animation and Robotics Toolkit.") set(DART_PKG_EXTERNAL_DEPS "flann, ccd, fcl") diff --git a/Changelog.md b/Changelog.md index f48b9605653ba..a5685c2b70f87 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +### Version 5.1.5 (201X-XX-XX) + +1. Added support of urdfdom_headers 1.0 for DART 5.1 (backport of [#766](https://github.com/dartsim/dart/pull/766)) + * [Pull request #799](https://github.com/dartsim/dart/pull/799) + ### Version 5.1.4 (2016-10-14) 1. Fixed inconsistent frame rate of GlutWindow diff --git a/package.xml b/package.xml index 310034a81f33a..e4b922898ac91 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ a Catkin workspace. Catkin is not required to build DART. For more information, see: http://ros.org/reps/rep-0136.html --> dart - 5.1.4 + 5.1.5 DART (Dynamic Animation and Robotics Toolkit) is a collaborative, cross-platform, open source library created by the Georgia Tech Graphics