Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate using python bindings of sdformat instead of the gz command line #30

Open
diegoferigo opened this issue Mar 8, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@diegoferigo
Copy link
Member

Starting from version 13, sdformat introduced native Python bindings. It's worth investigating if we could just call this library (that depends only on sdformat) instead of requiring to find the entire Gazebo Classic or Gazebo Sim suite.

Few comments:

@diegoferigo diegoferigo added the help wanted Extra attention is needed label Mar 8, 2024
@traversaro
Copy link
Collaborator

traversaro commented Mar 9, 2024

I could not find any package in PyPI nor conda-forge, last time I tried I think I installed it from the OSRF repo.

There is indeed no package on PyPI. On conda-forge the package are sdformat13-python and sdformat14-python, see https://github.com/conda-forge/libsdformat-feedstock and ami-iit/jaxsim#89 (comment) .

@diegoferigo
Copy link
Member Author

Excellent, maybe instead of replacing the usage of gz|ign command line, we can first try to import sdformatXX and, if not found, use the existing logic that exploits the full Gazebo installation.

In this way, we can slim down significantly our conda environments that install a full Gazebo suite just for having gz sdf.

@traversaro
Copy link
Collaborator

Excellent, maybe instead of replacing the usage of gz|ign command line, we can first try to import sdformatXX and, if not found, use the existing logic that exploits the full Gazebo installation.

In this way, we can slim down significantly our conda environments that install a full Gazebo suite just for having gz sdf.

Yes, that probably gets the best of both worlds, all dependencies installed in conda-forge while the possibility still of installing the library via pip by relying on gz installed in the system.

@diegoferigo
Copy link
Member Author

Referring #34 (comment), we managed to perform the URDF to SDF conversion by only requiring sdformat and gz-tools. I had early attempts of using the Python bindings of sdformat, but I couldn't find any way to catch the stdout produced when the conversion fails. For unknown reasons, the usual Python pipes to redirect the output do not catch the failures.

I'll leave this issue open as help wanted in case someone wants to try again (and I mean, using the python bindings as alternative method not as replacement). In the meantime, I can live happy by calling gz sdf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants