-
Notifications
You must be signed in to change notification settings - Fork 21
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
Import Mujco mjcf files #95
base: main
Are you sure you want to change the base?
Conversation
Not an expert about this, but it is possible to leave |
To be honest, I find this a bit confusing:
What is the failure mode if one tries to load an unsupported model? It raises an error or silently load a wrong file? I am particularly scared of the second case as it can lead to hard to detect bugs. |
[0, 0, -9.80665, 0, 0, 0], dtype=torch.float64 | ||
), | ||
) -> "KinDynComputations": | ||
"""Creates a KinDynComputations object from a Mujoco XML string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Mujoco XML string" or "Mujoco XML path" or both?
"""Creates a KinDynComputations object from a Mujoco XML string | ||
|
||
Args: | ||
xml_string (Union[str, Path]): The Mujoco XML path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path or string or both?
[0, 0, -9.80665, 0, 0, 0], dtype=torch.float64 | ||
), | ||
) -> "KinDynComputations": | ||
"""Creates a KinDynComputations object from a URDF string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string or path?
KinDynComputations: The KinDynComputations object | ||
""" | ||
return KinDynComputations( | ||
model_string=xml_string, joints_name_list=joints_name_list, gravity=gravity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually supporting the mujoco xml string case?
# Copyright (C) 2021 Istituto Italiano di Tecnologia (IIT). All rights reserved. | ||
# This software may be modified and distributed under the terms of the | ||
# GNU Lesser General Public License v2.1 or any later version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong license (see #64) and year. To be honest, I would remove the year from the copyright headers exactly to avoid this kind of errors.
Minor: tests have a lot of commonalities, but I am not sure if there is a way to reduce the code duplication without hurting too much readability. |
General comment (not something that needs to be done): one way of being sure to support the full mjcf spec would be to change the parser to use the official mujoco parser, and actually create the adam model from the |
Nice to have: many users using mujoco use https://github.com/google-deepmind/mujoco_menagerie to get their models, if it is easy it may be useful to have a snippet that show in the README or the docs how to get a mujoco_menagerie model loaded in adam. |
This is also something that popped out with #74 |
Thanks @traversaro for the review, it really helped to clarify some doubts.
and in particular
I thought the same. My doubt was about the fact that the tags
This is implementable as well!
My idea was to raise an error if a unsupported field (e.g.
Indeed. Without adding the direct dependency, most likely, the user that is interested in this importer has already installed mujco as a dependency.
Good idea! As in the previous comment, somehow the dependency can be handled supposing that the user needs to install mujoco anyway.
This is indeed really nice to have! |
This PR introduces the possibility of loading mujoco files.
The handling of the tree and the loading of links and joints should be fine since the tests are passing (I'm generating the iCub XML).
I have some doubt.
1
There is a small API breaking when calling KinDynComputation:
Now instead of using
urdfstring
I'm usingmodel_string
, since it should be more general.adam/src/adam/numpy/computations.py
Lines 16 to 25 in ef03b97
Should I brake this?
2
The model factory is chosen via
adam/src/adam/numpy/computations.py
Line 33 in ef03b97
This function (https://github.com/ami-iit/adam/blob/mjcf-importer/src/adam/model/utils.py) should handle when a:
Is this covering the cases?
3
This PR should handle "standard" mujoco files having, for example,
quat
as orientation ordiaginertia
as inertia.I figured out that there are also other conventions (for example, expressing the axis with
xyaxis
).Btw, @giotherobot showed me that these "non -standard" mujoco files can be converted to "standard" ones via, for example: