Strip collada kinetic (#198)

* Deleted collada_parser and collada_urdf

* Add README with deprecation notice

* Add missing backtick
This commit is contained in:
Shane Loretz 2017-05-04 09:42:04 -07:00 committed by GitHub
parent 380303aadc
commit 3fa7b87abe
19 changed files with 14 additions and 9673 deletions

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# Robot Model
`robot_model` contains packages for modeling various aspects of robot information, specified in the Xml Robot Description Format (URDF).
The core package of this stack is urdf, which parses URDF files, and constructs an object model (C++) of the robot.
## Deprecation
This repository and the `robot_model` metapackage are deprecated.
The other packages will continue to be maintained, but are being moved to new repositories.
More information is available at [`ros/robot_model#195`](https://github.com/ros/robot_model/issues/195).
**Moved Repos**
* `collada_urdf` and `collada_parser`
* [`ros/collada_urdf`](https://github.com/ros/collada_urdf)

View File

@ -1,93 +0,0 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package collada_parser
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.12.9 (2017-04-26)
-------------------
1.12.8 (2017-03-27)
-------------------
* add Chris and Shane as maintainers (`#184 <https://github.com/ros/robot_model/issues/184>`_)
* fix missed mandatory -std=c++11 flag (`#181 <https://github.com/ros/robot_model/issues/181>`_)
collada_parser,kdl_parser,urdf: add c++11 flag,
collada_parser: replace typeof with ansi __typeof\_\_
builded/tested on gentoo
Thanks den4ix for the contribution!
* Contributors: Denis Romanchuk, William Woodall
1.12.7 (2017-01-26)
-------------------
1.12.6 (2017-01-04)
-------------------
* Now using ``urdf::*ShredPtr`` instead of ``boost::shared_ptr`` (`#144 <https://github.com/ros/robot_model/issues/144>`_)
* Contributors: Jochen Sprickerhof
1.12.5 (2016-10-27)
-------------------
1.12.4 (2016-08-23)
-------------------
1.12.3 (2016-06-10)
-------------------
1.12.2 (2016-04-12)
-------------------
1.12.1 (2016-04-10)
-------------------
1.11.8 (2015-09-11)
-------------------
1.11.7 (2015-04-22)
-------------------
1.11.6 (2014-11-30)
-------------------
* fix rotation of joint axis when oriantation between parent link and child link is differ
* Contributors: YoheiKakiuchi
1.11.5 (2014-07-24)
-------------------
1.11.4 (2014-07-07)
-------------------
* collada_parser: add extract actuators, fix for using nominal torque
* moving to new dependency for urdfdom and urdfdom_headers. https://github.com/ros/rosdistro/issues/4633
* Contributors: Tully Foote, YoheiKakiuchi
1.11.3 (2014-06-24)
-------------------
* update usage of urdfdom_headers for indigo/trusty
* Contributors: William Woodall
1.11.2 (2014-03-22)
-------------------
1.11.1 (2014-03-20)
-------------------
* remove visual and collision if there is no vertices
* do not use visual and collision group
* fix debug message
* fix problem of root coordinates
* Contributors: YoheiKakiuchi
1.11.0 (2014-02-21)
-------------------
* fix, joint axis should be rotated depend on local coords
* fix overwriting velocity limit
* Contributors: YoheiKakiuchi
1.10.18 (2013-12-04)
--------------------
* add DEPENDS for kdl_parser
* Contributors: Ioan Sucan
1.10.16 (2013-11-18)
--------------------
* fix for using collada_parser_plugin
1.10.15 (2013-08-17)
--------------------

View File

@ -1,70 +0,0 @@
cmake_minimum_required(VERSION 2.8.3)
project(collada_parser)
find_package(Boost REQUIRED system)
find_package(catkin REQUIRED COMPONENTS urdf_parser_plugin roscpp class_loader urdf)
find_package(urdfdom_headers REQUIRED)
add_compile_options(-std=c++11)
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp urdf_parser_plugin
DEPENDS urdfdom_headers
)
include_directories(${Boost_INCLUDE_DIR})
include_directories(include ${catkin_INCLUDE_DIRS} ${urdfdom_headers_INCLUDE_DIRS})
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-extensions/)
find_package(PkgConfig)
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()
# necessary for collada reader to create the temporary dae files due
# to limitations in the URDF geometry
include (CheckFunctionExists)
check_function_exists(mkstemps HAVE_MKSTEMPS)
if(HAVE_MKSTEMPS)
add_definitions("-DHAVE_MKSTEMPS")
endif()
# 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}"
)
if(APPLE)
set_target_properties(${PROJECT_NAME}
PROPERTIES LINK_FLAGS
"${COLLADA_DOM_LDFLAGS_OTHER} -undefined dynamic_lookup"
)
else()
set_target_properties(${PROJECT_NAME}
PROPERTIES LINK_FLAGS "${COLLADA_DOM_LDFLAGS_OTHER}"
)
endif()
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

@ -1,7 +0,0 @@
<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

@ -1,54 +0,0 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2008, 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: Wim Meeussen */
#ifndef COLLADA_PARSER_COLLADA_PARSER_H
#define COLLADA_PARSER_COLLADA_PARSER_H
#include <string>
#include <map>
#include <boost/function.hpp>
#include <urdf/urdfdom_compatibility.h>
namespace urdf {
/// \brief Load Model from string
urdf::ModelInterfaceSharedPtr parseCollada(const std::string &xml_string );
}
#endif

