Skip to content

Commit

Permalink
Octomap <1.8.0 compatible but not working
Browse files Browse the repository at this point in the history
  • Loading branch information
jvgomez committed Jun 16, 2016
1 parent dd77968 commit 3558c1e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ if(NOT OCTOMAP_FOUND)
endif()
endif()
if (OCTOMAP_FOUND OR (OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS))
string(REPLACE "." ";" VERSION_LIST ${OCTOMAP_VERSION})
list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
include_directories(${OCTOMAP_INCLUDE_DIRS})
link_directories(${OCTOMAP_LIBRARY_DIRS})
set(FCL_HAVE_OCTOMAP 1)
Expand Down
16 changes: 16 additions & 0 deletions include/fcl/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,20 @@
#cmakedefine01 FCL_BUILD_TYPE_DEBUG
#cmakedefine01 FCL_BUILD_TYPE_RELEASE

#if FCL_HAVE_OCTOMAP
#define OCTOMAP_MAJOR_VERSION @OCTOMAP_MAJOR_VERSION@
#define OCTOMAP_MINOR_VERSION @OCTOMAP_MINOR_VERSION@
#define OCTOMAP_PATCH_VERSION @OCTOMAP_PATCH_VERSION@

#define OCTOMAP_VERSION_AT_LEAST(x,y,z) \
(OCTOMAP_MAJOR_VERSION > x || (OCTOMAP_MAJOR_VERSION >= x && \
(OCTOMAP_MINOR_VERSION > y || (OCTOMAP_MINOR_VERSION >= y && \
OCTOMAP_PATCH_VERSION >= z))))

#define OCTOMAP_VERSION_AT_MOST(x,y,z) \
(OCTOMAP_MAJOR_VERSION < x || (OCTOMAP_MAJOR_VERSION <= x && \
(OCTOMAP_MINOR_VERSION < y || (OCTOMAP_MINOR_VERSION <= y && \
OCTOMAP_PATCH_VERSION <= z))))
#endif // FCL_HAVE_OCTOMAP

#endif
16 changes: 16 additions & 0 deletions include/fcl/octree.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,41 @@ class OcTree : public CollisionGeometry
/// @return ptr to child number childIdx of node
OcTreeNode* getNodeChild(OcTreeNode* node, unsigned int childIdx)
{
#if OCTOMAP_VERSION_AT_LEAST(1,8,0)
return tree->getNodeChild(node, childIdx);
#else
return node->getChild(childIdx);
#endif
}

/// @return const ptr to child number childIdx of node
const OcTreeNode* getNodeChild(const OcTreeNode* node, unsigned int childIdx) const
{
#if OCTOMAP_VERSION_AT_LEAST(1,8,0)
return tree->getNodeChild(node, childIdx);
#else
return node->getChild(childIdx);
#endif
}

/// @brief return true if the child at childIdx exists
bool nodeChildExists(const OcTreeNode* node, unsigned int childIdx) const
{
#if OCTOMAP_VERSION_AT_LEAST(1,8,0)
return tree->nodeChildExists(node, childIdx);
#else
return node->childExists(childIdx);
#endif
}

/// @brief return true if node has at least one child
bool nodeHasChildren(const OcTreeNode* node) const
{
#if OCTOMAP_VERSION_AT_LEAST(1,8,0)
return tree->nodeHasChildren(node);
#else
return node->hasChildren();
#endif
}

/// @brief return object type, it is an octree
Expand Down

0 comments on commit 3558c1e

Please sign in to comment.