Commit f32fd6c0 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #388 from olivier-stasse/devel

Add name to model and set it when loading a urdf file.
parents b3180dc5 432f9a2b
......@@ -102,6 +102,9 @@ namespace se3
/// \brief Default 3D gravity vector (=(0,0,-9.81)).
static const Eigen::Vector3d gravity981;
/// \brief Model name;
std::string name;
/// \brief Default constructor. Builds an empty model with no joints.
Model()
: nq(0)
......
......@@ -572,8 +572,12 @@ namespace se3
throw (std::invalid_argument)
{
::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDFFile (filename);
if (urdfTree)
{
model.name = urdfTree->getName();
ParseRootTreeVisitor::run(urdfTree->getRoot(),model,root_joint,verbose);
}
else
{
const std::string exception_message ("The file " + filename + " does not contain a valid URDF model.");
......@@ -587,7 +591,10 @@ namespace se3
{
::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDFFile (filename);
if (urdfTree)
{
model.name = urdfTree->getName();
details::parseRootTree(urdfTree->getRoot(),model,verbose);
}
else
{
const std::string exception_message ("The file " + filename + " does not contain a valid URDF model.");
......
......@@ -34,6 +34,7 @@ BOOST_AUTO_TEST_CASE ( buildModel )
#endif
se3::Model model;
se3::urdf::buildModel(filename, model);
std::cout << "Robot's name:" << model.name << std::endl;
}
BOOST_AUTO_TEST_SUITE_END()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment