gazebosim/sdformat

Allow Xacro files to be included in world

开放

#1,411 创建于 2024年5月8日

 (2 条评论) (0 个反应) (0 位负责人)C++ (122 个派生)auto 404
enhancementhelp wanted

仓库指标

星标
 (216 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Desired behavior

I have a couple of robots expressed as Xacro files. I would like to be able to include these in my Simulation world by using:

<world>
  ...xml
  <include>
     <uri>
        model://my_robot
    </uri>
    <pose> ... </pose>
  <include>
  ...
</world>

I have a model.config for my_robot that looks like:

<?xml version="1.0"?>
<model>
  <name>my_robot</name>
  <version>1.0</version>
  <sdf version='1.5'>my_robot.xacro</sdf>

  <author>
    <name>Jack</name>
    <email> ... </email>
  </author>

  <description>
    ...
  </description>
</model>

I would expect Gazebo (and therefore SDFormat) to be able to handle Xacro files. I would expect the change to need to be supported here, just like URDF to SDF conversion is done before loading an SDF.

https://github.com/gazebosim/sdformat/blob/6f1c36502f1085836ab9876e26afac3238f26820/src/parser.cc#L859-L860

Alternatives considered

The current solution of running Xacro before inserting the model into Gazebo. The issue with this approach is that I have a lot of models and I don't want to have to write custom code to go through, convert to URDF, and then dynamically load into Gazebo. I think this feature would improve the ergonomics of GzSim and SDFormat.

Implementation suggestion

Adding another if statement at the line linked above to prerun Xacro (if on the system) if the file ends in .xacro. We also might want to start structuring the decision of which file to convert to as a more patterned approach than an if statement. Open to suggestions on how you would structure this.

Additional Context

I would like to add this feature myself, but I want to get the projects thoughts on whether this is the right place to add this feature / if it would be accepted.

贡献者指南