Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added FCL to build and added FCLModel #1890

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ if (WIN32)
else()
option(WITH_DIRECTOR "vtk-based visualization tool and robot user interface" ON) # not win32 yet. it builds on windows, but requires manually installation of vtk, etc. perhaps make a precompiled director pod (a bit like snopt)
option(WITH_LIBBOT "simple open-gl visualizer + lcmgl for director" ON) # there is hope, but i spent a long time cleaning up c/c++ language errors trying to make msvc happy.. and still had a long way to go.
option(WITH_LIBCCD "Required for FCL" OFF)
option(WITH_FLANN "Required for FCL" OFF)
option(WITH_FCL "Fast Collision Library" OFF)
option(WITH_SWIG_MATLAB "A version of SWIG with MATLAB support" ON)
endif()
find_program(matlab matlab)
Expand Down Expand Up @@ -90,7 +93,8 @@ set(bot_core_lcmtypes_dependencies lcm)
set(director_dependencies lcm bot_core_lcmtypes libbot)
set(iris_dependencies eigen mosek)
set(signalscope_dependencies director)
set(drake_dependencies cmake eigen googletest lcm bot_core_lcmtypes libbot bullet octomap snopt gurobi swig_matlab swigmake)
set(drake_dependencies cmake eigen googletest lcm bot_core_lcmtypes libbot bullet libccd flann fcl octomap snopt gurobi swig_matlab swigmake)
set(fcl_dependancies flann libccd)
Copy link
Contributor

Choose a reason for hiding this comment

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

dependencies is misspelled here; as a result, the fcl dependencies are effectively not set

Copy link
Member

Choose a reason for hiding this comment

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

BTW the upstream fcl master branch doesn't depend on flann any more.


# download information, in alphabetical order
set(avl_GIT_REPOSITORY https://github.com/RobotLocomotion/avl.git)
Expand All @@ -103,6 +107,20 @@ set(bullet_GIT_REPOSITORY https://github.com/RobotLocomotion/bullet-pod.git)
set(bullet_GIT_TAG 54d0751b50f86481549391961b209f06ac5035f9)
set(bullet_IS_PUBLIC TRUE)
set(bullet_IS_CMAKE_POD TRUE)
set(libccd_GIT_REPOSITORY https://github.com/danfis/libccd.git)
set(libccd_GIT_TAG v2.0)
set(libccd_IS_PUBLIC TRUE)
set(libccd_IS_CMAKE_POD TRUE)
set(flann_GIT_REPOSITORY https://github.com/mariusmuja/flann.git)
set(flann_GIT_TAG 1.8.1-src)
set(flann_IS_PUBLIC TRUE)
set(flann_IS_CMAKE_POD TRUE)
set(fcl_GIT_REPOSITORY https://github.com/flexible-collision-library/fcl.git)
set(fcl_GIT_TAG ea10bbaa93965a35880830131ddd8767fd2cc7b0)
#set(fcl_GIT_TAG 0.5.0)
set(fcl_IS_PUBLIC TRUE)
set(fcl_IS_CMAKE_POD TRUE)

set(cmake_GIT_REPOSITORY https://github.com/RobotLocomotion/cmake.git)
set(cmake_GIT_TAG 54f5a4c0734015695334970ecedac79e12c3116f)
set(cmake_GIT_CLONE_DIR "${PROJECT_SOURCE_DIR}/drake/cmake")
Expand Down Expand Up @@ -226,6 +244,9 @@ foreach(proj IN ITEMS
bot_core_lcmtypes
libbot
bullet
libccd
flann
fcl
spotless
director
signalscope
Expand Down
9 changes: 0 additions & 9 deletions drake/systems/plants/collision/BulletResultCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ using namespace std;
using namespace Eigen;

namespace DrakeCollision {
Vector3d toVector3d(const Vector3d& vec) { return vec; };

Vector3d toVector3d(const btVector3& bt_vec) {
Vector3d vec;
Expand All @@ -18,14 +17,6 @@ Vector3d toVector3d(const btVector3& bt_vec) {
return vec;
}

void ResultCollector::addPointPairResult(const PointPair& result) {
pts.push_back(result);
}

PointPair ResultCollector::minDistPoint() {
return *min_element(pts.begin(), pts.end());
}

btScalar BulletResultCollector::addSingleResult(
btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,
int partId0, int index0, const btCollisionObjectWrapper* colObj1Wrap,
Expand Down
25 changes: 2 additions & 23 deletions drake/systems/plants/collision/BulletResultCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,12 @@
#define __DrakeCollisionBullletResultCollector_H__

#include "drake/systems/plants/collision/DrakeCollision.h"
#include "drake/systems/plants/collision/ResultCollector.h"

namespace DrakeCollision {
Eigen::Vector3d toVector3d(const Eigen::Vector3d& vec);
// Eigen::Vector3d toVector3d(const Eigen::Vector3d& vec);
Copy link
Member

Choose a reason for hiding this comment

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

remove this line altogether?

Copy link
Author

Choose a reason for hiding this comment

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

Resolved.

Eigen::Vector3d toVector3d(const btVector3& bt_vec);

class ResultCollector {
public:
virtual ~ResultCollector(){};

virtual void addPointPairResult(const PointPair& result);

inline void addSingleResult(const ElementId idA, const ElementId idB,
const Eigen::Vector3d& ptA,
const Eigen::Vector3d& ptB,
const Eigen::Vector3d& normal, double distance) {
addPointPairResult(PointPair(idA, idB, ptA, ptB, normal, distance));
}

std::vector<PointPair> getResults() const { return pts; }

PointPair minDistPoint();

std::vector<PointPair> pts;
};

class BulletResultCollector : public ResultCollector,
public btCollisionWorld::ContactResultCallback {
public:
Expand All @@ -50,8 +31,6 @@ class BulletResultCollector : public ResultCollector,
int curr_bodyA_idx;
int curr_bodyB_idx;
};

typedef std::shared_ptr<ResultCollector> ResultCollShPtr;
}

#endif
17 changes: 15 additions & 2 deletions drake/systems/plants/collision/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
set(drakeCollision_SRC_FILES DrakeCollision.cpp Element.cpp PointPair.cpp Model.cpp)
set(drakeCollision_SRC_FILES DrakeCollision.cpp Element.cpp PointPair.cpp Model.cpp ResultCollector.cpp)
pods_find_pkg_config(fcl)

if (fcl_FOUND)
#add_definitions( -DBULLET_COLLISION -DBT_USE_DOUBLE_PRECISION )
set( drakeCollision_SRC_FILES ${drakeCollision_SRC_FILES} FCLModel.cpp )
set(fcl "yes" CACHE STRING "yes" )
endif()

pods_find_pkg_config(bullet)

if (bullet_FOUND)
Expand All @@ -9,14 +17,19 @@ endif()

add_library_with_exports(LIB_NAME drakeCollision SOURCE_FILES ${drakeCollision_SRC_FILES})

if (fcl_FOUND)
pods_use_pkg_config_packages(drakeCollision fcl)
endif()

if (bullet_FOUND)
pods_use_pkg_config_packages(drakeCollision bullet)
endif()


target_link_libraries(drakeCollision drakeShapes)

enable_testing()
add_subdirectory(test)

pods_install_libraries(drakeCollision)
drake_install_headers(DrakeCollision.h PointPair.h Element.h Model.h)

Loading