[urdfdom] 01/04: Imported Upstream version 0.2.10
Jose Luis Rivero
jrivero-guest at moszumanska.debian.org
Thu Jan 9 16:31:01 UTC 2014
This is an automated email from the git hooks/post-receive script.
jrivero-guest pushed a commit to branch master
in repository urdfdom.
commit 66c1b589a1c5ea89dfaeddaa607dc7a71d779fce
Author: Jose Luis Rivero <jrivero at osrfoundation.org>
Date: Thu Jan 9 15:57:49 2014 +0000
Imported Upstream version 0.2.10
---
CMakeLists.txt | 5 ++++-
urdf_parser/CMakeLists.txt | 8 ++++----
urdf_parser/include/urdf_parser/urdf_parser.h | 1 +
urdf_parser/src/link.cpp | 8 ++++----
urdf_parser/src/model.cpp | 22 ++++++++++++++++++++++
xsd/urdf.xsd | 4 ++--
6 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 756c3d3..f89ea96 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ project (urdfdom CXX C)
set (URDF_MAJOR_VERSION 0)
set (URDF_MINOR_VERSION 2)
-set (URDF_PATCH_VERSION 9)
+set (URDF_PATCH_VERSION 10)
set (URDF_VERSION ${URDF_MAJOR_VERSION}.${URDF_MINOR_VERSION}.${URDF_PATCH_VERSION})
@@ -11,6 +11,9 @@ message (STATUS "${PROJECT_NAME} version ${URDF_VERSION}")
include(GNUInstallDirs)
+# hack: by default this would be 'lib/x86_64-linux-gnu'
+set(CMAKE_INSTALL_LIBDIR lib)
+
# set the default build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
diff --git a/urdf_parser/CMakeLists.txt b/urdf_parser/CMakeLists.txt
index cd23331..6caf90a 100644
--- a/urdf_parser/CMakeLists.txt
+++ b/urdf_parser/CMakeLists.txt
@@ -2,19 +2,19 @@ include_directories(include)
add_library(urdfdom_world SHARED src/pose.cpp src/model.cpp src/link.cpp src/joint.cpp src/world.cpp)
target_link_libraries(urdfdom_world ${tinyxml_libraries} ${console_bridge_LIBRARIES} ${Boost_LIBRARIES})
-set_target_properties(urdfdom_world PROPERTIES SOVERSION 0.2)
+#set_target_properties(urdfdom_world PROPERTIES SOVERSION 0.2)
add_library(urdfdom_model SHARED src/pose.cpp src/model.cpp src/link.cpp src/joint.cpp)
target_link_libraries(urdfdom_model ${tinyxml_libraries} ${console_bridge_LIBRARIES} ${Boost_LIBRARIES})
-set_target_properties(urdfdom_model PROPERTIES SOVERSION 0.2)
+#set_target_properties(urdfdom_model PROPERTIES SOVERSION 0.2)
add_library(urdfdom_sensor SHARED src/urdf_sensor.cpp)
target_link_libraries(urdfdom_sensor urdfdom_model ${tinyxml_libraries} ${console_bridge_LIBRARIES} ${Boost_LIBRARIES})
-set_target_properties(urdfdom_sensor PROPERTIES SOVERSION 0.2)
+#set_target_properties(urdfdom_sensor PROPERTIES SOVERSION 0.2)
add_library(urdfdom_model_state SHARED src/urdf_model_state.cpp src/twist.cpp)
target_link_libraries(urdfdom_model_state ${tinyxml_libraries} ${console_bridge_LIBRARIES} ${Boost_LIBRARIES})
-set_target_properties(urdfdom_model_state PROPERTIES SOVERSION 0.2)
+#set_target_properties(urdfdom_model_state PROPERTIES SOVERSION 0.2)
# --------------------------------
diff --git a/urdf_parser/include/urdf_parser/urdf_parser.h b/urdf_parser/include/urdf_parser/urdf_parser.h
index ad9db78..34d044b 100644
--- a/urdf_parser/include/urdf_parser/urdf_parser.h
+++ b/urdf_parser/include/urdf_parser/urdf_parser.h
@@ -59,6 +59,7 @@ URDFDOM_DLLAPI std::string values2str(double d);
namespace urdf{
URDFDOM_DLLAPI boost::shared_ptr<ModelInterface> parseURDF(const std::string &xml_string);
+ URDFDOM_DLLAPI boost::shared_ptr<ModelInterface> parseURDFFile(const std::string &path);
URDFDOM_DLLAPI TiXmlDocument* exportURDF(boost::shared_ptr<ModelInterface> &model);
URDFDOM_DLLAPI TiXmlDocument* exportURDF(const ModelInterface &model);
URDFDOM_DLLAPI bool parsePose(Pose&, TiXmlElement*);
diff --git a/urdf_parser/src/link.cpp b/urdf_parser/src/link.cpp
index f6ff67c..b69824a 100644
--- a/urdf_parser/src/link.cpp
+++ b/urdf_parser/src/link.cpp
@@ -682,10 +682,10 @@ bool exportLink(Link &link, TiXmlElement* xml)
if (link.inertial)
exportInertial(*link.inertial, link_xml);
- if (link.visual)
- exportVisual(*link.visual, link_xml);
- if (link.collision)
- exportCollision(*link.collision, link_xml);
+ for (std::size_t i = 0 ; i < link.visual_array.size() ; ++i)
+ exportVisual(*link.visual_array[i], link_xml);
+ for (std::size_t i = 0 ; i < link.collision_array.size() ; ++i)
+ exportCollision(*link.collision_array[i], link_xml);
xml->LinkEndChild(link_xml);
diff --git a/urdf_parser/src/model.cpp b/urdf_parser/src/model.cpp
index 2b1b65b..fc7bd72 100644
--- a/urdf_parser/src/model.cpp
+++ b/urdf_parser/src/model.cpp
@@ -38,6 +38,7 @@
#include <vector>
#include "urdf_parser/urdf_parser.h"
#include <console_bridge/console.h>
+#include <fstream>
namespace urdf{
@@ -45,6 +46,20 @@ bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_o
bool parseLink(Link &link, TiXmlElement *config);
bool parseJoint(Joint &joint, TiXmlElement *config);
+boost::shared_ptr<ModelInterface> parseURDFFile(const std::string &path)
+{
+ std::ifstream stream( path.c_str() );
+ if (!stream)
+ {
+ logError(("File " + path + " does not exist").c_str());
+ return boost::shared_ptr<ModelInterface>();
+ }
+
+ std::string xml_str((std::istreambuf_iterator<char>(stream)),
+ std::istreambuf_iterator<char>());
+ return urdf::parseURDF( xml_str );
+}
+
boost::shared_ptr<ModelInterface> parseURDF(const std::string &xml_string)
{
boost::shared_ptr<ModelInterface> model(new ModelInterface);
@@ -52,6 +67,13 @@ boost::shared_ptr<ModelInterface> parseURDF(const std::string &xml_string)
TiXmlDocument xml_doc;
xml_doc.Parse(xml_string.c_str());
+ if (xml_doc.Error())
+ {
+ logError(xml_doc.ErrorDesc());
+ xml_doc.ClearError();
+ model.reset();
+ return model;
+ }
TiXmlElement *robot_xml = xml_doc.FirstChildElement("robot");
if (!robot_xml)
diff --git a/xsd/urdf.xsd b/xsd/urdf.xsd
index 9e3a857..ccebfb2 100644
--- a/xsd/urdf.xsd
+++ b/xsd/urdf.xsd
@@ -152,9 +152,9 @@
<xs:element name="inertial"
type="inertial" minOccurs="0" maxOccurs="1" />
<xs:element name="visual"
- type="visual" minOccurs="0" maxOccurs="1" />
+ type="visual" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="collision"
- type="collision" minOccurs="0" maxOccurs="1" />
+ type="collision" minOccurs="0" maxOccurs="unbounded" />
</xs:all>
<xs:attribute name="name" type="xs:string" use="required" />
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/urdfdom.git
More information about the debian-science-commits
mailing list