From 3507efead2db73477c40764bf7b2a2ce67ecc13e Mon Sep 17 00:00:00 2001 From: Joseph Mirabel Date: Mon, 4 Dec 2017 14:41:02 +0100 Subject: [PATCH 1/2] invalidate current config when calling createData or createGeomData --- src/device.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/device.cc b/src/device.cc index 1d4de28..044c38e 100644 --- a/src/device.cc +++ b/src/device.cc @@ -135,6 +135,7 @@ namespace hpp { data_ = DataPtr_t( new Data(*model_) ); // We assume that model is now complete and state can be resized. resizeState(); + invalidate(); } void Device:: @@ -142,6 +143,7 @@ namespace hpp { { geomData_ = GeomDataPtr_t( new GeomData(*geomModel_) ); se3::computeBodyRadius(*model_,*geomModel_,*geomData_); + invalidate(); } /* ---------------------------------------------------------------------- */ From 3c022219f15d3e0d39c8e8e64ef6e64eb9ec0f63 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel Date: Tue, 5 Dec 2017 16:22:15 +0100 Subject: [PATCH 2/2] Update to change in pinocchio --- src/urdf/util.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/urdf/util.cc b/src/urdf/util.cc index 5456469..cbde71f 100644 --- a/src/urdf/util.cc +++ b/src/urdf/util.cc @@ -188,12 +188,13 @@ namespace hpp { (model, geomModel, srdf, verbose); } - template + template void _loadModel (const DevicePtr_t& robot, const JointIndex& baseJoint, std::string prefix, const std::string& rootType, - const InType& urdf, + const ::urdf::ModelInterfaceSharedPtr urdfTree, + const std::istream& urdfStream, const std::string& srdf) { if (baseJoint != 0) @@ -203,9 +204,9 @@ namespace hpp { const JointIndex idFirstJoint = model.joints.size(); const FrameIndex idFirstFrame = model.frames.size(); if (rootType == "anchor") - se3::urdf::buildModel(urdf, model, verbose); + se3::urdf::buildModel(urdfTree, model, verbose); else - se3::urdf::buildModel(urdf, buildJoint(rootType), model, verbose); + se3::urdf::buildModel(urdfTree, buildJoint(rootType), model, verbose); robot->createData(); hppDout (notice, "Finished parsing URDF file."); @@ -213,7 +214,7 @@ namespace hpp { GeomModel geomModel; std::vector baseDirs = se3::rosPaths(); - se3::urdf::buildGeom(model, urdf, se3::COLLISION, geomModel, baseDirs); + se3::urdf::buildGeom(model, urdfStream, se3::COLLISION, geomModel, baseDirs); geomModel.addAllCollisionPairs(); if (!srdf.empty()) { @@ -346,8 +347,10 @@ namespace hpp { } } + ::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDFFile(urdfFileName); + std::ifstream urdfStream (urdfFileName.c_str()); _loadModel (robot, baseJoint, prefix, rootType, - urdfFileName, srdfFileName); + urdfTree, urdfStream, srdfFileName); } void loadModelFromString (const DevicePtr_t& robot, @@ -358,11 +361,9 @@ namespace hpp { const std::string& srdfString) { ::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDF(urdfString); - if (!urdfTree) { - throw std::invalid_argument ("Unable to parse the input URDF string"); - } + std::istringstream urdfStream (urdfString); _loadModel (robot, baseJoint, prefix, rootType, - urdfTree, srdfString); + urdfTree, urdfStream, srdfString); } } // end of namespace urdf. } // end of namespace pinocchio.