Ask Your Question
1

KDL integration into urdf_python planned (or ongoing)?

asked 2012-02-09 06:22:59 -0500

Miguel Prada gravatar image

updated 2012-02-10 03:09:55 -0500

I just discovered that the package urdf_python existed, and I was really excited when I saw it could parse URDF files because I was assuming it would ouput a KDL chain. It turns out that it doesn't, so I'm wondering if there is any ongoing effort to extend it to include that functionality.

Otherwise I might try to do it myself, but I would rather not invest my time on that if someone else is already working on it.

If there isn't, which would you suggest is the fastest approach to be able to generate PyKDL chains from a urdf model?

  • To extend urdf_python package, specifically the URDF class in urdf.py, to support PyKDL
  • To find a way to get the chain generated by kdl_parser in C++ to PyKDL

In case you think the second is easier, any help would be appreciated, since I'm almost clueless about where to begin.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2012-02-09 21:22:02 -0500

updated 2012-02-10 03:48:48 -0500

If you don't want to implement a kdl generator from urdf for python I think you could reuse the code from http://ros.org/wiki/kdl_parser. Rapid development alternatives:

  • using python ctypes for python and the library libkdl_parser.so
  • make a proper wrapper of libkdl_parser.so for python
edit flag offensive delete link more

Comments

Ooops, where I said urdf_parser in the original question I wanted to say kdl_parser. Corrected it. I'll check how should I go about using ctypes or wrapping kdl_parser for python and then I'll decide. I don't quite get what you mean with the first option though. Thanks for your help!
Miguel Prada gravatar image Miguel Prada  ( 2012-02-10 03:08:34 -0500 )edit
after a thorough reflexion about the first approach I think it is a bit messy and I've removed it. I was thinking of serializing the KDL data: chains, joints, etc. to an agnostic string serlialization like JSON. After this you should iterate this structure and coping it to a PyKDL object. (messy)
Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2012-02-10 03:52:27 -0500 )edit
PyKDL is built using SIP, so I guess that using it to wrap kdl_parser would be the best option. I'm having some trouble with that, though, and I don't find too much documentation which I can actually understand, so I will probably end up doing it in a messy way (extend urdf_python, probably).
Miguel Prada gravatar image Miguel Prada  ( 2012-02-10 04:07:13 -0500 )edit
Yep, very interesting code: http://svn.mech.kuleuven.be/repos/orocos/trunk/kdl/src/bindings/python/PyKDL/ I don't have experience with SIP. However it seems that a very straight forward pacth over KDL linked with libkdl_parser.so and with a new KDL::Tree(string urdf) constructor would be a solution
Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2012-02-10 05:33:47 -0500 )edit
I was thinking of something like this: KDL::Tree(string urdf):KDL::Tree(auxiliar_call_kdl_parser(urdf)) {} (using the copy constructor)... however I see that the KDL::Tree is not available in PyKDL. isn't it? Therefore the SIP wrapping definition would be also needed.
Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2012-02-10 05:42:58 -0500 )edit
Well, seeing KDL::Tree is not supported in PyKDL properly wrapping kdl_parser using SIP is becoming more and more complicated and would require much more work than I thought. Since I only need to parse relatively simple chains (not trees) I'll take a simpler approach. Thanks for your help anyways!
Miguel Prada gravatar image Miguel Prada  ( 2012-02-11 22:07:49 -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

Stats

Asked: 2012-02-09 06:22:59 -0500

Seen: 370 times

Last updated: Feb 10 '12