Ask Your Question
0

How to get the MESH filenames from the urdf_parser?

asked 2012-09-14 10:16:56 -0500

shart115 gravatar image

Hi, I am trying to retrieve the mesh file names/paths from the robot URDF description. I seem to be able to get all of the other information (link name, mesh origin, parent/child link names, etc.).

Here is my code:

urdf::Model urdfModel;
if (!urdfModel.initParam("robot_description")) {
        ROS_ERROR("Error parsing URDF file...");
        return false;
}
string lnk_name = "/r2/left_palm";
boost::shared_ptr<urdf::Link> lnk;
urdfModel.getLink(lnk_name, lnk);

cout << "what is the type of model: " << viz->geometry->type << endl;
cout << viz->origin.position.x << endl;
cout << viz->origin.position.y << endl;
cout << viz->origin.position.z << endl;

That all works great, but I can't for the life of me figure out where the meshname is stored....

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-09-14 11:23:03 -0500

hsu gravatar image

I haven't tried this out, but in general, it's under collision or visual geometry:

boost::dynamic_pointer_cast<const urdf::Mesh>(link->collision->geometry)->filename
edit flag offensive delete link more

Comments

Awesome, that works perfect. Thanks!

shart115 gravatar image shart115  ( 2012-09-17 05:27:02 -0500 )edit

Could you guys please explain this a bit more. I'm utterly confused 1) how the example code in the quesiton could possibly work. Where is viz defined? 2) how this answer works... I don't get it at all. You're defining a dynamic pointer of type Mesh, but I don't get the rest...

mkopack gravatar image mkopack  ( 2012-10-16 10:26:16 -0500 )edit

Also doesn't help that the documentation for the urdf stuff is horribly lacking and has circular references. The example code only shows how to load it to be parsed, doesn't show how to access any of the data.

mkopack gravatar image mkopack  ( 2012-10-16 10:27:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-09-14 10:16:56 -0500

Seen: 393 times

Last updated: Sep 14 '12