ros / xacro

Xacro is an XML macro language. With xacro, you can construct shorter and more readable XML files by using macros that expand to larger XML expressions.

Home Page:http://www.ros.org/wiki/xacro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request(?): More programmatic URDF generation

Doomerdinger opened this issue · comments

I am currently working on a project which requires highly dynamic and customizable URDFs. I am using xacro for this task, but there are a number of things I have to do which are quite hacky, brittle, and slow (one of the URDFs I am working with can take upwards of 25 seconds to parse with xacro).

Much of what I am trying to do would be made significantly easier if I was able to use a more traditional programming language (python/c++) to define URDF components. Before setting out on my own to to create this I did some searching and found this repo which allows for making URDFs with python.

Are there any thoughts on xacro providing a functionality similar to that, where xacro can do everything it does now with parsing xml files in addition to this python functionally? Ideally the python side of things would be able to import existing xml-xacro files and use them easily. I'd be more than happy to make an attempt at this at some point if this suggestion isn't totally outlandish, and I'm not missing some other project (or feature of xacro) that already accomplishes this task.

xacro aims to be a generic XML macro language and isn't limited to URDFs. If you want to programmatically generate URDF (data) structures, you can use the python URDF DOM API or the referenced odio_urdf.
I don't think there is much overlap between the use cases of these two approaches.

Makes sense.

My largest issue right now is for loops, I need to iterate over some yaml data I load up in my system. I can do that, but it is very hacky. Would more proper XML for loops be an appropriate feature to attempt to add to Xacro, or should I turn my attention elsewhere?

for loop support would definitely be a nice feature. Please propose a xacro XML syntax before attempting to implement anything.

Thank you for the feedback. If I can get some time allotted for this, I'll make a proposal for the syntax in another issue.