From 31cb02945e9ac1823c367ed600ce4d8c535b470a Mon Sep 17 00:00:00 2001 From: Rich Mattes Date: Sep 28 2014 20:23:15 +0000 Subject: Merge branch 'master' into epel7 --- diff --git a/.gitignore b/.gitignore index be4664f..e2e5e72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /sdformat_1.4.10.tar.bz2 /sdformat_1.4.11.tar.bz2 +/sdformat_2.0.0.tar.bz2 +/sdformat2_2.0.1.tar.bz2 diff --git a/sdformat-1.4.10-urdfdom.patch b/sdformat-1.4.10-urdfdom.patch deleted file mode 100644 index 4f8cd8f..0000000 --- a/sdformat-1.4.10-urdfdom.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff -up ./cmake/SearchForStuff.cmake.urdfdom ./cmake/SearchForStuff.cmake ---- ./cmake/SearchForStuff.cmake.urdfdom 2013-11-08 18:54:46.000000000 -0500 -+++ ./cmake/SearchForStuff.cmake 2013-11-18 20:58:38.478461983 -0500 -@@ -24,3 +24,28 @@ else () - "tinyxml include paths. Use this to override automatic detection.") - set (tinyxml_libraries "tinyxml" CACHE INTERNAL "tinyxml libraries") - endif () -+ -+################################################ -+# Find urdfdom parser -+pkg_check_modules(URDF urdfdom) -+if (NOT URDF_FOUND) -+ set(HAVE_URDF OFF) -+else() -+ set (HAVE_URDF ON) -+endif() -+ -+################################################ -+# Find gtest -+find_package(GTest) -+if (GTEST_FOUND) -+ set(GTEST_LIBRARY ${GTEST_LIBRARIES}) -+ set(GTEST_MAIN_LIBRARY ${GTEST_MAIN_LIBRARIES}) -+ set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE_DIRS}) -+else() -+ add_library(gtest STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest-all.cc") -+ add_library(gtest_main STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest_main.cc") -+ target_link_libraries(gtest_main gtest) -+ set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a") -+ set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a") -+ set(GTEST_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/test/gtest/include") -+endif() -diff -up ./src/CMakeLists.txt.urdfdom ./src/CMakeLists.txt ---- ./src/CMakeLists.txt.urdfdom 2013-11-08 18:54:46.000000000 -0500 -+++ ./src/CMakeLists.txt 2013-11-18 20:49:03.148208553 -0500 -@@ -15,6 +15,13 @@ set (sources - parser_urdf.cc - Param.cc - SDF.cc -+) -+ -+if (HAVE_URDF) -+ include_directories(${URDF_INCLUDE_DIRS}) -+else(HAVE_URDF) -+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/urdf) -+ set(sources ${sources} - urdf/urdf_parser/model.cpp - urdf/urdf_parser/link.cpp - urdf/urdf_parser/joint.cpp -@@ -24,6 +31,7 @@ set (sources - urdf/urdf_parser/urdf_sensor.cpp - urdf/urdf_parser/world.cpp - ) -+endif(HAVE_URDF) - - set (gtest_sources - SDF_TEST.cc -@@ -38,4 +46,10 @@ target_link_libraries(sdformat - ${tinyxml_libraries} - ${Boost_LIBRARIES} - ) -+if (HAVE_URDF) -+ target_link_libraries(sdformat -+ ${URDF_LIBRARIES} -+ ) -+endif(HAVE_URDF) -+ - sdf_install_library(sdformat) diff --git a/sdformat-2.0.0-urdf3.patch b/sdformat-2.0.0-urdf3.patch new file mode 100644 index 0000000..c60f796 --- /dev/null +++ b/sdformat-2.0.0-urdf3.patch @@ -0,0 +1,299 @@ +diff -up ./src/parser_urdf.cc.urdf3 ./src/parser_urdf.cc +--- ./src/parser_urdf.cc.urdf3 2014-04-11 14:42:48.000000000 -0400 ++++ ./src/parser_urdf.cc 2014-05-26 14:31:34.251525903 -0400 +@@ -28,6 +28,8 @@ + + using namespace sdf; + ++#undef USE_EXTERNAL_URDF ++ + typedef boost::shared_ptr UrdfCollisionPtr; + typedef boost::shared_ptr UrdfVisualPtr; + typedef boost::shared_ptr UrdfLinkPtr; +@@ -298,7 +300,12 @@ std::string Vector32Str(const urdf::Vect + + //////////////////////////////////////////////////////////////////////////////// + void ReduceCollisionToParent(UrdfLinkPtr _link, +- const std::string &_groupName, UrdfCollisionPtr _collision) ++#if USE_EXTERNAL_URDF ++ const std::string &_groupName, ++#else ++ const std::string &/*_groupName*/, ++#endif ++ UrdfCollisionPtr _collision) + { + boost::shared_ptr > cols; + #if USE_EXTERNAL_URDF +@@ -312,9 +319,6 @@ void ReduceCollisionToParent(UrdfLinkPtr + cols = boost::shared_ptr >( + &_link->collision_array); + } +-#else +- cols = _link->getCollisions(_groupName); +-#endif + + if (!cols) + { +@@ -323,22 +327,37 @@ void ReduceCollisionToParent(UrdfLinkPtr + // new group name, create add vector to map and add Collision to the vector + _link->collision_groups.insert(make_pair(_groupName, cols)); + } ++#else ++ cols = boost::shared_ptr >( ++ &_link->collision_array); ++#endif + +- // group exists, add Collision to the vector in the map ++ // add Collision to the vector of collisions in link + std::vector::iterator colIt = + find(cols->begin(), cols->end(), _collision); ++ + if (colIt != cols->end()) + sdfwarn << "attempted to add collision to link [" + << _link->name ++#if USE_EXTERNAL_URDF + << "], but it already exists under group [" + << _groupName << "]\n"; ++#else ++ << "], but it already exists in link\n"; ++#endif ++ + else + cols->push_back(_collision); + } + + //////////////////////////////////////////////////////////////////////////////// + void ReduceVisualToParent(UrdfLinkPtr _link, +- const std::string &_groupName, UrdfVisualPtr _visual) ++#if USE_EXTERNAL_URDF ++ const std::string &_groupName, ++#else ++ const std::string &/*_groupName*/, ++#endif ++ UrdfVisualPtr _visual) + { + boost::shared_ptr > viss; + #if USE_EXTERNAL_URDF +@@ -351,9 +370,6 @@ void ReduceVisualToParent(UrdfLinkPtr _l + { + viss = boost::shared_ptr >(&_link->visual_array); + } +-#else +- viss = _link->getVisuals(_groupName); +-#endif + + if (!viss) + { +@@ -365,15 +381,23 @@ void ReduceVisualToParent(UrdfLinkPtr _l + sdfdbg << "successfully added a new visual group name [" + << _groupName << "]\n"; + } ++#else ++ viss = boost::shared_ptr >(&_link->visual_array); ++#endif + + // group exists, add Visual to the vector in the map if it's not there + std::vector::iterator visIt + = find(viss->begin(), viss->end(), _visual); ++ + if (visIt != viss->end()) + sdfwarn << "attempted to add visual to link [" + << _link->name ++#if USE_EXTERNAL_URDF + << "], but it already exists under group [" + << _groupName << "]\n"; ++#else ++ << "], but it already exists in link.\n"; ++#endif + else + viss->push_back(_visual); + } +@@ -844,6 +868,7 @@ void ReduceVisualsToParent(UrdfLinkPtr _ + // "lump::"+group name+"::'+_link name + // lump but keep the _link name in(/as) the group name, + // so we can correlate visuals to visuals somehow. ++#if USE_EXTERNAL_URDF + for (std::map > >::iterator + visualsIt = _link->visual_groups.begin(); +@@ -888,6 +913,21 @@ void ReduceVisualsToParent(UrdfLinkPtr _ + } + } + } ++#else ++ std::string lumpGroupName = std::string("lump::")+_link->name; ++ for (std::vector::iterator ++ visualIt = _link->visual_array.begin(); ++ visualIt != _link->visual_array.end(); ++visualIt) ++ { ++ // transform visual origin from _link frame to ++ // parent link frame before adding to parent ++ (*visualIt)->origin = TransformToParentFrame((*visualIt)->origin, ++ _link->parent_joint->parent_to_joint_origin_transform); ++ // add the modified visual to parent ++ ReduceVisualToParent(_link->getParent(), lumpGroupName, ++ *visualIt); ++ } ++#endif + } + + ///////////////////////////////////////////////// +@@ -899,6 +939,7 @@ void ReduceCollisionsToParent(UrdfLinkPt + // "lump::"+group name+"::'+_link name + // lump but keep the _link name in(/as) the group name, + // so we can correlate visuals to collisions somehow. ++#if USE_EXTERNAL_URDF + for (std::map > >::iterator + collisionsIt = _link->collision_groups.begin(); +@@ -951,6 +992,23 @@ void ReduceCollisionsToParent(UrdfLinkPt + } + } + // this->PrintCollisionGroups(_link->getParent()); ++#else ++ std::string lumpGroupName = std::string("lump::")+_link->name; ++ for (std::vector::iterator ++ collisionIt = _link->collision_array.begin(); ++ collisionIt != _link->collision_array.end(); ++collisionIt) ++ { ++ // transform collision origin from _link frame to ++ // parent link frame before adding to parent ++ (*collisionIt)->origin = TransformToParentFrame( ++ (*collisionIt)->origin, ++ _link->parent_joint->parent_to_joint_origin_transform); ++ ++ // add the modified collision to parent ++ ReduceCollisionToParent(_link->getParent(), lumpGroupName, ++ *collisionIt); ++ } ++#endif + } + + ///////////////////////////////////////////////// +@@ -1161,8 +1219,21 @@ void URDF2SDF::ParseSDFExtension(TiXmlDo + { + sdf->material = GetKeyValueAsString(childElem); + } +- else if (childElem->ValueStr() == "visual") ++ else if (0 && childElem->ValueStr() == "visual") + { ++ // anything inside of visual tags: ++ // ++ // ++ // ++ // ++ // ++ // are treated as blobs that gets inserted ++ // into visuals for the link ++ // ++ // ++ // ++ // ++ + // a place to store converted doc + for (TiXmlElement* e = childElem->FirstChildElement(); e; + e = e->NextSiblingElement()) +@@ -1826,6 +1897,7 @@ std::string GetGeometryBoundingBox( + //////////////////////////////////////////////////////////////////////////////// + void PrintCollisionGroups(UrdfLinkPtr _link) + { ++#if USE_EXTERNAL_URDF + sdfdbg << "COLLISION LUMPING: link: [" << _link->name << "] contains [" + << static_cast(_link->collision_groups.size()) + << "] collisions.\n"; +@@ -1838,6 +1910,11 @@ void PrintCollisionGroups(UrdfLinkPtr _l + << static_cast(colsIt->second->size()) + << "] Collision objects\n"; + } ++#else ++ sdfdbg << "COLLISION LUMPING: link: [" << _link->name << "] contains [" ++ << static_cast(_link->collision_array.size()) ++ << "] collisions.\n"; ++#endif + } + + //////////////////////////////////////////////////////////////////////////////// +@@ -2211,6 +2288,7 @@ void CreateCollisions(TiXmlElement* _ele + { + // loop through all collision groups. as well as additional collision from + // lumped meshes (fixed joint reduction) ++#if USE_EXTERNAL_URDF + for (std::map > >::const_iterator + collisionsIt = _link->collision_groups.begin(); +@@ -2287,6 +2365,33 @@ void CreateCollisions(TiXmlElement* _ele + } + } + } ++#else ++ unsigned int defaultMeshCount = 0; ++ for (std::vector::const_iterator ++ collision = _link->collision_array.begin(); ++ collision != _link->collision_array.end(); ++ ++collision) ++ { ++ sdfdbg << "creating default collision for link [" << _link->name ++ << "]"; ++ ++ std::string collisionPrefix = _link->name; ++ ++ if (defaultMeshCount > 0) ++ { ++ // append _[meshCount] to link name for additional collisions ++ std::ostringstream collisionNameStream; ++ collisionNameStream << collisionPrefix << "_" << defaultMeshCount; ++ collisionPrefix = collisionNameStream.str(); ++ } ++ ++ /* make a block */ ++ CreateCollision(_elem, _link, *collision, collisionPrefix); ++ ++ // only 1 default mesh ++ ++defaultMeshCount; ++ } ++#endif + } + + //////////////////////////////////////////////////////////////////////////////// +@@ -2295,6 +2400,7 @@ void CreateVisuals(TiXmlElement* _elem, + { + // loop through all visual groups. as well as additional visuals from + // lumped meshes (fixed joint reduction) ++#if USE_EXTERNAL_URDF + for (std::map > >::const_iterator + visualsIt = _link->visual_groups.begin(); +@@ -2371,6 +2477,33 @@ void CreateVisuals(TiXmlElement* _elem, + } + } + } ++#else ++ unsigned int defaultMeshCount = 0; ++ for (std::vector::const_iterator ++ visual = _link->visual_array.begin(); ++ visual != _link->visual_array.end(); ++ ++visual) ++ { ++ sdfdbg << "creating default visual for link [" << _link->name ++ << "]"; ++ ++ std::string visualPrefix = _link->name; ++ ++ if (defaultMeshCount > 0) ++ { ++ // append _[meshCount] to _link name for additional visuals ++ std::ostringstream visualNameStream; ++ visualNameStream << visualPrefix << "_" << defaultMeshCount; ++ visualPrefix = visualNameStream.str(); ++ } ++ ++ // create a block ++ CreateVisual(_elem, _link, *visual, visualPrefix); ++ ++ // only 1 default mesh ++ ++defaultMeshCount; ++ } ++#endif + } + + //////////////////////////////////////////////////////////////////////////////// diff --git a/sdformat-2.0.0-urdfdom.patch b/sdformat-2.0.0-urdfdom.patch new file mode 100644 index 0000000..b030c89 --- /dev/null +++ b/sdformat-2.0.0-urdfdom.patch @@ -0,0 +1,27 @@ +diff -up ./cmake/SearchForStuff.cmake.urdfdom ./cmake/SearchForStuff.cmake +--- ./cmake/SearchForStuff.cmake.urdfdom 2014-04-16 21:49:40.269514105 -0400 ++++ ./cmake/SearchForStuff.cmake 2014-04-16 21:50:31.687724816 -0400 +@@ -50,6 +50,22 @@ if (USE_EXTERNAL_URDF) + endif() + endif() + ++################################################ ++# Find gtest ++find_package(GTest) ++if (GTEST_FOUND) ++ set(GTEST_LIBRARY ${GTEST_LIBRARIES}) ++ set(GTEST_MAIN_LIBRARY ${GTEST_MAIN_LIBRARIES}) ++ set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE_DIRS}) ++else() ++ add_library(gtest STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest-all.cc") ++ add_library(gtest_main STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest_main.cc") ++ target_link_libraries(gtest_main gtest) ++ set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a") ++ set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a") ++ set(GTEST_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/test/gtest/include") ++endif() ++ + ################################################# + # Macro to check for visibility capability in compiler + # Original idea from: https://gitorious.org/ferric-cmake-stuff/ +diff -up ./src/CMakeLists.txt.urdfdom ./src/CMakeLists.txt diff --git a/sdformat-2.0.1-urdf3.patch b/sdformat-2.0.1-urdf3.patch new file mode 100644 index 0000000..c3b993c --- /dev/null +++ b/sdformat-2.0.1-urdf3.patch @@ -0,0 +1,443 @@ +diff -r d79259b26096 src/parser_urdf.cc +--- a/src/parser_urdf.cc Mon Aug 04 13:07:16 2014 -0700 ++++ b/src/parser_urdf.cc Sat Aug 23 14:30:18 2014 -0400 +@@ -297,85 +297,15 @@ + } + + //////////////////////////////////////////////////////////////////////////////// +-void ReduceCollisionToParent(UrdfLinkPtr _link, +- const std::string &_groupName, UrdfCollisionPtr _collision) ++void ReduceCollisionToParent(UrdfLinkPtr _link, UrdfCollisionPtr _collision) + { +- boost::shared_ptr > cols; +-#if USE_EXTERNAL_URDF && defined(URDF_GE_0P3) +- if (_link->collision) +- { +- cols.reset(new std::vector); +- cols->push_back(_link->collision); +- } +- else +- { +- cols = boost::shared_ptr >( +- &_link->collision_array); +- } +-#else +- cols = _link->getCollisions(_groupName); +-#endif +- +- if (!cols) +- { +- // group does not exist, create one and add to map +- cols.reset(new std::vector); +- // new group name, create add vector to map and add Collision to the vector +- _link->collision_groups.insert(make_pair(_groupName, cols)); +- } +- +- // group exists, add Collision to the vector in the map +- std::vector::iterator colIt = +- find(cols->begin(), cols->end(), _collision); +- if (colIt != cols->end()) +- sdfwarn << "attempted to add collision to link [" +- << _link->name +- << "], but it already exists under group [" +- << _groupName << "]\n"; +- else +- cols->push_back(_collision); ++ _link->collision_array.push_back(_collision); + } + + //////////////////////////////////////////////////////////////////////////////// +-void ReduceVisualToParent(UrdfLinkPtr _link, +- const std::string &_groupName, UrdfVisualPtr _visual) ++void ReduceVisualToParent(UrdfLinkPtr _link, UrdfVisualPtr _visual) + { +- boost::shared_ptr > viss; +-#if USE_EXTERNAL_URDF && defined(URDF_GE_0P3) +- if (_link->visual) +- { +- viss.reset(new std::vector); +- viss->push_back(_link->visual); +- } +- else +- { +- viss = boost::shared_ptr >(&_link->visual_array); +- } +-#else +- viss = _link->getVisuals(_groupName); +-#endif +- +- if (!viss) +- { +- // group does not exist, create one and add to map +- viss.reset(new std::vector); +- // new group name, create vector, add vector to map and +- // add Visual to the vector +- _link->visual_groups.insert(make_pair(_groupName, viss)); +- sdfdbg << "successfully added a new visual group name [" +- << _groupName << "]\n"; +- } +- +- // group exists, add Visual to the vector in the map if it's not there +- std::vector::iterator visIt +- = find(viss->begin(), viss->end(), _visual); +- if (visIt != viss->end()) +- sdfwarn << "attempted to add visual to link [" +- << _link->name +- << "], but it already exists under group [" +- << _groupName << "]\n"; +- else +- viss->push_back(_visual); ++ _link->visual_array.push_back(_visual); + } + + //////////////////////////////////////////////////////////////////////////////// +@@ -839,54 +769,17 @@ + /// reduce fixed joints: lump visuals to parent link + void ReduceVisualsToParent(UrdfLinkPtr _link) + { +- // lump visual to parent +- // lump all visual to parent, assign group name +- // "lump::"+group name+"::'+_link name +- // lump but keep the _link name in(/as) the group name, +- // so we can correlate visuals to visuals somehow. +- for (std::map > >::iterator +- visualsIt = _link->visual_groups.begin(); +- visualsIt != _link->visual_groups.end(); ++visualsIt) ++ for (std::vector::iterator ++ visualIt = _link->visual_array.begin(); ++ visualIt != _link->visual_array.end(); ++visualIt) + { +- if (visualsIt->first.find(std::string("lump::")) == 0) +- { +- // it's a previously lumped mesh, re-lump under same _groupName +- std::string lumpGroupName = visualsIt->first; +- sdfdbg << "re-lumping group name [" << lumpGroupName +- << "] to link [" << _link->getParent()->name << "]\n"; +- for (std::vector::iterator +- visualIt = visualsIt->second->begin(); +- visualIt != visualsIt->second->end(); ++visualIt) +- { +- // transform visual origin from _link frame to parent link +- // frame before adding to parent +- (*visualIt)->origin = TransformToParentFrame((*visualIt)->origin, +- _link->parent_joint->parent_to_joint_origin_transform); +- // add the modified visual to parent +- ReduceVisualToParent(_link->getParent(), lumpGroupName, +- *visualIt); +- } +- } +- else +- { +- // default and any other groups meshes +- std::string lumpGroupName = std::string("lump::")+_link->name; +- sdfdbg << "adding modified lump group name [" << lumpGroupName +- << "] to link [" << _link->getParent()->name << "].\n"; +- for (std::vector::iterator +- visualIt = visualsIt->second->begin(); +- visualIt != visualsIt->second->end(); ++visualIt) +- { +- // transform visual origin from _link frame to +- // parent link frame before adding to parent +- (*visualIt)->origin = TransformToParentFrame((*visualIt)->origin, +- _link->parent_joint->parent_to_joint_origin_transform); +- // add the modified visual to parent +- ReduceVisualToParent(_link->getParent(), lumpGroupName, +- *visualIt); +- } +- } ++ // transform visual origin from _link frame to parent link ++ // frame before adding to parent ++ (*visualIt)->origin = TransformToParentFrame((*visualIt)->origin, ++ _link->parent_joint->parent_to_joint_origin_transform); ++ // add the modified visual to parent ++ // ReduceVisualToParent(_link->getParent(), *visualIt); ++ _link->getParent()->visual_array.push_back(*visualIt); + } + } + +@@ -894,63 +787,19 @@ + /// reduce fixed joints: lump collisions to parent link + void ReduceCollisionsToParent(UrdfLinkPtr _link) + { +- // lump collision parent +- // lump all collision to parent, assign group name +- // "lump::"+group name+"::'+_link name +- // lump but keep the _link name in(/as) the group name, +- // so we can correlate visuals to collisions somehow. +- for (std::map > >::iterator +- collisionsIt = _link->collision_groups.begin(); +- collisionsIt != _link->collision_groups.end(); ++collisionsIt) ++ for (std::vector::iterator ++ collisionIt = _link->collision_array.begin(); ++ collisionIt != _link->collision_array.end(); ++collisionIt) + { +- if (collisionsIt->first.find(std::string("lump::")) == 0) +- { +- // if it's a previously lumped mesh, relump under same _groupName +- std::string lumpGroupName = collisionsIt->first; +- sdfdbg << "re-lumping collision [" << collisionsIt->first +- << "] for link [" << _link->name +- << "] to parent [" << _link->getParent()->name +- << "] with group name [" << lumpGroupName << "]\n"; +- for (std::vector::iterator +- collisionIt = collisionsIt->second->begin(); +- collisionIt != collisionsIt->second->end(); ++collisionIt) +- { +- // transform collision origin from _link frame to +- // parent link frame before adding to parent +- (*collisionIt)->origin = TransformToParentFrame( +- (*collisionIt)->origin, +- _link->parent_joint->parent_to_joint_origin_transform); +- // add the modified collision to parent +- ReduceCollisionToParent(_link->getParent(), lumpGroupName, +- *collisionIt); +- } +- } +- else +- { +- // default and any other group meshes +- std::string lumpGroupName = std::string("lump::")+_link->name; +- sdfdbg << "lumping collision [" << collisionsIt->first +- << "] for link [" << _link->name +- << "] to parent [" << _link->getParent()->name +- << "] with group name [" << lumpGroupName << "]\n"; +- for (std::vector::iterator +- collisionIt = collisionsIt->second->begin(); +- collisionIt != collisionsIt->second->end(); ++collisionIt) +- { +- // transform collision origin from _link frame to +- // parent link frame before adding to parent +- (*collisionIt)->origin = TransformToParentFrame( +- (*collisionIt)->origin, +- _link->parent_joint->parent_to_joint_origin_transform); +- +- // add the modified collision to parent +- ReduceCollisionToParent(_link->getParent(), lumpGroupName, +- *collisionIt); +- } +- } ++ // transform collision origin from _link frame to ++ // parent link frame before adding to parent ++ (*collisionIt)->origin = TransformToParentFrame( ++ (*collisionIt)->origin, ++ _link->parent_joint->parent_to_joint_origin_transform); ++ // add the modified collision to parent ++ // ReduceCollisionToParent(_link->getParent(), *collisionIt); ++ _link->getParent()->collision_array.push_back(*collisionIt); + } +- // this->PrintCollisionGroups(_link->getParent()); + } + + ///////////////////////////////////////////////// +@@ -1827,17 +1676,8 @@ + void PrintCollisionGroups(UrdfLinkPtr _link) + { + sdfdbg << "COLLISION LUMPING: link: [" << _link->name << "] contains [" +- << static_cast(_link->collision_groups.size()) ++ << static_cast(_link->collision_array.size()) + << "] collisions.\n"; +- for (std::map > >::iterator +- colsIt = _link->collision_groups.begin(); +- colsIt != _link->collision_groups.end(); ++colsIt) +- { +- sdfdbg << " collision_groups: [" << colsIt->first << "] has [" +- << static_cast(colsIt->second->size()) +- << "] Collision objects\n"; +- } + } + + //////////////////////////////////////////////////////////////////////////////// +@@ -2206,86 +2046,21 @@ + } + + //////////////////////////////////////////////////////////////////////////////// +-void CreateCollisions(TiXmlElement* _elem, +- ConstUrdfLinkPtr _link) ++void CreateCollisions(TiXmlElement* _elem, ConstUrdfLinkPtr _link) + { +- // loop through all collision groups. as well as additional collision from +- // lumped meshes (fixed joint reduction) +- for (std::map > >::const_iterator +- collisionsIt = _link->collision_groups.begin(); +- collisionsIt != _link->collision_groups.end(); ++collisionsIt) ++ // loop through collisions ++ for (std::vector::const_iterator ++ collision = _link->collision_array.begin(); ++ collision != _link->collision_array.end(); ++ ++collision) + { +- unsigned int defaultMeshCount = 0; +- unsigned int groupMeshCount = 0; +- unsigned int lumpMeshCount = 0; +- // loop through collisions in each group +- for (std::vector::iterator +- collision = collisionsIt->second->begin(); +- collision != collisionsIt->second->end(); +- ++collision) +- { +- if (collisionsIt->first == "default") +- { +- sdfdbg << "creating default collision for link [" << _link->name +- << "]"; ++ sdfdbg << "creating default collision for link [" << _link->name ++ << "]"; + +- std::string collisionPrefix = _link->name; ++ std::string collisionPrefix = _link->name + (*collision)->name; + +- if (defaultMeshCount > 0) +- { +- // append _[meshCount] to link name for additional collisions +- std::ostringstream collisionNameStream; +- collisionNameStream << collisionPrefix << "_" << defaultMeshCount; +- collisionPrefix = collisionNameStream.str(); +- } +- +- /* make a block */ +- CreateCollision(_elem, _link, *collision, collisionPrefix); +- +- // only 1 default mesh +- ++defaultMeshCount; +- } +- else if (collisionsIt->first.find(std::string("lump::")) == 0) +- { +- // if collision name starts with "lump::", pass through +- // original parent link name +- sdfdbg << "creating lump collision [" << collisionsIt->first +- << "] for link [" << _link->name << "].\n"; +- /// collisionPrefix is the original name before lumping +- std::string collisionPrefix = collisionsIt->first.substr(6); +- +- if (lumpMeshCount > 0) +- { +- // append _[meshCount] to link name for additional collisions +- std::ostringstream collisionNameStream; +- collisionNameStream << collisionPrefix << "_" << lumpMeshCount; +- collisionPrefix = collisionNameStream.str(); +- } +- +- CreateCollision(_elem, _link, *collision, collisionPrefix); +- ++lumpMeshCount; +- } +- else +- { +- sdfdbg << "adding collisions from collision group [" +- << collisionsIt->first << "]\n"; +- +- std::string collisionPrefix = _link->name + std::string("_") + +- collisionsIt->first; +- +- if (groupMeshCount > 0) +- { +- // append _[meshCount] to _link name for additional collisions +- std::ostringstream collisionNameStream; +- collisionNameStream << collisionPrefix << "_" << groupMeshCount; +- collisionPrefix = collisionNameStream.str(); +- } +- +- CreateCollision(_elem, _link, *collision, collisionPrefix); +- ++groupMeshCount; +- } +- } ++ /* make a block */ ++ CreateCollision(_elem, _link, *collision, collisionPrefix); + } + } + +@@ -2293,83 +2068,18 @@ + void CreateVisuals(TiXmlElement* _elem, + ConstUrdfLinkPtr _link) + { +- // loop through all visual groups. as well as additional visuals from +- // lumped meshes (fixed joint reduction) +- for (std::map > >::const_iterator +- visualsIt = _link->visual_groups.begin(); +- visualsIt != _link->visual_groups.end(); ++visualsIt) ++ // loop through visuals ++ for (std::vector::const_iterator ++ visual = _link->visual_array.begin(); ++ visual != _link->visual_array.end(); ++visual) + { +- unsigned int defaultMeshCount = 0; +- unsigned int groupMeshCount = 0; +- unsigned int lumpMeshCount = 0; +- // loop through all visuals in this group +- for (std::vector::iterator +- visual = visualsIt->second->begin(); +- visual != visualsIt->second->end(); +- ++visual) +- { +- if (visualsIt->first == "default") +- { +- sdfdbg << "creating default visual for link [" << _link->name +- << "]"; ++ sdfdbg << "creating default visual for link [" << _link->name ++ << "]"; + +- std::string visualPrefix = _link->name; ++ std::string visualPrefix = _link->name + (*visual)->name; + +- if (defaultMeshCount > 0) +- { +- // append _[meshCount] to _link name for additional visuals +- std::ostringstream visualNameStream; +- visualNameStream << visualPrefix << "_" << defaultMeshCount; +- visualPrefix = visualNameStream.str(); +- } +- +- // create a block +- CreateVisual(_elem, _link, *visual, visualPrefix); +- +- // only 1 default mesh +- ++defaultMeshCount; +- } +- else if (visualsIt->first.find(std::string("lump::")) == 0) +- { +- // if visual name starts with "lump::", pass through +- // original parent link name +- sdfdbg << "creating lump visual [" << visualsIt->first +- << "] for link [" << _link->name << "].\n"; +- /// visualPrefix is the original name before lumping +- std::string visualPrefix = visualsIt->first.substr(6); +- +- if (lumpMeshCount > 0) +- { +- // append _[meshCount] to _link name for additional visuals +- std::ostringstream visualNameStream; +- visualNameStream << visualPrefix << "_" << lumpMeshCount; +- visualPrefix = visualNameStream.str(); +- } +- +- CreateVisual(_elem, _link, *visual, visualPrefix); +- ++lumpMeshCount; +- } +- else +- { +- sdfdbg << "adding visuals from visual group [" +- << visualsIt->first << "]\n"; +- +- std::string visualPrefix = _link->name + std::string("_") + +- visualsIt->first; +- +- if (groupMeshCount > 0) +- { +- // append _[meshCount] to _link name for additional visuals +- std::ostringstream visualNameStream; +- visualNameStream << visualPrefix << "_" << groupMeshCount; +- visualPrefix = visualNameStream.str(); +- } +- +- CreateVisual(_elem, _link, *visual, visualPrefix); +- ++groupMeshCount; +- } +- } ++ // create a block ++ CreateVisual(_elem, _link, *visual, visualPrefix); + } + } + diff --git a/sdformat-2.0.1-urdfdom.patch b/sdformat-2.0.1-urdfdom.patch new file mode 100644 index 0000000..9af36d9 --- /dev/null +++ b/sdformat-2.0.1-urdfdom.patch @@ -0,0 +1,44 @@ +diff -up ./cmake/sdf_config.h.in.urdfdom ./cmake/sdf_config.h.in +--- ./cmake/sdf_config.h.in.urdfdom 2014-08-22 21:07:12.473338538 -0400 ++++ ./cmake/sdf_config.h.in 2014-08-22 21:07:34.382208622 -0400 +@@ -26,7 +26,7 @@ + #cmakedefine BUILD_TYPE_RELEASE 1 + #cmakedefine HAVE_URDFDOM 1 + #cmakedefine USE_EXTERNAL_URDF 1 +-#cmakedefine URDF_GT_0P3 1 ++#cmakedefine URDF_GE_0P3 1 + + #define SDF_SHARE_PATH "${CMAKE_INSTALL_PREFIX}/share/" + #define SDF_VERSION_PATH "${CMAKE_INSTALL_PREFIX}/share/sdformat/${SDF_PKG_VERSION}" +diff -up ./cmake/SearchForStuff.cmake.urdfdom ./cmake/SearchForStuff.cmake +--- ./cmake/SearchForStuff.cmake.urdfdom 2014-07-11 13:50:35.000000000 -0400 ++++ ./cmake/SearchForStuff.cmake 2014-08-22 20:59:39.239507142 -0400 +@@ -62,12 +62,25 @@ if (USE_EXTERNAL_URDF) + set (URDF_GE_0P3 TRUE) + endif() + +- # what am I doing here? pkg-config and cmake +- set(URDF_INCLUDE_DIRS ${URDF_INCLUDEDIR}) +- set(URDF_LIBRARY_DIRS ${URDF_LIBDIR}) + endif() + endif() + ++################################################ ++# Find gtest ++find_package(GTest) ++if (USE_EXTERNAL_GTEST AND GTEST_FOUND) ++ set(GTEST_LIBRARY ${GTEST_LIBRARIES}) ++ set(GTEST_MAIN_LIBRARY ${GTEST_MAIN_LIBRARIES}) ++ set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE_DIRS}) ++else() ++ add_library(gtest STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest-all.cc") ++ add_library(gtest_main STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest_main.cc") ++ target_link_libraries(gtest_main gtest) ++ set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a") ++ set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a") ++ set(GTEST_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/test/gtest/include") ++endif() ++ + ################################################# + # Macro to check for visibility capability in compiler + # Original idea from: https://gitorious.org/ferric-cmake-stuff/ diff --git a/sdformat.spec b/sdformat.spec index 279de2b..ee6cfa6 100644 --- a/sdformat.spec +++ b/sdformat.spec @@ -1,21 +1,22 @@ -%global hghash 8e386fc1f1c6 -%global apiver 1.4 +%global hghash d79259b26096 +%global apiver 2.0 Name: sdformat -Version: 1.4.11 +Version: 2.0.1 Release: 2%{?dist} Summary: The Simulation Description Format License: ASL 2.0 URL: http://gazebosim.org/sdf.html -Source0: https://bitbucket.org/osrf/%{name}/get/%{name}_%{version}.tar.bz2 +Source0: https://bitbucket.org/osrf/%{name}/get/%{name}2_%{version}.tar.bz2 # Unbundle urdfdom and urdfdom-headers from sdformat, build against system versions. # Work progressing upstream -Patch0: sdformat-1.4.10-urdfdom.patch +Patch0: sdformat-2.0.1-urdfdom.patch # Automatically discovers and uses system gtest if available. # Not yet submitted upstream Patch1: sdformat-1.4.10-gtest.patch - +# Changes from the upstream "update_urdf_3.0" branch to parser_urdf.cc +Patch2: sdformat-2.0.1-urdf3.patch BuildRequires: boost-devel BuildRequires: cmake BuildRequires: doxygen-latex @@ -24,6 +25,9 @@ BuildRequires: gtest-devel BuildRequires: tinyxml-devel BuildRequires: urdfdom-devel +#Test dependencies +BuildRequires: python + %description The Simulation Description Format (SDF) is an XML file format used to describe all the elements in a software simulation environment. Originally @@ -51,14 +55,18 @@ The %{name}-doc package contains development documentation for %setup -q -n osrf-%{name}-%{hghash} %patch0 -p0 -b .urdfdom %patch1 -p0 -b .gtest +%patch2 -p1 -b .urdf3 # Remove bundled urdf components rm -rf src/urdf rm -rf test/gtest %build -mkdir build; pushd build -%cmake .. -DCMAKE_BUILD_TYPE=None -DCMAKE_CXX_FLAGS_NONE="%{optflags}" -DLIB_INSTALL_DIR:STRING=%{_lib} +mkdir build +pushd build +%cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_CXX_FLAGS_NONE="%{optflags}" -DLIB_INSTALL_DIR:STRING=%{_lib} -DUSE_EXTERNAL_URDF=ON -DUSE_EXTERNAL_GTEST=ON .. + popd +cat build/sdf/sdf_config.h make -C build %{?_smp_mflags} make -C build doc @@ -66,7 +74,7 @@ make -C build doc make -C build install DESTDIR=%{buildroot} %check -make -C build test || exit 0 +make -C build test || cat build/Testing/Temporary/LastTest.log %post -p /sbin/ldconfig @@ -88,6 +96,34 @@ make -C build test || exit 0 %doc build/doxygen/html %changelog +* Sun Sep 07 2014 Rich Mattes - 2.0.1-2 +- Added CMake version script + +* Sat Aug 23 2014 Rich Mattes - 2.0.1-1 +- Update to release 2.0.1 +- Apply upstream patch for urdfdom 0.3 support + +* Mon Aug 18 2014 Fedora Release Engineering - 2.0.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 2.0.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Mon May 26 2014 Rich Mattes - 2.0.0-3 +- Apply patch for urdf 0.3.0 compatibility + +* Sun May 25 2014 Petr Machata - 2.0.0-3 +- Rebuild for boost 1.55.0 + +* Fri May 23 2014 David Tardon - 2.0.0-2 +- rebuild for boost 1.55.0 + +* Tue Apr 15 2014 Rich Mattes - 2.0.0-1 +- Update to release 2.0 + +* Sun Feb 09 2014 Rich Mattes - 1.4.11-3 +- Rebuild for console-bridge 0.2.5 + * Sun Jan 26 2014 Rich Mattes - 1.4.11-2 - Declare LIB_INSTALL_DIR relative to CMAKE_INSTALL_PREFIX (rhbz#1057939) diff --git a/sources b/sources index 01814d2..0a2cd42 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -693363e07cce8e94c75318d1215b0db8 sdformat_1.4.11.tar.bz2 +a29ee0a99f0e9b9a55ffd3b976b26b0a sdformat2_2.0.1.tar.bz2