Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to API change in Pinocchio #52

Merged
merged 2 commits into from
Dec 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,15 @@ namespace hpp {
data_ = DataPtr_t( new Data(*model_) );
// We assume that model is now complete and state can be resized.
resizeState();
invalidate();
}

void Device::
createGeomData()
{
geomData_ = GeomDataPtr_t( new GeomData(*geomModel_) );
se3::computeBodyRadius(*model_,*geomModel_,*geomData_);
invalidate();
}

/* ---------------------------------------------------------------------- */
Expand Down
21 changes: 11 additions & 10 deletions src/urdf/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,13 @@ namespace hpp {
(model, geomModel, srdf, verbose);
}

template <bool srdfAsXmlString, typename InType>
template <bool srdfAsXmlString>
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)
Expand All @@ -203,17 +204,17 @@ 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.");

GeomModel geomModel;

std::vector<std::string> 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()) {
Expand Down Expand Up @@ -346,8 +347,10 @@ namespace hpp {
}
}

::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDFFile(urdfFileName);
std::ifstream urdfStream (urdfFileName.c_str());
_loadModel <false> (robot, baseJoint, prefix, rootType,
urdfFileName, srdfFileName);
urdfTree, urdfStream, srdfFileName);
}

void loadModelFromString (const DevicePtr_t& robot,
Expand All @@ -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 <true> (robot, baseJoint, prefix, rootType,
urdfTree, srdfString);
urdfTree, urdfStream, srdfString);
}
} // end of namespace urdf.
} // end of namespace pinocchio.
Expand Down