View File

@ -1,54 +0,0 @@
/*********************************************************************
* 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 urdf::ModelInterfaceSharedPtr parse(const std::string &xml_string);
};
}
#endif

View File

@ -1,26 +0,0 @@
/**
\mainpage
\htmlinclude manifest.html
\b collada_parser is ...
<!--
Provide an overview of your package.
-->
\section codeapi Code API
<!--
Provide links to specific auto-generated API documentation within your
package that is of particular interest to a reader. Doxygen will
document pretty much every part of your code, so do your best here to
point the reader to the actual API.
If your codebase is fairly large or has different sets of APIs, you
should use the doxygen 'group' tag to keep these APIs together. For
example, the roscpp documentation has 'libros' group.
-->
*/

View File

@ -1,45 +0,0 @@
<package>
<name>collada_parser</name>
<version>1.12.9</version>
<description>
This package contains a C++ parser for the Collada robot
description format. The parser reads a Collada XML robot
description, and creates a C++ URDF model. Although it is possible
to directly use this parser when working with Collada robot
descriptions, the preferred user API is found in the urdf package.
</description>
<author>Rosen Diankov</author>
<author>Kei Okada</author>
<author email="isucan@gmail.com">Ioan Sucan</author>
<author email="jacquelinekay1@gmail.com">Jackie Kay</author>
<maintainer email="clalancette@osrfoundation.org">Chris Lalancette</maintainer>
<maintainer email="sloretz@osrfoundation.org">Shane Loretz</maintainer>
<license>BSD</license>
<url type="website">http://ros.org/wiki/collada_parser</url>
<url type="repository">https://github.com/ros/robot_model</url>
<url type="bugtracker">https://github.com/ros/robot_model/issues</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>collada-dom</build_depend>
<build_depend>liburdfdom-headers-dev</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>urdf_parser_plugin</build_depend>
<build_depend>class_loader</build_depend>
<build_depend>urdf</build_depend>
<run_depend>collada-dom</run_depend>
<run_depend>liburdfdom-headers-dev</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>urdf_parser_plugin</run_depend>
<run_depend>class_loader</run_depend>
<export>
<urdf_parser_plugin plugin="${prefix}/collada_parser_plugin_description.xml"/>
</export>
</package>

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
/*********************************************************************
* 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>
urdf::ModelInterfaceSharedPtr urdf::ColladaURDFParser::parse(const std::string &xml_string)
{
return urdf::parseCollada(xml_string);
}
CLASS_LOADER_REGISTER_CLASS(urdf::ColladaURDFParser, urdf::URDFParser)

View File

@ -1,122 +0,0 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package collada_urdf
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.12.9 (2017-04-26)
-------------------
1.12.8 (2017-03-27)
-------------------
* Remove old gazebo settings.
Based on an initial patch from YoheiKakiuchi, just totally
remove old Gazebo 1.0 settings, as they are never used and
almost certainly will never be used.
* add Chris and Shane as maintainers (`#184 <https://github.com/ros/robot_model/issues/184>`_)
* Do a few cleanup tasks in collada_urdf (`#183 <https://github.com/ros/robot_model/issues/183>`_)
* Style cleanup within collada_urdf.
No functional change, just style.
* Make sure to quit out of urdf_to_collada when invalid file is found.
Otherwise, we'll just end up segfaulting later on.
* Re-enable one of the collada-urdf tests.
In point of fact, we delete the rest of the tests because
they don't make much sense anymore. Just enable this one
for now; we'll enable further ones in the future.
* Add in another test for collada_urdf.
* remove divide by 2 when writing boxes to collada format (`#133 <https://github.com/ros/robot_model/issues/133>`_)
* Contributors: Chris Lalancette, Jackie Kay, William Woodall
1.12.7 (2017-01-26)
-------------------
1.12.6 (2017-01-04)
-------------------
* Now using ``urdf::*ShredPtr`` instead of ``boost::shared_ptr`` (`#144 <https://github.com/ros/robot_model/issues/144>`_)
* Contributors: Jochen Sprickerhof
1.12.5 (2016-10-27)
-------------------
1.12.4 (2016-08-23)
-------------------
* Use the C++11 standard (`#145 <https://github.com/ros/robot_model/issues/145>`_)
* Contributors: William Woodall
1.12.3 (2016-06-10)
-------------------
1.12.2 (2016-04-12)
-------------------
1.12.1 (2016-04-10)
-------------------
1.11.8 (2015-09-11)
-------------------
* Removed pcre hack for newer released collada-dom.
* Contributors: Kei Okada
1.11.7 (2015-04-22)
-------------------
* Fixed `#89 <https://github.com/ros/robot_model/issues/89>`_
Accomplished by loading libpcrecpp before collada-dom.
* Contributors: Kei Okada, William Woodall
1.11.6 (2014-11-30)
-------------------
1.11.5 (2014-07-24)
-------------------
1.11.4 (2014-07-07)
-------------------
* moving to new dependency for urdfdom and urdfdom_headers. https://github.com/ros/rosdistro/issues/4633
* Fix clash with assimp 3.1 in CMake.
* Contributors: Benjamin Chrétien, Tully Foote
1.11.3 (2014-06-24)
-------------------
* Merge pull request `#69 <https://github.com/ros/robot_model/issues/69>`_ from YoheiKakiuchi/indigo-devel-store-original-mesh-name
storing original mesh file name and location
* storing original mesh file name and location
* Contributors: Ioan A Sucan, YoheiKakiuchi
1.11.2 (2014-03-22)
-------------------
* use new urdfdom_headers API
* Contributors: Ioan Sucan
1.11.1 (2014-03-20)
-------------------
* Use assimp-dev dep for building
* Contributors: Scott K Logan
1.11.0 (2014-02-21)
-------------------
* Use VERSION_LESS instead of STRLESS
The version comparison routines were added in cmake 2.8.0
* Fix export API detection (for assimp < 2.0.885)
It looks like this API was added in Assimp 2.0.885:
https://github.com/assimp/assimp/commit/ae23c03bd9a0b5f1227dc0042fd98f7206c770a8
* Invert Assimp version detect logic for greater accuracy
* Updated Assimp defines to be more flexible
This commit is a follow-up to 85b20197671e142044e471df603debd0faf08baf
Why was export.h removed from assimp < 3.0.0?
* Better feature detection for assimp version
The unified headers were introduced in Assimp 2.0.1150, so checking for Assimp 3.0.0 is not quite the best solution.
See https://github.com/assimp/assimp/commit/6fa251c2f2e7a142bb861227dce0c26362927fbc
* Contributors: Scott K Logan
1.10.18 (2013-12-04)
--------------------
* add DEPENDS for kdl_parser
* Contributors: Ioan Sucan
1.10.16 (2013-11-18)
--------------------
* check for CATKIN_ENABLE_TESTING
* fix for compiling collada_to_urdf, add dependency to tf
* add collada_to_urdf.cpp for converting collada file to urdf file
1.10.15 (2013-08-17)
--------------------
* fix `#30 <https://github.com/ros/robot_model/issues/30>`_

View File

@ -1,88 +0,0 @@
cmake_minimum_required(VERSION 2.8.12)
project(collada_urdf)
find_package(catkin REQUIRED COMPONENTS angles collada_parser resource_retriever urdf geometric_shapes tf cmake_modules)
find_package(TinyXML REQUIRED)
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
DEPENDS angles collada_parser resource_retriever urdf geometric_shapes tf)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11_FLAG)
if(HAS_STD_CPP11_FLAG)
add_compile_options(-std=c++11)
endif()
include_directories(include)
find_package(assimp QUIET)
if ( NOT ASSIMP_FOUND )
find_package(Assimp QUIET)
if ( NOT ASSIMP_FOUND )
find_package(PkgConfig REQUIRED)
pkg_check_modules(ASSIMP assimp)
endif()
endif()
if( ASSIMP_FOUND )
if( NOT ${ASSIMP_VERSION} VERSION_LESS "2.0.1150" )
add_definitions(-DASSIMP_UNIFIED_HEADER_NAMES)
endif()
if( NOT ${ASSIMP_VERSION} VERSION_LESS "2.0.885" )
add_definitions(-DASSIMP_EXPORT_API)
endif()
include_directories(${ASSIMP_INCLUDE_DIRS})
link_directories(${ASSIMP_LIBRARY_DIRS})
else()
message(STATUS "could not find assimp (perhaps available thorugh ROS package?), so assuming 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)
endif()
# Note: assimp 3.1 overwrites CMake Boost variables, so we need to check for
# Boost after assimp.
find_package(Boost REQUIRED COMPONENTS system filesystem program_options)
include_directories(${Boost_INCLUDE_DIR})
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()
include_directories(${TinyXML_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
link_directories(${catkin_LIBRARY_DIRS})
add_library(${PROJECT_NAME} src/collada_urdf.cpp)
target_link_libraries(${PROJECT_NAME} ${TinyXML_LIBRARIES} ${catkin_LIBRARIES} ${COLLADA_DOM_LIBRARIES}
${Boost_LIBRARIES} ${ASSIMP_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILER_FLAGS "${ASSIMP_CXX_FLAGS} ${ASSIMP_CFLAGS_OTHER}")
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${ASSIMP_LINK_FLAGS}")
add_executable(urdf_to_collada src/urdf_to_collada.cpp)
target_link_libraries(urdf_to_collada ${catkin_LIBRARIES} ${COLLADA_DOM_LIBRARIES}
${Boost_LIBRARIES} ${PROJECT_NAME})
add_executable(collada_to_urdf src/collada_to_urdf.cpp)
target_link_libraries(collada_to_urdf ${ASSIMP_LIBRARIES} ${catkin_LIBRARIES} ${COLLADA_DOM_LIBRARIES} ${Boost_LIBRARIES})
set_target_properties(collada_to_urdf PROPERTIES COMPILER_FLAGS "${ASSIMP_CXX_FLAGS} ${ASSIMP_CFLAGS_OTHER}")
set_target_properties(collada_to_urdf PROPERTIES LINK_FLAGS "${ASSIMP_LINK_FLAGS}")
if(CATKIN_ENABLE_TESTING)
catkin_add_gtest(test_collada_urdf test/test_collada_urdf.cpp WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test)
target_link_libraries(test_collada_urdf ${PROJECT_NAME} ${catkin_LIBRARIES} ${COLLADA_DOM_LIBRARIES}
${Boost_LIBRARIES})
endif()
install(TARGETS ${PROJECT_NAME} urdf_to_collada collada_to_urdf
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

View File

@ -1,69 +0,0 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2010, 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:
*
* * Redstributions 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.
*********************************************************************/
/* Authors: Tim Field */
#ifndef COLLADA_URDF_COLLADA_URDF_H
#define COLLADA_URDF_COLLADA_URDF_H
#include <string>
#include <boost/shared_ptr.hpp>
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <dae.h>
#pragma GCC diagnostic pop
#endif
#include "urdf/model.h"
namespace collada_urdf {
class ColladaUrdfException : public std::runtime_error
{
public:
ColladaUrdfException(std::string const& what);
};
/** Write a COLLADA DOM to a file
* \param robot_model The URDF robot model
* \param file The filename to write the document to
* \return true on success, false on failure
*/
bool WriteUrdfModelToColladaFile(urdf::Model const& robot_model, std::string const& file);
}
#endif

