gazebosim / gazebosim/sdformat

Allow Xacro files to be included in world

Open
#1,411 2 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
C++
Stars
216
Forks
125
Avg merge
1d 14h
Merged PRs (30d)
14

Description

## 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:
```

...xml


model://my_robot

...

...

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

my_robot
1.0
my_robot.xacro


Jack
...


...

```

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.

Contributor guide

Open the contributing guide

Research direction

Start with the referenced handling in src/parser.cc around lines 859-860 and inspect how model.config selects files for world includes. Define how .xacro entries should be processed alongside URDF-to-SDF conversion, then verify that a model using my_robot.xacro can be included in a world with its pose.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.