export collada parser as plugin

This commit is contained in:
Ioan Sucan 2013-05-20 14:44:44 +03:00
parent 65a0c5082f
commit 84b96c265f
8 changed files with 128 additions and 5 deletions

View File

@ -1,4 +1,4 @@
= 1.9.0 (Forthcoming) =
= 1.9.0 =
* Branch from 1.8.0
* [[collada_parser]]

View File

@ -3,7 +3,7 @@ project(collada_parser)
find_package(Boost REQUIRED system)
find_package(catkin REQUIRED COMPONENTS urdfdom_headers urdf_parser_plugin roscpp)
find_package(catkin REQUIRED COMPONENTS urdfdom_headers urdf_parser_plugin roscpp class_loader)
catkin_package(
LIBRARIES ${PROJECT_NAME}
@ -31,12 +31,18 @@ if(HAVE_MKSTEMPS)
add_definitions("-DHAVE_MKSTEMPS")
endif()
#common commands for building c++ executables and libraries
# build the parser lib
add_library(${PROJECT_NAME} src/collada_parser.cpp)
target_link_libraries(${PROJECT_NAME}
${COLLADA_DOM_LIBRARIES} ${Boost_LIBRARIES} ${catkin_LIBRARIES}
)
# build the plugin for the parser
add_library(${PROJECT_NAME}_plugin src/collada_parser_plugin.cpp)
target_link_libraries(${PROJECT_NAME}_plugin
${PROJECT_NAME} ${Boost_LIBRARIES} ${catkin_LIBRARIES}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES COMPILER_FLAGS "${COLLADA_DOM_CFLAGS_OTHER}"
)
@ -51,8 +57,11 @@ else()
)
endif()
install(TARGETS ${PROJECT_NAME}
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_plugin
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(FILES collada_parser_plugin_description.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

View File

@ -0,0 +1,7 @@
<library path="lib/libcollada_parser_plugin">
<class name="urdf/ColladaURDFParser" type="urdf::ColladaURDFParser" base_class_type="urdf::URDFParser">
<description>
Parse models as URDF from Collada files.
</description>
</class>
</library>

View File

@ -0,0 +1,54 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013, Willow Garage, Inc.
* All rights reserved.
*
* 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.
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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 OWNER 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.
*********************************************************************/
/* Author: Ioan Sucan */
#ifndef COLLADA_PARSER_COLLADA_PARSER_PLUGIN_H
#define COLLADA_PARSER_COLLADA_PARSER_PLUGIN_H
#include <urdf_parser_plugin/parser.h>
namespace urdf
{
class ColladaURDFParser : public URDFParser
{
public:
virtual boost::shared_ptr<ModelInterface> parse(const std::string &xml_string);
};
}
#endif

View File

@ -23,11 +23,13 @@
<build_depend>roscpp</build_depend>
<build_depend>urdfdom_headers</build_depend>
<build_depend>urdf_parser_plugin</build_depend>
<build_depend>class_loader</build_depend>
<run_depend>collada-dom</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>urdfdom_headers</run_depend>
<run_depend>urdf_parser_plugin</run_depend>
<run_depend>class_loader</run_depend>
</package>

View File

@ -0,0 +1,46 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013, Willow Garage, Inc.
* All rights reserved.
*
* 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.
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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 OWNER 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.
*********************************************************************/
/* Author: Ioan Sucan */
#include "collada_parser/collada_parser_plugin.h"
#include "collada_parser/collada_parser.h"
#include <class_loader/class_loader.h>
boost::shared_ptr<urdf::ModelInterface> urdf::ColladaURDFParser::parse(const std::string &xml_string)
{
return urdf::parseCollada(xml_string);
}
CLASS_LOADER_REGISTER_CLASS(urdf::ColladaURDFParser, urdf::URDFParser)

View File

@ -38,7 +38,7 @@
<run_depend>ros_comm</run_depend>
<run_depend>rosconsole_bridge</run_depend>
<run_depend>urdf</run_depend>
<run_depend>urdf_parser</run_depend>
<run_depend>urdf_parser_plugin</run_depend>
<run_depend>urdfdom</run_depend>
<run_depend>urdfdom_headers</run_depend>
<run_depend>joint_state_publisher</run_depend>

View File

@ -34,6 +34,9 @@
/* Author: Ioan Sucan */
#ifndef URDF_PARSER_PLUGIN_H
#define URDF_PARSER_PLUGIN_H
#include <urdf_model/model.h>
namespace urdf
@ -55,3 +58,5 @@ public:
};
}
#endif