Skip to content
Snippets Groups Projects
Commit 4351bb38 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

Merge pull request #80 from jcarpent/devel

Correct bug in geometry parsing
parents dac81a66 c0738dcb
No related branches found
No related tags found
No related merge requests found
...@@ -67,7 +67,7 @@ IF(HPP_FCL_FOUND AND URDFDOM_FOUND) ...@@ -67,7 +67,7 @@ IF(HPP_FCL_FOUND AND URDFDOM_FOUND)
ADD_REQUIRED_DEPENDENCY("assimp") ADD_REQUIRED_DEPENDENCY("assimp")
ENDIF(HPP_FCL_FOUND AND URDFDOM_FOUND) ENDIF(HPP_FCL_FOUND AND URDFDOM_FOUND)
SET(BOOST_COMPONENTS filesystem unit_test_framework system) SET(BOOST_COMPONENTS filesystem unit_test_framework)
SEARCH_FOR_BOOST() SEARCH_FOR_BOOST()
# Path to boost headers # Path to boost headers
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
......
...@@ -65,7 +65,7 @@ IF (UNIX) ...@@ -65,7 +65,7 @@ IF (UNIX)
# Create target libpinocchio.so # Create target libpinocchio.so
ADD_LIBRARY ( ${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES} ) ADD_LIBRARY ( ${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES} )
SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3) PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
IF(URDFDOM_FOUND) IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} urdfdom) PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} urdfdom)
......
// //
// Copyright (c) 2015 CNRS // Copyright (c) 2015-2016 CNRS
// //
// This file is part of Pinocchio and is mainly inspired // This file is part of Pinocchio and is mainly inspired
// by software hpp-model-urdf // by software hpp-model-urdf
...@@ -25,13 +25,12 @@ ...@@ -25,13 +25,12 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <assimp/DefaultLogger.h> #include <assimp/DefaultLogger.hpp>
#include <assimp/IOStream.hpp>
#include <assimp/assimp.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/aiScene.h> #include <assimp/scene.h>
#include <assimp/aiPostProcess.h> #include <assimp/Importer.hpp>
#include <assimp/IOStream.h> #include <assimp/postprocess.h>
#include <assimp/IOSystem.h>
#include <hpp/fcl/BV/OBBRSS.h> #include <hpp/fcl/BV/OBBRSS.h>
...@@ -62,9 +61,12 @@ struct TriangleAndVertices ...@@ -62,9 +61,12 @@ struct TriangleAndVertices
* @param[in] mesh The mesh that must be built * @param[in] mesh The mesh that must be built
* @param tv Triangles and Vertices of the mesh submodels * @param tv Triangles and Vertices of the mesh submodels
*/ */
inline void buildMesh (const ::urdf::Vector3& scale, const aiScene* scene, const aiNode* node, inline void buildMesh (const ::urdf::Vector3 & scale,
std::vector<unsigned>& subMeshIndexes, const PolyhedronPtrType& mesh, const aiScene* scene,
TriangleAndVertices& tv) const aiNode* node,
std::vector<unsigned> & subMeshIndexes,
const PolyhedronPtrType & mesh,
TriangleAndVertices & tv)
{ {
if (!node) return; if (!node) return;
...@@ -133,8 +135,10 @@ inline void buildMesh (const ::urdf::Vector3& scale, const aiScene* scene, const ...@@ -133,8 +135,10 @@ inline void buildMesh (const ::urdf::Vector3& scale, const aiScene* scene, const
* @param[in] scene Pointer to the assimp scene * @param[in] scene Pointer to the assimp scene
* @param[in] mesh The mesh that must be built * @param[in] mesh The mesh that must be built
*/ */
inline void meshFromAssimpScene (const std::string& name, const ::urdf::Vector3& scale, inline void meshFromAssimpScene (const std::string & name,
const aiScene* scene,const PolyhedronPtrType& mesh) const ::urdf::Vector3 & scale,
const aiScene* scene,
const PolyhedronPtrType & mesh)
{ {
TriangleAndVertices tv; TriangleAndVertices tv;
...@@ -170,8 +174,9 @@ inline void meshFromAssimpScene (const std::string& name, const ::urdf::Vector3& ...@@ -170,8 +174,9 @@ inline void meshFromAssimpScene (const std::string& name, const ::urdf::Vector3&
* @param[in] scale Scale to apply when reading the ressource * @param[in] scale Scale to apply when reading the ressource
* @param[in] polyhedron The resulted polyhedron * @param[in] polyhedron The resulted polyhedron
*/ */
inline void loadPolyhedronFromResource ( const std::string& resource_path, const ::urdf::Vector3& scale, inline void loadPolyhedronFromResource (const std::string & resource_path,
const PolyhedronPtrType& polyhedron) const ::urdf::Vector3 & scale,
const PolyhedronPtrType & polyhedron)
{ {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(resource_path.c_str(), aiProcess_SortByPType| aiProcess_GenNormals| const aiScene* scene = importer.ReadFile(resource_path.c_str(), aiProcess_SortByPType| aiProcess_GenNormals|
...@@ -190,12 +195,12 @@ inline void loadPolyhedronFromResource ( const std::string& resource_path, const ...@@ -190,12 +195,12 @@ inline void loadPolyhedronFromResource ( const std::string& resource_path, const
/** /**
* @brief Transform a cURL readable path (package://..) to an absolute path for urdf collision path * @brief Transform a cURL readable path (package://..) to an absolute path for urdf collision path
* *
* @param urdf_mesh_path The path given in the urdf file (package://..) * @param[in] urdf_mesh_path The path given in the urdf file (package://..)
* @param[in] meshRootDir Root path to the directory where meshes are located * @param[in] meshRootDir Root path to the directory where meshes are located
* *
* @return The absolute path to the mesh file * @return The absolute path to the mesh file
*/ */
inline std::string fromURDFMeshPathToAbsolutePath(std::string & urdf_mesh_path, std::string meshRootDir) inline std::string fromURDFMeshPathToAbsolutePath(const std::string & urdf_mesh_path, const std::string & meshRootDir)
{ {
std::string absolutePath = std::string(meshRootDir + std::string absolutePath = std::string(meshRootDir +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment