ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi

I suffered from same problem. I show you my solution by using pseudo code.

You can get pointer for a link by

#include <urdf/model.h>
urdf::Model model;
model.initParam(paramname);//Maybe you can use other init~ function.
boost::shared_ptr<const urdf::Link> link = model.getlink(linkname_on_urdf);
boost::shared_ptr<urdf::Cylinder> cylinder = 
boost::dynamic_pointer_cast<urdf::Cylinder>(link->visual->geometry);

you can access the length menber such as

double leng = cylinder->length;

This is my first posting. Sorry if there are something improper.