View File

@ -1,49 +0,0 @@
<package>
<name>collada_urdf</name>
<version>1.12.9</version>
<description>
This package contains a tool to convert Unified Robot Description Format (URDF) documents into COLLAborative Design Activity (COLLADA) documents.
Implements robot-specific COLLADA extensions as defined by
http://openrave.programmingvision.com/index.php/Started:COLLADA
</description>
<author>Tim Field</author>
<author>Rosen Diankov</author>
<author email="isucan@gmail.com">Ioan Sucan</author>
<author email="jacquelinekay1@gmail.com">Jackie Kay</author>
<maintainer email="clalancette@osrfoundation.org">Chris Lalancette</maintainer>
<maintainer email="sloretz@osrfoundation.org">Shane Loretz</maintainer>
<license>BSD</license>
<url type="website">http://ros.org/wiki/collada_urdf</url>
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>angles</build_depend>
<build_depend>assimp-dev</build_depend>
<build_depend>resource_retriever</build_depend>
<build_depend>collada-dom</build_depend>
<build_depend>collada_parser</build_depend>
<build_depend>liburdfdom-dev</build_depend>
<build_depend>liburdfdom-headers-dev</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>urdf</build_depend>
<build_depend>geometric_shapes</build_depend>
<build_depend>tf</build_depend>
<build_depend>cmake_modules</build_depend>
<run_depend>angles</run_depend>
<run_depend>assimp</run_depend>
<run_depend>collada-dom</run_depend>
<run_depend>collada_parser</run_depend>
<run_depend>liburdfdom-dev</run_depend>
<run_depend>liburdfdom-headers-dev</run_depend>
<run_depend>resource_retriever</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>urdf</run_depend>
<run_depend>tf</run_depend>
<run_depend>geometric_shapes</run_depend>
</package>

View File

@ -1,657 +0,0 @@
/* Author: Yohei Kakiuchi */
#include <ros/ros.h>
#include <urdf/model.h>
#include <collada_parser/collada_parser.h>
#include <urdf_parser/urdf_parser.h>
#if defined(ASSIMP_UNIFIED_HEADER_NAMES)
#include <assimp/IOSystem.hpp>
#include <assimp/IOStream.hpp>
#include <assimp/Importer.hpp>
#include <assimp/Exporter.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#else
#include <assimp.hpp>
#if defined(ASSIMP_EXPORT_API)
#include <assimp/export.hpp>
#endif
#include <aiScene.h>
#include <aiPostProcess.h>
#endif
#include <iostream>
#include <fstream>
#include <boost/program_options.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <tf/LinearMath/Transform.h>
#include <tf/LinearMath/Quaternion.h>
#undef GAZEBO_1_3
#define GAZEBO_1_3
using namespace urdf;
using namespace std;
bool use_simple_visual = false;
bool use_simple_collision = false;
bool add_gazebo_description = false;
bool use_assimp_export = false;
bool use_same_collision_as_visual = true;
bool rotate_inertia_frame = true;
bool export_collision_mesh = false;
string mesh_dir = "/tmp";
string arobot_name = "";
string output_file = "";
string mesh_prefix = "";
#define PRINT_ORIGIN(os, origin) \
os << "xyz: " << origin.position.x << " " << origin.position.y << " " << origin.position.z << " "; \
{ double r,p,y; origin.rotation.getRPY(r, p, y); \
os << "rpy: " << r << " " << p << " " << y; }
#define PRINT_ORIGIN_XML(os, origin) \
os << "xyz=\"" << origin.position.x << " " << origin.position.y << " " << origin.position.z << "\""; \
{ double h___r, h___p, h___y; \
origin.rotation.getRPY(h___r, h___p, h___y); \
os << " rpy=\"" << h___r << " " << h___p << " " << h___y << "\""; }
#define PRINT_GEOM(os, geometry) \
if ( geometry->type == urdf::Geometry::MESH ) { os << "geom: name: " << ((urdf::Mesh *)geometry.get())->filename; }
void assimp_file_export(std::string fname, std::string ofname,
std::string mesh_type = "collada") {
#if defined(ASSIMP_EXPORT_API)
if (fname.find("file://") == 0) {
fname.erase(0, strlen("file://"));
}
Assimp::Importer importer;
/*
{ // ignore UP_DIRECTION tag in collada
bool existing;
importer.SetPropertyBool(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION, true, &existing);
if(existing) {
fprintf(stderr, ";; OverWrite : Ignore UP_DIRECTION", existing);
}
}
*/
const aiScene* scene = importer.ReadFile(fname.c_str(),
aiProcess_Triangulate |
aiProcess_GenNormals |
aiProcess_JoinIdenticalVertices |
aiProcess_SplitLargeMeshes |
aiProcess_OptimizeMeshes |
aiProcess_SortByPType);
if (!scene) {
std::string str( importer.GetErrorString() );
std::cerr << ";; " << str << std::endl;
return;
}
Assimp::Exporter aexpt;
aiReturn ret = aexpt.Export(scene, mesh_type, ofname);
if ( ret != AI_SUCCESS ) {
std::string str( "assimp error" );
std::cerr << ";; " << str << std::endl;
}
#endif
}
// assimp bounding box calculation
void assimp_calc_bbox(string fname, float &minx, float &miny, float &minz,
float &maxx, float &maxy, float &maxz) {
if (fname.find("file://") == 0) {
fname.erase(0, strlen("file://"));
}
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(fname.c_str(),
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType); // aiProcess_GenNormals
// aiProcess_GenSmoothNormals
// aiProcess_SplitLargeMeshes
if (!scene) {
std::string str( importer.GetErrorString() );
std::cerr << ";; " << str << std::endl;
return;
}
aiNode *node = scene->mRootNode;
bool found = false;
if(node->mNumMeshes > 0 && node->mMeshes != NULL) {
std::cerr << "Root node has meshes " << node->mMeshes << std::endl;;
found = true;
} else {
for (unsigned int i=0; i < node->mNumChildren; ++i) {
if(node->mChildren[i]->mNumMeshes > 0 && node->mChildren[i]->mMeshes != NULL) {
std::cerr << "Child " << i << " has meshes" << std::endl;
node = node->mChildren[i];
found = true;
break;
}
}
}
if(found == false) {
std::cerr << "Can't find meshes in file" << std::endl;
return;
}
aiMatrix4x4 transform = node->mTransformation;
// copy vertices
maxx = maxy = maxz = -100000000.0;
minx = miny = minz = 100000000.0;
std::cerr << ";; num meshes: " << node->mNumMeshes << std::endl;
for (unsigned int m = 0; m < node->mNumMeshes; m++) {
aiMesh *a = scene->mMeshes[node->mMeshes[m]];
std::cerr << ";; num vertices: " << a->mNumVertices << std::endl;
for (unsigned int i = 0 ; i < a->mNumVertices ; ++i) {
aiVector3D p;
p.x = a->mVertices[i].x;
p.y = a->mVertices[i].y;
p.z = a->mVertices[i].z;
p *= transform;
if ( maxx < p.x ) {
maxx = p.x;
}
if ( maxy < p.y ) {
maxy = p.y;
}
if ( maxz < p.z ) {
maxz = p.z;
}
if ( minx > p.x ) {
minx = p.x;
}
if ( miny > p.y ) {
miny = p.y;
}
if ( minz > p.z ) {
minz = p.z;
}
}
}
}
void addChildLinkNamesXML(urdf::LinkConstSharedPtr link, ofstream& os)
{
os << " <link name=\"" << link->name << "\">" << endl;
if ( !!link->visual ) {
os << " <visual>" << endl;
if (!use_simple_visual) {
os << " <origin ";
PRINT_ORIGIN_XML(os, link->visual->origin);
os << "/>" << endl;
os << " <geometry>" << endl;
if ( link->visual->geometry->type == urdf::Geometry::MESH ) {
std::string ifname (((urdf::Mesh *)link->visual->geometry.get())->filename);
if (ifname.find("file://") == 0) {
ifname.erase(0, strlen("file://"));
}
std::string ofname (mesh_dir + "/" + link->name + "_mesh.dae");
if (use_assimp_export) {
// using collada export
assimp_file_export (ifname, ofname);
} else {
// copy to ofname
std::ofstream tmp_os;
tmp_os.open(ofname.c_str());
std::ifstream is;
is.open(ifname.c_str());
std::string buf;
while(is && getline(is, buf)) tmp_os << buf << std::endl;
is.close();
tmp_os.close();
}
if (mesh_prefix != "") {
os << " <mesh filename=\"" << mesh_prefix + "/" + link->name + "_mesh.dae" << "\" scale=\"1 1 1\" />" << endl;
} else {
os << " <mesh filename=\"" << "file://" << ofname << "\" scale=\"1 1 1\" />" << endl;
}
}
os << " </geometry>" << endl;
} else {
// simple visual
float ax,ay,az,bx,by,bz;
if ( link->visual->geometry->type == urdf::Geometry::MESH ) {
assimp_calc_bbox(((urdf::Mesh *)link->visual->geometry.get())->filename,
ax, ay, az, bx, by, bz);
}
os << " <origin ";
urdf::Pose pp = link->visual->origin;
pp.position.x += ( ax + bx ) / 2 ;
pp.position.y += ( ay + by ) / 2 ;
pp.position.z += ( az + bz ) / 2 ;
PRINT_ORIGIN_XML(os, pp);
os << "/>" << endl;
os << " <geometry>" << endl;
os << " <box size=\"" << bx - ax << " " << by - ay << " " << bz - az << "\"/>" << endl;
os << " </geometry>" << endl;
}
os << " </visual>" << endl;
}
if ( !!link->collision ) {
os << " <collision>" << endl;
if (!use_simple_collision) {
os << " <origin ";
PRINT_ORIGIN_XML(os, link->collision->origin);
os << "/>" << endl;
os << " <geometry>" << endl;
if ( link->visual->geometry->type == urdf::Geometry::MESH ) {
std::string ifname;
if (use_same_collision_as_visual) {
ifname.assign (((urdf::Mesh *)link->visual->geometry.get())->filename);
} else {
ifname.assign (((urdf::Mesh *)link->collision->geometry.get())->filename);
}
if (ifname.find("file://") == 0) {
ifname.erase(0, strlen("file://"));
}
std::string oofname;
if (export_collision_mesh) {
oofname = link->name + "_mesh.stl";
} else {
oofname = link->name + "_mesh.dae";
}
std::string ofname = (mesh_dir + "/" + oofname);
if (use_assimp_export) {
// using collada export
if (export_collision_mesh) {
assimp_file_export (ifname, ofname, "stl");
} else {
assimp_file_export (ifname, ofname);
}
} else {
// copy to ofname
std::ofstream tmp_os;
tmp_os.open(ofname.c_str());
std::ifstream is;
is.open(ifname.c_str());
std::string buf;
while(is && getline(is, buf)) tmp_os << buf << std::endl;
is.close();
tmp_os.close();
}
if (mesh_prefix != "") {
os << " <mesh filename=\"" << mesh_prefix + "/" + oofname;
} else {
os << " <mesh filename=\"" << "file://" << ofname;
}
os << "\" scale=\"1 1 1\" />" << endl;
}
os << " </geometry>" << endl;
} else {
// simple collision
float ax,ay,az,bx,by,bz;
if ( link->visual->geometry->type == urdf::Geometry::MESH ) {
assimp_calc_bbox(std::string ( ((urdf::Mesh *)link->visual->geometry.get())->filename ),
ax, ay, az, bx, by, bz);
}
os << " <origin ";
urdf::Pose pp = link->visual->origin;
pp.position.x += ( ax + bx ) / 2 ;
pp.position.y += ( ay + by ) / 2 ;
pp.position.z += ( az + bz ) / 2 ;
PRINT_ORIGIN_XML(os, pp);
os << "/>" << endl;
os << " <geometry>" << endl;
os << " <box size=\"" << bx - ax << " " << by - ay << " " << bz - az << "\"/>" << endl;
os << " </geometry>" << endl;
}
os << " </collision>" << endl;
}
if ( !!link->inertial ) {
if (!rotate_inertia_frame) {
os << " <inertial>" << endl;
os << " <mass value=\"" << link->inertial->mass << "\" />" << endl;
os << " <origin ";
PRINT_ORIGIN_XML(os, link->inertial->origin);
os << "/>" << endl;
os << " <inertia ixx=\"" << link->inertial->ixx << "\" ";
os << "ixy=\"" << link->inertial->ixy << "\" ";
os << "ixz=\"" << link->inertial->ixz << "\" ";
os << "iyy=\"" << link->inertial->iyy << "\" ";
os << "iyz=\"" << link->inertial->iyz << "\" ";
os << "izz=\"" << link->inertial->izz << "\"/>" << endl;
os << " </inertial>" << endl;
} else {
// rotation should be identity
os << " <inertial>" << endl;
os << " <mass value=\"" << link->inertial->mass << "\" />" << endl;
os << " <origin ";
tf::Quaternion qt (link->inertial->origin.rotation.x,
link->inertial->origin.rotation.y,
link->inertial->origin.rotation.z,
link->inertial->origin.rotation.w);
tf::Matrix3x3 mat (qt);
tf::Matrix3x3 tmat (mat.transpose());
tf::Matrix3x3 imat (link->inertial->ixx, link->inertial->ixy, link->inertial->ixz,
link->inertial->ixy, link->inertial->iyy, link->inertial->iyz,
link->inertial->ixz, link->inertial->iyz, link->inertial->izz);
#define DEBUG_MAT(mat) \
cout << "#2f((" << mat[0][0] << " " << mat[0][1] << " " << mat[0][2] << ")"; \
cout << "(" << mat[1][0] << " " << mat[1][1] << " " << mat[1][2] << ")"; \
cout << "(" << mat[2][0] << " " << mat[2][1] << " " << mat[2][2] << "))" << endl;
#if DEBUG
DEBUG_MAT(mat);
DEBUG_MAT(tmat);
DEBUG_MAT(imat);
#endif
imat = ( mat * imat * tmat );
#if DEBUG
DEBUG_MAT(imat);
#endif
urdf::Pose t_pose (link->inertial->origin);
t_pose.rotation.clear();
PRINT_ORIGIN_XML(os, t_pose);
os << "/>" << endl;
os << " <inertia ixx=\"" << imat[0][0] << "\" ";
os << "ixy=\"" << imat[0][1] << "\" ";
os << "ixz=\"" << imat[0][2] << "\" ";
os << "iyy=\"" << imat[1][1] << "\" ";
os << "iyz=\"" << imat[1][2] << "\" ";
os << "izz=\"" << imat[2][2] << "\"/>" << endl;
os << " </inertial>" << endl;
}
}
os << " </link>" << endl;
#ifdef GAZEBO_1_3
if ( add_gazebo_description ) {
os << " <gazebo reference=\"" << link->name << "\">" << endl;
os << " <mu1>0.9</mu1>" << endl;
os << " <mu2>0.9</mu2>" << endl;
os << " </gazebo>" << endl;
}
#endif
for (std::vector<urdf::LinkSharedPtr >::const_iterator child = link->child_links.begin(); child != link->child_links.end(); child++)
addChildLinkNamesXML(*child, os);
}
void addChildJointNamesXML(urdf::LinkConstSharedPtr link, ofstream& os)
{
double r, p, y;
for (std::vector<urdf::LinkSharedPtr >::const_iterator child = link->child_links.begin(); child != link->child_links.end(); child++){
(*child)->parent_joint->parent_to_joint_origin_transform.rotation.getRPY(r,p,y);
std::string jtype;
if ( (*child)->parent_joint->type == urdf::Joint::UNKNOWN ) {
jtype = std::string("unknown");
} else if ( (*child)->parent_joint->type == urdf::Joint::REVOLUTE ) {
jtype = std::string("revolute");
} else if ( (*child)->parent_joint->type == urdf::Joint::CONTINUOUS ) {
jtype = std::string("continuous");
} else if ( (*child)->parent_joint->type == urdf::Joint::PRISMATIC ) {
jtype = std::string("prismatic");
} else if ( (*child)->parent_joint->type == urdf::Joint::FLOATING ) {
jtype = std::string("floating");
} else if ( (*child)->parent_joint->type == urdf::Joint::PLANAR ) {
jtype = std::string("planar");
} else if ( (*child)->parent_joint->type == urdf::Joint::FIXED ) {
jtype = std::string("fixed");
} else {
///error
}
os << " <joint name=\"" << (*child)->parent_joint->name << "\" type=\"" << jtype << "\">" << endl;
os << " <parent link=\"" << link->name << "\"/>" << endl;
os << " <child link=\"" << (*child)->name << "\"/>" << endl;
os << " <origin xyz=\"" << (*child)->parent_joint->parent_to_joint_origin_transform.position.x << " ";
os << (*child)->parent_joint->parent_to_joint_origin_transform.position.y << " ";
os << (*child)->parent_joint->parent_to_joint_origin_transform.position.z;
os << "\" rpy=\"" << r << " " << p << " " << y << " " << "\"/>" << endl;
os << " <axis xyz=\"" << (*child)->parent_joint->axis.x << " ";
os << (*child)->parent_joint->axis.y << " " << (*child)->parent_joint->axis.z << "\"/>" << endl;
{
urdf::JointSharedPtr jt((*child)->parent_joint);
if ( !!jt->limits ) {
os << " <limit ";
os << "lower=\"" << jt->limits->lower << "\"";
os << " upper=\"" << jt->limits->upper << "\"";
if (jt->limits->effort == 0.0) {
os << " effort=\"100\"";
} else {
os << " effort=\"" << jt->limits->effort << "\"";
}
os << " velocity=\"" << jt->limits->velocity << "\"";
os << " />" << endl;
}
if ( !!jt->dynamics ) {
os << " <dynamics ";
os << "damping=\"" << jt->dynamics->damping << "\"";
os << " friction=\"" << jt->dynamics->friction << "\"";
os << " />" << endl;
} else {
os << " <dynamics ";
os << "damping=\"0.2\"";
os << " friction=\"0\"";
os << " />" << endl;
}
#ifdef GAZEBO_1_3
#if 0
os << " <safety_controller";
os << " k_position=\"10\"";
os << " k_velocity=\"10\"";
os << " soft_lower_limit=\"-10\"";
os << " soft_upper_limit=\"10\"";
os << "/>" << endl;
#endif
#endif
}
os << " </joint>" << endl;
if ( add_gazebo_description ) {
os << " <transmission type=\"pr2_mechanism_model/SimpleTransmission\" name=\"";
os << (*child)->parent_joint->name << "_trans\" >" << endl;
os << " <actuator name=\"" << (*child)->parent_joint->name << "_motor\" />" << endl;
os << " <joint name=\"" << (*child)->parent_joint->name << "\" />" << endl;
os << " <mechanicalReduction>1</mechanicalReduction>" << endl;
//os << " <motorTorqueConstant>1</motorTorqueConstant>" << endl;
//os << " <pulsesPerRevolution>90000</pulsesPerRevolution>" << endl;
os << " </transmission>" << endl;
#ifdef GAZEBO_1_3
os << " <gazebo reference=\"" << (*child)->parent_joint->name << "\">" << endl;
os << " <cfmDamping>0.4</cfmDamping>" << endl;
os << " </gazebo>" << endl;
#endif
}
addChildJointNamesXML(*child, os);
}
}
void printTreeXML(urdf::LinkConstSharedPtr link, string name, string file)
{
std::ofstream os;
os.open(file.c_str());
os << "<?xml version=\"1.0\"?>" << endl;
os << "<robot name=\"" << name << "\"" << endl;
os << " xmlns:xi=\"http://www.w3.org/2001/XInclude\">" << endl;
addChildLinkNamesXML(link, os);
addChildJointNamesXML(link, os);
os << "</robot>" << endl;
os.close();
}
namespace po = boost::program_options;
// using namespace std;
int main(int argc, char** argv)
{
string inputfile;
po::options_description desc("Usage: collada_to_urdf input.dae [options]\n Options for collada_to_urdf");
desc.add_options()
("help", "produce help message")
("simple_visual,V", "use bounding box for visual")
("simple_collision,C", "use bounding box for collision")
("export_collision_mesh", "export collision mesh as STL")
("add_gazebo_description,G", "add description for using on gazebo")
("use_assimp_export,A", "use assimp library for exporting mesh")
("use_collision,U", "use collision geometry (default collision is the same as visual)")
("original_inertia_rotation,R", "does not rotate inertia frame")
("robot_name,N", po::value< vector<string> >(), "output robot name")
("mesh_output_dir", po::value< vector<string> >(), "directory for outputing")
("mesh_prefix", po::value< vector<string> >(), "prefix of mesh files")
("output_file,O", po::value< vector<string> >(), "output file")
("input_file", po::value< vector<string> >(), "input file")
;
po::positional_options_description p;
p.add("input_file", -1);
po::variables_map vm;
try {
po::store(po::command_line_parser(argc, argv).
options(desc).positional(p).run(), vm);
po::notify(vm);
}
catch (po::error e) {
cerr << ";; option parse error / " << e.what() << endl;
return 1;
}
if (vm.count("help")) {
cout << desc << "\n";
return 1;
}
if (vm.count("simple_visual")) {
use_simple_visual = true;
cerr << ";; Using simple_visual" << endl;
}
if (vm.count("simple_collision")) {
use_simple_collision = true;
cerr << ";; Using simple_collision" << endl;
}
if (vm.count("add_gazebo_description")) {
add_gazebo_description = true;
cerr << ";; Adding gazebo description" << endl;
}
if (vm.count("use_assimp_export")) {
#if defined(ASSIMP_EXPORT_API)
use_assimp_export = true;
#endif
cerr << ";; Use assimp export" << endl;
}
if (vm.count("original_inertia_rotation")) {
rotate_inertia_frame = false;
cerr << ";; Does not rotate inertia frame" << endl;
}
if (vm.count("export_collision_mesh")) {
export_collision_mesh = true;
cerr << ";; erxport collision mesh as STL" << endl;
}
if (vm.count("output_file")) {
vector<string> aa = vm["output_file"].as< vector<string> >();
cerr << ";; output file is: "
<< aa[0] << endl;
output_file = aa[0];
}
if (vm.count("robot_name")) {
vector<string> aa = vm["robot_name"].as< vector<string> >();
cerr << ";; robot_name is: "
<< aa[0] << endl;
arobot_name = aa[0];
}
if (vm.count("mesh_prefix")) {
vector<string> aa = vm["mesh_prefix"].as< vector<string> >();
cerr << ";; mesh_prefix is: "
<< aa[0] << endl;
mesh_prefix = aa[0];
}
if (vm.count("mesh_output_dir")) {
vector<string> aa = vm["mesh_output_dir"].as< vector<string> >();
cerr << ";; Mesh output directory is: "
<< aa[0] << endl;
mesh_dir = aa[0];
// check directory existence
boost::filesystem::path mpath( mesh_dir );
try {
if ( ! boost::filesystem::is_directory(mpath) ) {
boost::filesystem::create_directory ( mpath );
}
}
catch ( boost::filesystem::filesystem_error e ) {
cerr << ";; mesh output directory error / " << e.what() << endl;
return 1;
}
}
if (vm.count("input_file")) {
vector<string> aa = vm["input_file"].as< vector<string> >();
cerr << ";; Input file is: "
<< aa[0] << endl;
inputfile = aa[0];
}
if(inputfile == "") {
cerr << desc << endl;
return 1;
}
std::string xml_string;
std::fstream xml_file(inputfile.c_str(), std::fstream::in);
while ( xml_file.good() )
{
std::string line;
std::getline( xml_file, line);
xml_string += (line + "\n");
}
xml_file.close();
urdf::ModelInterfaceSharedPtr robot;
if( xml_string.find("<COLLADA") != std::string::npos )
{
ROS_DEBUG("Parsing robot collada xml string");
robot = parseCollada(xml_string);
}
else
{
ROS_DEBUG("Parsing robot urdf xml string");
robot = parseURDF(xml_string);
}
if (!robot){
std::cerr << "ERROR: Model Parsing the xml failed" << std::endl;
return -1;
}
if (arobot_name == "") {
arobot_name = robot->getName();
}
if (output_file == "") {
output_file = arobot_name + ".urdf";
}
printTreeXML (robot->getRoot(), arobot_name, output_file);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +0,0 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2010, 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:
*
* * Redstributions 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: Tim Field */
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "collada_urdf/collada_urdf.h"
#pragma GCC diagnostic pop
#endif
#include <ros/ros.h>
int main(int argc, char** argv)
{
if (argc != 3) {
std::cerr << "Usage: urdf_to_collada input.urdf output.dae" << std::endl;
return -1;
}
ros::init(argc, argv, "urdf_to_collada");
std::string input_filename(argv[1]);
std::string output_filename(argv[2]);
urdf::Model robot_model;
if( !robot_model.initFile(input_filename) ) {
ROS_ERROR("failed to open urdf file %s", input_filename.c_str());
return -2;
}
collada_urdf::WriteUrdfModelToColladaFile(robot_model, output_filename);
std::cout << std::endl << "Document successfully written to " << output_filename << std::endl;
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
// Copyright (c) 2010, 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 Willow Garage, Inc. 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: Tim Field */
#include "collada_urdf/collada_urdf.h"
#include <gtest/gtest.h>
#include <fstream>
#include <sstream>
#include <string>
TEST(collada_urdf, collada_from_urdf_file_works)
{
urdf::Model robot_model;
ASSERT_TRUE(robot_model.initFile("pr2.urdf"));
ASSERT_TRUE(collada_urdf::WriteUrdfModelToColladaFile(robot_model, "pr2.dae"));
}
TEST(collada_urdf, collada_output_dir_does_not_exist)
{
urdf::Model robot_model;
ASSERT_TRUE(robot_model.initFile("pr2.urdf"));
ASSERT_FALSE(collada_urdf::WriteUrdfModelToColladaFile(robot_model, "a/very/long/directory/path/that/should/not/exist/pr2.dae"));
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}