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

Add machinery to easily access model locations on Python #91

Closed
traversaro opened this issue Jun 5, 2021 · 9 comments
Closed

Add machinery to easily access model locations on Python #91

traversaro opened this issue Jun 5, 2021 · 9 comments

Comments

@traversaro
Copy link
Member

At the moment the models installed by this repo are supposed to be consumed by the resource location mechanism of YARP and ROS (see #90). However, for some use cases (see ami-iit/adam#1 (comment)) it is convenient to also be able to access the location of the models by a simple Python package. A similar functionality is present in https://github.com/robotology/gym-ignition-model, but having it in icub-models directly would permit to have directly any new model that will be designed and made available related to iCub, including iCub3 and INAIL ergoCub robots. Borrowing the API From gym-ignition-model ideally it should be possible to do:

import icub_models

print(f"Models have been installed in: {icub_models.get_models_path()}")
print(f"Available robots: {icub_models.get_robot_names()}")
print()
print("Model files:")

for robot_name in icub_models.get_robot_names():
    print(f"{robot_name}: {icub_models.get_model_file(robot_name)}")

As this repo does not depend on anything else, it would be probably a good candidate to be uploaded directly on PyPI and conda-forge. In particular adding it in conda-forge would reduce the amount of space used on the robotology channel, as the icub-models packages with its ~20 MB of meshes (see https://anaconda.org/robotology/icub-models/files) that in the future will increase, is one of the most heavy on the robotology channel.

@traversaro
Copy link
Member Author

By the way it could be convenient to have some similar machinery in form of a C++ library to find the models without depending on ROS or YARP, but to be honest I would not know at the moment how to implement easily this, as it is less obvious to do that in C++.

@traversaro
Copy link
Member Author

@traversaro
Copy link
Member Author

Another good example of repo that makes its models available via a small Python library is https://github.com/Gepetto/example-robot-data .

@diegoferigo
Copy link
Member

diegoferigo commented Jun 7, 2021

I totally support this idea @traversaro! Some differences wrt to robotology/gym-ignition-models (I'll shorten it as gim below) to take into account:

  • All the models here are urdf, in gim are both urdf and sdf. There we have some machinery to convert automatically urdf -> sdf that could not be strictly needed here. Though, I dont know if there's the idea at some point of providing also SDF in icub-models. Note: this depends on ScenarIO, that might be not optimal in this case.
  • Due to Error loading meshes from a relative folder for urdf models gazebosim/sdformat#227, when a urdf is loaded into gazebo, also the meshes have to be added to the environment variables. This is the documented usage in icub-models, however in gim we opted for copying the meshes.

Modulo the previous comments, the Python support translates of just a bunch of metadata:

In other projects, we are currently migrating towards a more modern approach that consists of using setup.cfg with a dummy setup.py, but we can discuss this when needed.

@traversaro
Copy link
Member Author

traversaro commented Jan 19, 2022

The more the lab continue to use Python's tool, the more this issue seems important. Volunteers to solve it are more than welcome, and as usual mentoring and guidance are guaranteed! @robotology/iit-artificial-mechanical-intelligence

@traversaro
Copy link
Member Author

traversaro commented Jan 21, 2022

By the way it could be convenient to have some similar machinery in form of a C++ library to find the models without depending on ROS or YARP, but to be honest I would not know at the moment how to implement easily this, as it is less obvious to do that in C++.

NOSALRO/robot_dart#166 does somethings similar in C++, but it hardcodes the installation directory in the .hpp (that may be indeed a simple solution).

@GiulioRomualdi
Copy link
Member

I proposed a possible implementation in #130

@GiulioRomualdi
Copy link
Member

I think we can close this issue

@traversaro
Copy link
Member Author

Yes, thanks a lot @GiulioRomualdi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants