update to collada 2.4.0 support and assimp3.0 support. collada_parser now including urdf_model/X.h (from urdfdom) instead of urdf_interface/X.h
This commit is contained in:
parent
4195e88320
commit
4ffd7658d7
|
@ -11,11 +11,15 @@ include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
|
|||
|
||||
rosbuild_init()
|
||||
|
||||
rosbuild_add_boost_directories()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-extensions/ )
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(COLLADADOM collada15dom)
|
||||
include_directories(${COLLADADOM_INCLUDE_DIRS})
|
||||
#link_directories(${COLLADADOM_LIBRARY_DIRS})
|
||||
find_package(COLLADA_DOM 2.3 COMPONENTS 1.5)
|
||||
if( COLLADA_DOM_FOUND )
|
||||
include_directories(${COLLADA_DOM_INCLUDE_DIRS})
|
||||
#link_directories(${COLLADA_DOM_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
#set the default path for built executables to the "bin" directory
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
||||
|
@ -31,11 +35,14 @@ endif()
|
|||
#common commands for building c++ executables and libraries
|
||||
rosbuild_add_library(${PROJECT_NAME} src/collada_parser.cpp)
|
||||
|
||||
rosbuild_add_compile_flags(${PROJECT_NAME} "${COLLADA_DOM_CFLAGS_OTHER}")
|
||||
rosbuild_add_link_flags(${PROJECT_NAME} "${COLLADA_DOM_LDFLAGS_OTHER}")
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
rosbuild_add_link_flags(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif(APPLE)
|
||||
|
||||
#target_link_libraries(${PROJECT_NAME} another_library)
|
||||
rosbuild_add_boost_directories()
|
||||
|
||||
#rosbuild_link_boost(${PROJECT_NAME} thread)
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <map>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <urdf_interface/model.h>
|
||||
#include <urdf_model/model.h>
|
||||
|
||||
|
||||
namespace urdf {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<rosdep name="colladadom"/>
|
||||
|
||||
<export>
|
||||
<cpp cflags="-I${prefix}/include `pkg-config --cflags collada15dom`"
|
||||
lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lcollada_parser `pkg-config --libs collada15dom`"/>
|
||||
<cpp cflags="-I${prefix}/include `pkg-config --silence-errors --cflags collada15dom` `pkg-config --silence-errors --cflags collada-dom-150` "
|
||||
lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lcollada_parser `pkg-config --silence-errors --libs collada15dom` `pkg-config --silence-errors --libs collada-dom-150`"/>
|
||||
</export>
|
||||
|
||||
</package>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
#include <ros/ros.h>
|
||||
#include <collada_parser/collada_parser.h>
|
||||
#include <urdf_interface/model.h>
|
||||
#include <urdf_model/model.h>
|
||||
|
||||
#ifndef HAVE_MKSTEMPS
|
||||
#include <fstream>
|
||||
|
@ -419,7 +419,7 @@ public:
|
|||
bool InitFromFile(const std::string& filename) {
|
||||
ROS_DEBUG_STREAM(str(boost::format("init COLLADA reader version: %s, namespace: %s, filename: %s\n")%COLLADA_VERSION%COLLADA_NAMESPACE%filename));
|
||||
_collada.reset(new DAE);
|
||||
_dom = _collada->open(filename);
|
||||
_dom = (domCOLLADA*)_collada->open(filename);
|
||||
if (!_dom) {
|
||||
return false;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ public:
|
|||
bool InitFromData(const std::string& pdata) {
|
||||
ROS_DEBUG_STREAM(str(boost::format("init COLLADA reader version: %s, namespace: %s\n")%COLLADA_VERSION%COLLADA_NAMESPACE));
|
||||
_collada.reset(new DAE);
|
||||
_dom = _collada->openFromMemory(".",pdata.c_str());
|
||||
_dom = (domCOLLADA*)_collada->openFromMemory(".",pdata.c_str());
|
||||
if (!_dom) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,34 @@ set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
|||
|
||||
link_libraries(tinyxml)
|
||||
|
||||
find_package(ASSIMP)
|
||||
if( NOT ASSIMP_FOUND )
|
||||
pkg_check_modules(ASSIMP assimp)
|
||||
endif()
|
||||
|
||||
if( ASSIMP_FOUND )
|
||||
if( ${ASSIMP_VERSION} STRGREATER "2.0.0" )
|
||||
set(IS_ASSIMP3 1)
|
||||
add_definitions(-DIS_ASSIMP3)
|
||||
endif()
|
||||
include_directories(${ASSIMP_INCLUDE_DIRS})
|
||||
link_directories(${ASSIMP_LIBRARY_DIRS})
|
||||
else()
|
||||
message(STATUS "could not find assimp (perhaps available thorugh ROS package?), so assimping assimp v2")
|
||||
set(ASSIMP_LIBRARIES assimp)
|
||||
set(ASSIMP_LIBRARY_DIRS)
|
||||
set(ASSIMP_CXX_FLAGS)
|
||||
set(ASSIMP_CFLAGS_OTHER)
|
||||
set(ASSIMP_LINK_FLAGS)
|
||||
set(ASSIMP_INCLUDE_DIRS)
|
||||
set(IS_ASSIMP3 0) # most likely not
|
||||
endif()
|
||||
|
||||
rosbuild_add_library(collada_urdf src/collada_urdf.cpp)
|
||||
rosbuild_link_boost(collada_urdf system)
|
||||
target_link_libraries(collada_urdf assimp)
|
||||
target_link_libraries(collada_urdf ${ASSIMP_LIBRARIES})
|
||||
rosbuild_add_compile_flags(collada_urdf "${ASSIMP_CXX_FLAGS} ${ASSIMP_CFLAGS_OTHER}")
|
||||
rosbuild_add_link_flags(collada_urdf "${ASSIMP_LINK_FLAGS}")
|
||||
|
||||
rosbuild_add_executable(urdf_to_collada src/urdf_to_collada.cpp)
|
||||
target_link_libraries(urdf_to_collada collada_urdf)
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include <dom/domTypes.h>
|
||||
#include <resource_retriever/retriever.h>
|
||||
#include <urdf/model.h>
|
||||
#include <urdf_interface/pose.h>
|
||||
#include <urdf_model/pose.h>
|
||||
#include <angles/angles.h>
|
||||
#include <ros/assert.h>
|
||||
|
||||
|
@ -60,11 +60,23 @@
|
|||
#include <boost/format.hpp>
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <assimp/assimp.hpp>
|
||||
#include <assimp/aiScene.h>
|
||||
#include <assimp/aiPostProcess.h>
|
||||
#include <assimp/IOStream.h>
|
||||
#include <assimp/IOSystem.h>
|
||||
#if defined(IS_ASSIMP3)
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/LogStream.hpp>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/IOStream.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
#else
|
||||
#include <assimp.hpp>
|
||||
#include <aiScene.h>
|
||||
#include <aiPostProcess.h>
|
||||
#include <DefaultLogger.h>
|
||||
#include <IOStream.h>
|
||||
#include <IOSystem.h>
|
||||
|
||||
#endif
|
||||
|
||||
#define FOREACH(it, v) for(typeof((v).begin())it = (v).begin(); it != (v).end(); (it)++)
|
||||
#define FOREACHC FOREACH
|
||||
|
|
Loading…
Reference in New Issue